Skip to content

Commit dcca12a

Browse files
mwilczyrafaeljw
authored andcommitted
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: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com> [ rjw: Subject and changelog edits, whitespace adjustments ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 898ff0f commit dcca12a

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

drivers/acpi/nfit/core.c

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3282,6 +3282,23 @@ static void acpi_nfit_put_table(void *table)
32823282
acpi_put_table(table);
32833283
}
32843284

3285+
static void acpi_nfit_notify(acpi_handle handle, u32 event, void *data)
3286+
{
3287+
struct acpi_device *adev = data;
3288+
3289+
device_lock(&adev->dev);
3290+
__acpi_nfit_notify(&adev->dev, handle, event);
3291+
device_unlock(&adev->dev);
3292+
}
3293+
3294+
static void acpi_nfit_remove_notify_handler(void *data)
3295+
{
3296+
struct acpi_device *adev = data;
3297+
3298+
acpi_dev_remove_notify_handler(adev, ACPI_DEVICE_NOTIFY,
3299+
acpi_nfit_notify);
3300+
}
3301+
32853302
void acpi_nfit_shutdown(void *data)
32863303
{
32873304
struct acpi_nfit_desc *acpi_desc = data;
@@ -3368,7 +3385,18 @@ static int acpi_nfit_add(struct acpi_device *adev)
33683385

33693386
if (rc)
33703387
return rc;
3371-
return devm_add_action_or_reset(dev, acpi_nfit_shutdown, acpi_desc);
3388+
3389+
rc = devm_add_action_or_reset(dev, acpi_nfit_shutdown, acpi_desc);
3390+
if (rc)
3391+
return rc;
3392+
3393+
rc = acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
3394+
acpi_nfit_notify);
3395+
if (rc)
3396+
return rc;
3397+
3398+
return devm_add_action_or_reset(dev, acpi_nfit_remove_notify_handler,
3399+
adev);
33723400
}
33733401

33743402
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)
34463474
}
34473475
EXPORT_SYMBOL_GPL(__acpi_nfit_notify);
34483476

3449-
static void acpi_nfit_notify(struct acpi_device *adev, u32 event)
3450-
{
3451-
device_lock(&adev->dev);
3452-
__acpi_nfit_notify(&adev->dev, adev->handle, event);
3453-
device_unlock(&adev->dev);
3454-
}
3455-
34563477
static const struct acpi_device_id acpi_nfit_ids[] = {
34573478
{ "ACPI0012", 0 },
34583479
{ "", 0 },
@@ -3465,7 +3486,6 @@ static struct acpi_driver acpi_nfit_driver = {
34653486
.ops = {
34663487
.add = acpi_nfit_add,
34673488
.remove = acpi_nfit_remove,
3468-
.notify = acpi_nfit_notify,
34693489
},
34703490
};
34713491

0 commit comments

Comments
 (0)