Skip to content

Commit bee74dc

Browse files
committed
Merge branches 'acpi-fan', 'acpi-pcc', 'acpi-misc' and 'pnp'
Merge ACPI fan driver fixes, ACPI PCC driver fixes, miscellaneous ACPI cleanups and PNP updates for 6.2-rc1: - Make the ACPI fan driver use sysfs_emit_at() in its sysfs interface code (ye xingchen). - Fix the _FIF package extraction failure handling in the ACPI fan driver (Hanjun Guo). - Fix the PCC mailbox handling error code path (Huisong Li). - Avoid using PCC Opregions if there is no platform interrupt allocated for this purpose (Huisong Li). - Use sysfs_emit() instead of scnprintf() in the ACPI PAD driver and CPPC library (ye xingchen). - Fix some kernel-doc issues in the ACPI GSI processing code (Xiongfeng Wang). - Fix name memory leak in pnp_alloc_dev() (Yang Yingliang). - Do not disable PNP devices on suspend when they cannot be re-enabled on resume (Hans de Goede). * acpi-fan: ACPI: fan: Convert to use sysfs_emit_at() API ACPI: fan: Bail out if extract package failed * acpi-pcc: mailbox: pcc: Reset pcc_chan_count to zero in case of PCC probe failure ACPI: PCC: Setup PCC Opregion handler only if platform interrupt is available * acpi-misc: ACPI: use sysfs_emit() instead of scnprintf() ACPI: irq: Fix some kernel-doc issues * pnp: PNP: Do not disable devices on suspend when they cannot be re-enabled on resume PNP: fix name memory leak in pnp_alloc_dev()
5 parents 39f26d1 + 64ee252 + 6d7d3c2 + 92266c6 + 62a0ec9 commit bee74dc

File tree

9 files changed

+50
-35
lines changed

9 files changed

+50
-35
lines changed

