PM: wakeup: Unify device_init_wakeup() for PM_SLEEP and !PM_SLEEP
authorBjorn Helgaas <bhelgaas@google.com>
Tue, 7 Jun 2022 03:51:58 +0000 (22:51 -0500)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 5 Jul 2022 18:48:46 +0000 (20:48 +0200)
commit09d3154a6f0f0bb5b604832095804780f3684b96
treedb8974fea8226301e79afa89aa77cbbf0b1edfd1
parent88084a3df1672e131ddc1b4e39eeacfd39864acf
PM: wakeup: Unify device_init_wakeup() for PM_SLEEP and !PM_SLEEP

Previously the CONFIG_PM_SLEEP and !CONFIG_PM_SLEEP device_init_wakeup()
implementations differed in confusing ways:

  - The PM_SLEEP version checked for a NULL device pointer and returned
    -EINVAL, while the !PM_SLEEP version did not and would simply
    dereference a NULL pointer.

  - When called with "false", the !PM_SLEEP version cleared "capable" and
    "enable" in the opposite order of the PM_SLEEP version.  That was
    harmless because for !PM_SLEEP they're simple assignments, but it's
    unnecessary confusion.

Use a simplified version of the PM_SLEEP implementation for both cases.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/wakeup.c
include/linux/pm_wakeup.h