Commit dcca12ab authored by Michal Wilczynski's avatar Michal Wilczynski Committed by Rafael J. Wysocki

ACPI: NFIT: Install Notify() handler directly

Modify the ACPI NFIT driver to install its own Notify() handler directly
instead of providing an ACPI driver .notify() callback.

This will allow the ACPI driver .notify() callback to be eliminated.
Suggested-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarMichal Wilczynski <michal.wilczynski@intel.com>
[ rjw: Subject and changelog edits, whitespace adjustments ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 898ff0f0
......@@ -3282,6 +3282,23 @@ static void acpi_nfit_put_table(void *table)
acpi_put_table(table);
}
static void acpi_nfit_notify(acpi_handle handle, u32 event, void *data)
{
struct acpi_device *adev = data;
device_lock(&adev->dev);
__acpi_nfit_notify(&adev->dev, handle, event);
device_unlock(&adev->dev);
}
static void acpi_nfit_remove_notify_handler(void *data)
{
struct acpi_device *adev = data;
acpi_dev_remove_notify_handler(adev, ACPI_DEVICE_NOTIFY,
acpi_nfit_notify);
}
void acpi_nfit_shutdown(void *data)
{
struct acpi_nfit_desc *acpi_desc = data;
......@@ -3368,7 +3385,18 @@ static int acpi_nfit_add(struct acpi_device *adev)
if (rc)
return rc;
return devm_add_action_or_reset(dev, acpi_nfit_shutdown, acpi_desc);
rc = devm_add_action_or_reset(dev, acpi_nfit_shutdown, acpi_desc);
if (rc)
return rc;
rc = acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
acpi_nfit_notify);
if (rc)
return rc;
return devm_add_action_or_reset(dev, acpi_nfit_remove_notify_handler,
adev);
}
static void acpi_nfit_remove(struct acpi_device *adev)
......@@ -3446,13 +3474,6 @@ void __acpi_nfit_notify(struct device *dev, acpi_handle handle, u32 event)
}
EXPORT_SYMBOL_GPL(__acpi_nfit_notify);
static void acpi_nfit_notify(struct acpi_device *adev, u32 event)
{
device_lock(&adev->dev);
__acpi_nfit_notify(&adev->dev, adev->handle, event);
device_unlock(&adev->dev);
}
static const struct acpi_device_id acpi_nfit_ids[] = {
{ "ACPI0012", 0 },
{ "", 0 },
......@@ -3465,7 +3486,6 @@ static struct acpi_driver acpi_nfit_driver = {
.ops = {
.add = acpi_nfit_add,
.remove = acpi_nfit_remove,
.notify = acpi_nfit_notify,
},
};
......
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