drivers/acpi/acpi_pad.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ static ssize_t rrtime_store(struct device *dev,
287287
static ssize_t rrtime_show(struct device *dev,
288288
struct device_attribute *attr, char *buf)
289289
{
290-
return scnprintf(buf, PAGE_SIZE, "%d\n", round_robin_time);
290+
return sysfs_emit(buf, "%d\n", round_robin_time);
291291
}
292292
static DEVICE_ATTR_RW(rrtime);
293293

@@ -309,7 +309,7 @@ static ssize_t idlepct_store(struct device *dev,
309309
static ssize_t idlepct_show(struct device *dev,
310310
struct device_attribute *attr, char *buf)
311311
{
312-
return scnprintf(buf, PAGE_SIZE, "%d\n", idle_pct);
312+
return sysfs_emit(buf, "%d\n", idle_pct);
313313
}
314314
static DEVICE_ATTR_RW(idlepct);
315315

drivers/acpi/acpi_pcc.c

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
5353
struct pcc_data *data;
5454
struct acpi_pcc_info *ctx = handler_context;
5555
struct pcc_mbox_chan *pcc_chan;
56+
static acpi_status ret;
5657

5758
data = kzalloc(sizeof(*data), GFP_KERNEL);
5859
if (!data)
@@ -69,23 +70,35 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
6970
if (IS_ERR(data->pcc_chan)) {
7071
pr_err("Failed to find PCC channel for subspace %d\n",
7172
ctx->subspace_id);
72-
kfree(data);
73-
return AE_NOT_FOUND;
73+
ret = AE_NOT_FOUND;
74+
goto err_free_data;
7475
}
7576

7677
pcc_chan = data->pcc_chan;
78+
if (!pcc_chan->mchan->mbox->txdone_irq) {
79+
pr_err("This channel-%d does not support interrupt.\n",
80+
ctx->subspace_id);
81+
ret = AE_SUPPORT;
82+
goto err_free_channel;
83+
}
7784
data->pcc_comm_addr = acpi_os_ioremap(pcc_chan->shmem_base_addr,
7885
pcc_chan->shmem_size);
7986
if (!data->pcc_comm_addr) {
8087
pr_err("Failed to ioremap PCC comm region mem for %d\n",
8188
ctx->subspace_id);
82-
pcc_mbox_free_channel(data->pcc_chan);
83-
kfree(data);
84-
return AE_NO_MEMORY;
89+
ret = AE_NO_MEMORY;
90+
goto err_free_channel;
8591
}
8692

8793
*region_context = data;
8894
return AE_OK;
95+
96+
err_free_channel:
97+
pcc_mbox_free_channel(data->pcc_chan);
98+
err_free_data:
99+
kfree(data);
100+
101+
return ret;
89102
}
90103

91104
static acpi_status
@@ -106,19 +119,17 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr,
106119
if (ret < 0)
107120
return AE_ERROR;
108121

109-
if (data->pcc_chan->mchan->mbox->txdone_irq) {
110-
/*
111-
* pcc_chan->latency is just a Nominal value. In reality the remote
112-
* processor could be much slower to reply. So add an arbitrary
113-
* amount of wait on top of Nominal.
114-
*/
115-
usecs_lat = PCC_CMD_WAIT_RETRIES_NUM * data->pcc_chan->latency;
116-
ret = wait_for_completion_timeout(&data->done,
117-
usecs_to_jiffies(usecs_lat));
118-
if (ret == 0) {
119-
pr_err("PCC command executed timeout!\n");
120-
return AE_TIME;
121-
}
122+
/*
123+
* pcc_chan->latency is just a Nominal value. In reality the remote
124+
* processor could be much slower to reply. So add an arbitrary
125+
* amount of wait on top of Nominal.
126+
*/
127+
usecs_lat = PCC_CMD_WAIT_RETRIES_NUM * data->pcc_chan->latency;
128+
ret = wait_for_completion_timeout(&data->done,
129+
usecs_to_jiffies(usecs_lat));
130+
if (ret == 0) {
131+
pr_err("PCC command executed timeout!\n");
132+
return AE_TIME;
122133
}
123134

124135
mbox_chan_txdone(data->pcc_chan->mchan, ret);

drivers/acpi/cppc_acpi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ __ATTR(_name, 0444, show_##_name, NULL)
148148
if (ret) \
149149
return ret; \
150150
\
151-
return scnprintf(buf, PAGE_SIZE, "%llu\n", \
151+
return sysfs_emit(buf, "%llu\n", \
152152
(u64)st_name.member_name); \
153153
} \
154154
define_one_cppc_ro(member_name)
@@ -174,7 +174,7 @@ static ssize_t show_feedback_ctrs(struct kobject *kobj,
174174
if (ret)
175175
return ret;
176176

177-
return scnprintf(buf, PAGE_SIZE, "ref:%llu del:%llu\n",
177+
return sysfs_emit(buf, "ref:%llu del:%llu\n",
178178
fb_ctrs.reference, fb_ctrs.delivered);
179179
}
180180
define_one_cppc_ro(feedback_ctrs);

drivers/acpi/fan_attr.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,24 @@ static ssize_t show_state(struct device *dev, struct device_attribute *attr, cha
2727
count = scnprintf(buf, PAGE_SIZE, "%lld:", fps->control);
2828

2929
if (fps->trip_point == 0xFFFFFFFF || fps->trip_point > 9)
30-
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:");
30+
count += sysfs_emit_at(buf, count, "not-defined:");
3131
else
32-
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld:", fps->trip_point);
32+
count += sysfs_emit_at(buf, count, "%lld:", fps->trip_point);
3333

3434
if (fps->speed == 0xFFFFFFFF)
35-
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:");
35+
count += sysfs_emit_at(buf, count, "not-defined:");
3636
else
37-
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld:", fps->speed);
37+
count += sysfs_emit_at(buf, count, "%lld:", fps->speed);
3838

3939
if (fps->noise_level == 0xFFFFFFFF)
40-
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:");
40+
count += sysfs_emit_at(buf, count, "not-defined:");
4141
else
42-
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld:", fps->noise_level * 100);
42+
count += sysfs_emit_at(buf, count, "%lld:", fps->noise_level * 100);
4343

4444
if (fps->power == 0xFFFFFFFF)
45-
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined\n");
45+
count += sysfs_emit_at(buf, count, "not-defined\n");
4646
else
47-
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld\n", fps->power);
47+
count += sysfs_emit_at(buf, count, "%lld\n", fps->power);
4848

4949
return count;
5050
}

drivers/acpi/fan_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ static int acpi_fan_get_fif(struct acpi_device *device)
236236
if (ACPI_FAILURE(status)) {
237237
dev_err(&device->dev, "Invalid _FIF element\n");
238238
status = -EINVAL;
239+
goto err;
239240
}
240241

241242
fan->fif.revision = fields[0];

drivers/acpi/irq.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
9494
/**
9595
* acpi_get_irq_source_fwhandle() - Retrieve fwhandle from IRQ resource source.
9696
* @source: acpi_resource_source to use for the lookup.
97+
* @gsi: GSI IRQ number
9798
*
9899
* Description:
99100
* Retrieve the fwhandle of the device referenced by the given IRQ resource
@@ -297,8 +298,8 @@ EXPORT_SYMBOL_GPL(acpi_irq_get);
297298
/**
298299
* acpi_set_irq_model - Setup the GSI irqdomain information
299300
* @model: the value assigned to acpi_irq_model
300-
* @fwnode: the irq_domain identifier for mapping and looking up
301-
* GSI interrupts
301+
* @fn: a dispatcher function that will return the domain fwnode
302+
* for a given GSI
302303
*/
303304
void __init acpi_set_irq_model(enum acpi_irq_model_id model,
304305
struct fwnode_handle *(*fn)(u32))

drivers/mailbox/pcc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@ static int __init pcc_init(void)
743743

744744
if (IS_ERR(pcc_pdev)) {
745745
pr_debug("Err creating PCC platform bundle\n");
746+
pcc_chan_count = 0;
746747
return PTR_ERR(pcc_pdev);
747748
}
748749

drivers/pnp/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,14 @@ struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id,
148148
dev->dev.coherent_dma_mask = dev->dma_mask;
149149
dev->dev.release = &pnp_release_device;
150150

151-
dev_set_name(&dev->dev, "%02x:%02x", dev->protocol->number, dev->number);
152-
153151
dev_id = pnp_add_id(dev, pnpid);
154152
if (!dev_id) {
155153
kfree(dev);
156154
return NULL;
157155
}
158156

157+
dev_set_name(&dev->dev, "%02x:%02x", dev->protocol->number, dev->number);
158+
159159
return dev;
160160
}
161161

drivers/pnp/driver.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ static int __pnp_bus_suspend(struct device *dev, pm_message_t state)
182182
return error;
183183
}
184184

185-
if (pnp_can_disable(pnp_dev)) {
185+
/* can_write is necessary to be able to re-start the device on resume */
186+
if (pnp_can_disable(pnp_dev) && pnp_can_write(pnp_dev)) {
186187
error = pnp_stop_dev(pnp_dev);
187188
if (error)
188189
return error;

0 commit comments

Comments
 (0)