PM / Domains: Allow a better error handling of dev_pm_domain_attach()
authorUlf Hansson <ulf.hansson@linaro.org>
Wed, 9 May 2018 10:17:52 +0000 (12:17 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 14 May 2018 20:58:44 +0000 (22:58 +0200)
commit919b7308fcc452cd4e282bab389c33384a9f3790
treeaff8f55a43ae45af67ba91efde1a1f70ef798a02
parent4f688748c958deb947759773be6dffe6b44d084d
PM / Domains: Allow a better error handling of dev_pm_domain_attach()

The callers of dev_pm_domain_attach() currently checks the returned error
code for -EPROBE_DEFER and needs to ignore other error codes. This is an
unnecessary limitation, which also leads to a rather strange behaviour in
the error path.

Address this limitation, by changing the return codes from
acpi_dev_pm_attach() and genpd_dev_pm_attach(). More precisely, let them
return 0, when no PM domain is needed for the device and then return 1, in
case the device was successfully attached to its PM domain. In this way,
dev_pm_domain_attach(), gets a better understanding of what happens in the
attach attempts and also allowing its caller to better act on real errors
codes.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/device_pm.c
drivers/base/power/common.c
drivers/base/power/domain.c
include/linux/acpi.h
include/linux/pm_domain.h