Commit bee74dcb authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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()
...@@ -287,7 +287,7 @@ static ssize_t rrtime_store(struct device *dev, ...@@ -287,7 +287,7 @@ static ssize_t rrtime_store(struct device *dev,
static ssize_t rrtime_show(struct device *dev, static ssize_t rrtime_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return scnprintf(buf, PAGE_SIZE, "%d\n", round_robin_time); return sysfs_emit(buf, "%d\n", round_robin_time);
} }
static DEVICE_ATTR_RW(rrtime); static DEVICE_ATTR_RW(rrtime);
...@@ -309,7 +309,7 @@ static ssize_t idlepct_store(struct device *dev, ...@@ -309,7 +309,7 @@ static ssize_t idlepct_store(struct device *dev,
static ssize_t idlepct_show(struct device *dev, static ssize_t idlepct_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return scnprintf(buf, PAGE_SIZE, "%d\n", idle_pct); return sysfs_emit(buf, "%d\n", idle_pct);
} }
static DEVICE_ATTR_RW(idlepct); static DEVICE_ATTR_RW(idlepct);
......
...@@ -53,6 +53,7 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function, ...@@ -53,6 +53,7 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
struct pcc_data *data; struct pcc_data *data;
struct acpi_pcc_info *ctx = handler_context; struct acpi_pcc_info *ctx = handler_context;
struct pcc_mbox_chan *pcc_chan; struct pcc_mbox_chan *pcc_chan;
static acpi_status ret;
data = kzalloc(sizeof(*data), GFP_KERNEL); data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data) if (!data)
...@@ -69,23 +70,35 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function, ...@@ -69,23 +70,35 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
if (IS_ERR(data->pcc_chan)) { if (IS_ERR(data->pcc_chan)) {
pr_err("Failed to find PCC channel for subspace %d\n", pr_err("Failed to find PCC channel for subspace %d\n",
ctx->subspace_id); ctx->subspace_id);
kfree(data); ret = AE_NOT_FOUND;
return AE_NOT_FOUND; goto err_free_data;
} }
pcc_chan = data->pcc_chan; pcc_chan = data->pcc_chan;
if (!pcc_chan->mchan->mbox->txdone_irq) {
pr_err("This channel-%d does not support interrupt.\n",
ctx->subspace_id);
ret = AE_SUPPORT;
goto err_free_channel;
}
data->pcc_comm_addr = acpi_os_ioremap(pcc_chan->shmem_base_addr, data->pcc_comm_addr = acpi_os_ioremap(pcc_chan->shmem_base_addr,
pcc_chan->shmem_size); pcc_chan->shmem_size);
if (!data->pcc_comm_addr) { if (!data->pcc_comm_addr) {
pr_err("Failed to ioremap PCC comm region mem for %d\n", pr_err("Failed to ioremap PCC comm region mem for %d\n",
ctx->subspace_id); ctx->subspace_id);
pcc_mbox_free_channel(data->pcc_chan); ret = AE_NO_MEMORY;
kfree(data); goto err_free_channel;
return AE_NO_MEMORY;
} }
*region_context = data; *region_context = data;
return AE_OK; return AE_OK;
err_free_channel:
pcc_mbox_free_channel(data->pcc_chan);
err_free_data:
kfree(data);
return ret;
} }
static acpi_status static acpi_status
...@@ -106,19 +119,17 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr, ...@@ -106,19 +119,17 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr,
if (ret < 0) if (ret < 0)
return AE_ERROR; return AE_ERROR;
if (data->pcc_chan->mchan->mbox->txdone_irq) { /*
/* * pcc_chan->latency is just a Nominal value. In reality the remote
* pcc_chan->latency is just a Nominal value. In reality the remote * processor could be much slower to reply. So add an arbitrary
* processor could be much slower to reply. So add an arbitrary * amount of wait on top of Nominal.
* amount of wait on top of Nominal. */
*/ usecs_lat = PCC_CMD_WAIT_RETRIES_NUM * data->pcc_chan->latency;
usecs_lat = PCC_CMD_WAIT_RETRIES_NUM * data->pcc_chan->latency; ret = wait_for_completion_timeout(&data->done,
ret = wait_for_completion_timeout(&data->done, usecs_to_jiffies(usecs_lat));
usecs_to_jiffies(usecs_lat)); if (ret == 0) {
if (ret == 0) { pr_err("PCC command executed timeout!\n");
pr_err("PCC command executed timeout!\n"); return AE_TIME;
return AE_TIME;
}
} }
mbox_chan_txdone(data->pcc_chan->mchan, ret); mbox_chan_txdone(data->pcc_chan->mchan, ret);
......
...@@ -148,7 +148,7 @@ __ATTR(_name, 0444, show_##_name, NULL) ...@@ -148,7 +148,7 @@ __ATTR(_name, 0444, show_##_name, NULL)
if (ret) \ if (ret) \
return ret; \ return ret; \
\ \
return scnprintf(buf, PAGE_SIZE, "%llu\n", \ return sysfs_emit(buf, "%llu\n", \
(u64)st_name.member_name); \ (u64)st_name.member_name); \
} \ } \
define_one_cppc_ro(member_name) define_one_cppc_ro(member_name)
...@@ -174,7 +174,7 @@ static ssize_t show_feedback_ctrs(struct kobject *kobj, ...@@ -174,7 +174,7 @@ static ssize_t show_feedback_ctrs(struct kobject *kobj,
if (ret) if (ret)
return ret; return ret;
return scnprintf(buf, PAGE_SIZE, "ref:%llu del:%llu\n", return sysfs_emit(buf, "ref:%llu del:%llu\n",
fb_ctrs.reference, fb_ctrs.delivered); fb_ctrs.reference, fb_ctrs.delivered);
} }
define_one_cppc_ro(feedback_ctrs); define_one_cppc_ro(feedback_ctrs);
......
...@@ -27,24 +27,24 @@ static ssize_t show_state(struct device *dev, struct device_attribute *attr, cha ...@@ -27,24 +27,24 @@ static ssize_t show_state(struct device *dev, struct device_attribute *attr, cha
count = scnprintf(buf, PAGE_SIZE, "%lld:", fps->control); count = scnprintf(buf, PAGE_SIZE, "%lld:", fps->control);
if (fps->trip_point == 0xFFFFFFFF || fps->trip_point > 9) if (fps->trip_point == 0xFFFFFFFF || fps->trip_point > 9)
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:"); count += sysfs_emit_at(buf, count, "not-defined:");
else else
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld:", fps->trip_point); count += sysfs_emit_at(buf, count, "%lld:", fps->trip_point);
if (fps->speed == 0xFFFFFFFF) if (fps->speed == 0xFFFFFFFF)
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:"); count += sysfs_emit_at(buf, count, "not-defined:");
else else
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld:", fps->speed); count += sysfs_emit_at(buf, count, "%lld:", fps->speed);
if (fps->noise_level == 0xFFFFFFFF) if (fps->noise_level == 0xFFFFFFFF)
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:"); count += sysfs_emit_at(buf, count, "not-defined:");
else else
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld:", fps->noise_level * 100); count += sysfs_emit_at(buf, count, "%lld:", fps->noise_level * 100);
if (fps->power == 0xFFFFFFFF) if (fps->power == 0xFFFFFFFF)
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined\n"); count += sysfs_emit_at(buf, count, "not-defined\n");
else else
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld\n", fps->power); count += sysfs_emit_at(buf, count, "%lld\n", fps->power);
return count; return count;
} }
......
...@@ -236,6 +236,7 @@ static int acpi_fan_get_fif(struct acpi_device *device) ...@@ -236,6 +236,7 @@ static int acpi_fan_get_fif(struct acpi_device *device)
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
dev_err(&device->dev, "Invalid _FIF element\n"); dev_err(&device->dev, "Invalid _FIF element\n");
status = -EINVAL; status = -EINVAL;
goto err;
} }
fan->fif.revision = fields[0]; fan->fif.revision = fields[0];
......
...@@ -94,6 +94,7 @@ EXPORT_SYMBOL_GPL(acpi_unregister_gsi); ...@@ -94,6 +94,7 @@ EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
/** /**
* acpi_get_irq_source_fwhandle() - Retrieve fwhandle from IRQ resource source. * acpi_get_irq_source_fwhandle() - Retrieve fwhandle from IRQ resource source.
* @source: acpi_resource_source to use for the lookup. * @source: acpi_resource_source to use for the lookup.
* @gsi: GSI IRQ number
* *
* Description: * Description:
* Retrieve the fwhandle of the device referenced by the given IRQ resource * Retrieve the fwhandle of the device referenced by the given IRQ resource
...@@ -297,8 +298,8 @@ EXPORT_SYMBOL_GPL(acpi_irq_get); ...@@ -297,8 +298,8 @@ EXPORT_SYMBOL_GPL(acpi_irq_get);
/** /**
* acpi_set_irq_model - Setup the GSI irqdomain information * acpi_set_irq_model - Setup the GSI irqdomain information
* @model: the value assigned to acpi_irq_model * @model: the value assigned to acpi_irq_model
* @fwnode: the irq_domain identifier for mapping and looking up * @fn: a dispatcher function that will return the domain fwnode
* GSI interrupts * for a given GSI
*/ */
void __init acpi_set_irq_model(enum acpi_irq_model_id model, void __init acpi_set_irq_model(enum acpi_irq_model_id model,
struct fwnode_handle *(*fn)(u32)) struct fwnode_handle *(*fn)(u32))
......
...@@ -743,6 +743,7 @@ static int __init pcc_init(void) ...@@ -743,6 +743,7 @@ static int __init pcc_init(void)
if (IS_ERR(pcc_pdev)) { if (IS_ERR(pcc_pdev)) {
pr_debug("Err creating PCC platform bundle\n"); pr_debug("Err creating PCC platform bundle\n");
pcc_chan_count = 0;
return PTR_ERR(pcc_pdev); return PTR_ERR(pcc_pdev);
} }
......
...@@ -148,14 +148,14 @@ struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id, ...@@ -148,14 +148,14 @@ struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id,
dev->dev.coherent_dma_mask = dev->dma_mask; dev->dev.coherent_dma_mask = dev->dma_mask;
dev->dev.release = &pnp_release_device; dev->dev.release = &pnp_release_device;
dev_set_name(&dev->dev, "%02x:%02x", dev->protocol->number, dev->number);
dev_id = pnp_add_id(dev, pnpid); dev_id = pnp_add_id(dev, pnpid);
if (!dev_id) { if (!dev_id) {
kfree(dev); kfree(dev);
return NULL; return NULL;
} }
dev_set_name(&dev->dev, "%02x:%02x", dev->protocol->number, dev->number);
return dev; return dev;
} }
......
...@@ -182,7 +182,8 @@ static int __pnp_bus_suspend(struct device *dev, pm_message_t state) ...@@ -182,7 +182,8 @@ static int __pnp_bus_suspend(struct device *dev, pm_message_t state)
return error; return error;
} }
if (pnp_can_disable(pnp_dev)) { /* can_write is necessary to be able to re-start the device on resume */
if (pnp_can_disable(pnp_dev) && pnp_can_write(pnp_dev)) {
error = pnp_stop_dev(pnp_dev); error = pnp_stop_dev(pnp_dev);
if (error) if (error)
return error; return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment