Skip to content

Commit d323436

Browse files
committed
ACPI: button: Tweak system wakeup handling
Modify struct acpi_button to hold a struct device pointer instead of a struct platform_device one to avoid unnecessary pointer dereferences and use that pointer consistently for system wakeup initialization, handling and cleanup. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/1948258.tdWV9SEqCh@rafael.j.wysocki
1 parent e91f8c5 commit d323436

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

drivers/acpi/button.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static struct platform_driver acpi_button_driver = {
170170

171171
struct acpi_button {
172172
struct acpi_device *adev;
173-
struct platform_device *pdev;
173+
struct device *dev; /* physical button device */
174174
unsigned int type;
175175
struct input_dev *input;
176176
char phys[32]; /* for input device */
@@ -398,7 +398,7 @@ static int acpi_lid_update_state(struct acpi_button *button,
398398
return state;
399399

400400
if (state && signal_wakeup)
401-
acpi_pm_wakeup_event(&button->pdev->dev);
401+
acpi_pm_wakeup_event(button->dev);
402402

403403
return acpi_lid_notify_state(button, state);
404404
}
@@ -455,7 +455,7 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
455455
return;
456456
}
457457

458-
acpi_pm_wakeup_event(&button->pdev->dev);
458+
acpi_pm_wakeup_event(button->dev);
459459

460460
if (button->suspended || event == ACPI_BUTTON_NOTIFY_WAKE)
461461
return;
@@ -550,7 +550,7 @@ static int acpi_button_probe(struct platform_device *pdev)
550550

551551
platform_set_drvdata(pdev, button);
552552

553-
button->pdev = pdev;
553+
button->dev = &pdev->dev;
554554
button->adev = device;
555555
button->input = input = input_allocate_device();
556556
if (!input) {
@@ -625,7 +625,7 @@ static int acpi_button_probe(struct platform_device *pdev)
625625
goto err_remove_fs;
626626
}
627627

628-
device_init_wakeup(&pdev->dev, true);
628+
device_init_wakeup(button->dev, true);
629629

630630
switch (device->device_type) {
631631
case ACPI_BUS_TYPE_POWER_BUTTON:
@@ -661,7 +661,7 @@ static int acpi_button_probe(struct platform_device *pdev)
661661
return 0;
662662

663663
err_input_unregister:
664-
device_init_wakeup(&pdev->dev, false);
664+
device_init_wakeup(button->dev, false);
665665
input_unregister_device(input);
666666
err_remove_fs:
667667
acpi_button_remove_fs(button);
@@ -693,7 +693,7 @@ static void acpi_button_remove(struct platform_device *pdev)
693693
}
694694
acpi_os_wait_events_complete();
695695

696-
device_init_wakeup(&pdev->dev, false);
696+
device_init_wakeup(button->dev, false);
697697

698698
acpi_button_remove_fs(button);
699699
input_unregister_device(button->input);

0 commit comments

Comments
 (0)