mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
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()
This commit is contained in:
commit
bee74dcbd3
@ -287,7 +287,7 @@ static ssize_t rrtime_store(struct device *dev,
|
||||
static ssize_t rrtime_show(struct device *dev,
|
||||
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);
|
||||
|
||||
@ -309,7 +309,7 @@ static ssize_t idlepct_store(struct device *dev,
|
||||
static ssize_t idlepct_show(struct device *dev,
|
||||
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);
|
||||
|
||||
|
@ -53,6 +53,7 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
|
||||
struct pcc_data *data;
|
||||
struct acpi_pcc_info *ctx = handler_context;
|
||||
struct pcc_mbox_chan *pcc_chan;
|
||||
static acpi_status ret;
|
||||
|
||||
data = kzalloc(sizeof(*data), GFP_KERNEL);
|
||||
if (!data)
|
||||
@ -69,23 +70,35 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
|
||||
if (IS_ERR(data->pcc_chan)) {
|
||||
pr_err("Failed to find PCC channel for subspace %d\n",
|
||||
ctx->subspace_id);
|
||||
kfree(data);
|
||||
return AE_NOT_FOUND;
|
||||
ret = AE_NOT_FOUND;
|
||||
goto err_free_data;
|
||||
}
|
||||
|
||||
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,
|
||||
pcc_chan->shmem_size);
|
||||
if (!data->pcc_comm_addr) {
|
||||
pr_err("Failed to ioremap PCC comm region mem for %d\n",
|
||||
ctx->subspace_id);
|
||||
pcc_mbox_free_channel(data->pcc_chan);
|
||||
kfree(data);
|
||||
return AE_NO_MEMORY;
|
||||
ret = AE_NO_MEMORY;
|
||||
goto err_free_channel;
|
||||
}
|
||||
|
||||
*region_context = data;
|
||||
return AE_OK;
|
||||
|
||||
err_free_channel:
|
||||
pcc_mbox_free_channel(data->pcc_chan);
|
||||
err_free_data:
|
||||
kfree(data);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static acpi_status
|
||||
@ -106,19 +119,17 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr,
|
||||
if (ret < 0)
|
||||
return AE_ERROR;
|
||||
|
||||
if (data->pcc_chan->mchan->mbox->txdone_irq) {
|
||||
/*
|
||||
* pcc_chan->latency is just a Nominal value. In reality the remote
|
||||
* processor could be much slower to reply. So add an arbitrary
|
||||
* amount of wait on top of Nominal.
|
||||
*/
|
||||
usecs_lat = PCC_CMD_WAIT_RETRIES_NUM * data->pcc_chan->latency;
|
||||
ret = wait_for_completion_timeout(&data->done,
|
||||
usecs_to_jiffies(usecs_lat));
|
||||
if (ret == 0) {
|
||||
pr_err("PCC command executed timeout!\n");
|
||||
return AE_TIME;
|
||||
}
|
||||
/*
|
||||
* pcc_chan->latency is just a Nominal value. In reality the remote
|
||||
* processor could be much slower to reply. So add an arbitrary
|
||||
* amount of wait on top of Nominal.
|
||||
*/
|
||||
usecs_lat = PCC_CMD_WAIT_RETRIES_NUM * data->pcc_chan->latency;
|
||||
ret = wait_for_completion_timeout(&data->done,
|
||||
usecs_to_jiffies(usecs_lat));
|
||||
if (ret == 0) {
|
||||
pr_err("PCC command executed timeout!\n");
|
||||
return AE_TIME;
|
||||
}
|
||||
|
||||
mbox_chan_txdone(data->pcc_chan->mchan, ret);
|
||||
|
@ -148,7 +148,7 @@ __ATTR(_name, 0444, show_##_name, NULL)
|
||||
if (ret) \
|
||||
return ret; \
|
||||
\
|
||||
return scnprintf(buf, PAGE_SIZE, "%llu\n", \
|
||||
return sysfs_emit(buf, "%llu\n", \
|
||||
(u64)st_name.member_name); \
|
||||
} \
|
||||
define_one_cppc_ro(member_name)
|
||||
@ -174,7 +174,7 @@ static ssize_t show_feedback_ctrs(struct kobject *kobj,
|
||||
if (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);
|
||||
}
|
||||
define_one_cppc_ro(feedback_ctrs);
|
||||
|
@ -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);
|
||||
|
||||
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
|
||||
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)
|
||||
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:");
|
||||
count += sysfs_emit_at(buf, count, "not-defined:");
|
||||
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)
|
||||
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:");
|
||||
count += sysfs_emit_at(buf, count, "not-defined:");
|
||||
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)
|
||||
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined\n");
|
||||
count += sysfs_emit_at(buf, count, "not-defined\n");
|
||||
else
|
||||
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld\n", fps->power);
|
||||
count += sysfs_emit_at(buf, count, "%lld\n", fps->power);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
@ -236,6 +236,7 @@ static int acpi_fan_get_fif(struct acpi_device *device)
|
||||
if (ACPI_FAILURE(status)) {
|
||||
dev_err(&device->dev, "Invalid _FIF element\n");
|
||||
status = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
fan->fif.revision = fields[0];
|
||||
|
@ -94,6 +94,7 @@ EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
|
||||
/**
|
||||
* acpi_get_irq_source_fwhandle() - Retrieve fwhandle from IRQ resource source.
|
||||
* @source: acpi_resource_source to use for the lookup.
|
||||
* @gsi: GSI IRQ number
|
||||
*
|
||||
* Description:
|
||||
* Retrieve the fwhandle of the device referenced by the given IRQ resource
|
||||
@ -297,8 +298,8 @@ EXPORT_SYMBOL_GPL(acpi_irq_get);
|
||||
/**
|
||||
* acpi_set_irq_model - Setup the GSI irqdomain information
|
||||
* @model: the value assigned to acpi_irq_model
|
||||
* @fwnode: the irq_domain identifier for mapping and looking up
|
||||
* GSI interrupts
|
||||
* @fn: a dispatcher function that will return the domain fwnode
|
||||
* for a given GSI
|
||||
*/
|
||||
void __init acpi_set_irq_model(enum acpi_irq_model_id model,
|
||||
struct fwnode_handle *(*fn)(u32))
|
||||
|
@ -743,6 +743,7 @@ static int __init pcc_init(void)
|
||||
|
||||
if (IS_ERR(pcc_pdev)) {
|
||||
pr_debug("Err creating PCC platform bundle\n");
|
||||
pcc_chan_count = 0;
|
||||
return PTR_ERR(pcc_pdev);
|
||||
}
|
||||
|
||||
|
@ -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.release = &pnp_release_device;
|
||||
|
||||
dev_set_name(&dev->dev, "%02x:%02x", dev->protocol->number, dev->number);
|
||||
|
||||
dev_id = pnp_add_id(dev, pnpid);
|
||||
if (!dev_id) {
|
||||
kfree(dev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dev_set_name(&dev->dev, "%02x:%02x", dev->protocol->number, dev->number);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,8 @@ static int __pnp_bus_suspend(struct device *dev, pm_message_t state)
|
||||
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);
|
||||
if (error)
|
||||
return error;
|
||||
|
Loading…
Reference in New Issue
Block a user