LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] PM / Domains: Don't return -EEXIST at attach when PM domain exists
@ 2018-05-14 14:52 Ulf Hansson
  2018-05-15  0:53 ` Tony Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: Ulf Hansson @ 2018-05-14 14:52 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-pm
  Cc: Ulf Hansson, Krzysztof Kozlowski, Greg Kroah-Hartman,
	linux-kernel, linux-arm-kernel,
	linux-samsung-soc @ vger . kernel . org, Sylwester Nawrocki,
	Marek Szyprowski

As dev_pm_domain_attach() isn't the only way to assign PM domain pointers
to devices, clearly we must allow a device to have the pointer already
being assigned. For this reason, return 0 instead of -EEXIST.

Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Tested-by: Krzysztof Kozlowski <krzk@kernel.org>
---

Krzysztof reported problems for an Exynos5 board, where some devices are added
to their PM domains (genpd) via calling of_genpd_add_device(). As also pointed
out by Sylvester, this leads to probe failure when dev_pm_domain_attach()
returns -EXISTS.

Rafael, potentially this change could be squashed with the recently queued
patch: "PM / Domains: Check for existing PM domain in dev_pm_domain_attach()",
but perhaps its too late for that and the fix is better applied on top!?

---
 drivers/base/power/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c
index 5e4b481..390868c 100644
--- a/drivers/base/power/common.c
+++ b/drivers/base/power/common.c
@@ -106,7 +106,7 @@ int dev_pm_domain_attach(struct device *dev, bool power_on)
 	int ret;
 
 	if (dev->pm_domain)
-		return -EEXIST;
+		return 0;
 
 	ret = acpi_dev_pm_attach(dev, power_on);
 	if (!ret)
-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PM / Domains: Don't return -EEXIST at attach when PM domain exists
  2018-05-14 14:52 [PATCH] PM / Domains: Don't return -EEXIST at attach when PM domain exists Ulf Hansson
@ 2018-05-15  0:53 ` Tony Lindgren
  2018-05-15  8:06   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Lindgren @ 2018-05-15  0:53 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Rafael J . Wysocki, linux-pm,
	linux-samsung-soc @ vger . kernel . org, Greg Kroah-Hartman,
	linux-kernel, Krzysztof Kozlowski, Sylwester Nawrocki,
	linux-arm-kernel, Marek Szyprowski

* Ulf Hansson <ulf.hansson@linaro.org> [180514 14:55]:
> As dev_pm_domain_attach() isn't the only way to assign PM domain pointers
> to devices, clearly we must allow a device to have the pointer already
> being assigned. For this reason, return 0 instead of -EEXIST.
> 
> Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> Tested-by: Tested-by: Krzysztof Kozlowski <krzk@kernel.org>

Fixes the issue for me too:

Tested-by: Tony Lindgren <tony@atomide.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PM / Domains: Don't return -EEXIST at attach when PM domain exists
  2018-05-15  0:53 ` Tony Lindgren
@ 2018-05-15  8:06   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2018-05-15  8:06 UTC (permalink / raw)
  To: Tony Lindgren, Ulf Hansson
  Cc: Rafael J . Wysocki, Linux PM,
	linux-samsung-soc @ vger . kernel . org, Greg Kroah-Hartman,
	Linux Kernel Mailing List, Krzysztof Kozlowski,
	Sylwester Nawrocki, Linux ARM, Marek Szyprowski

On Tue, May 15, 2018 at 2:53 AM, Tony Lindgren <tony@atomide.com> wrote:
> * Ulf Hansson <ulf.hansson@linaro.org> [180514 14:55]:
>> As dev_pm_domain_attach() isn't the only way to assign PM domain pointers
>> to devices, clearly we must allow a device to have the pointer already
>> being assigned. For this reason, return 0 instead of -EEXIST.
>>
>> Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
>> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
>> Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>> Tested-by: Tested-by: Krzysztof Kozlowski <krzk@kernel.org>
>
> Fixes the issue for me too:
>
> Tested-by: Tony Lindgren <tony@atomide.com>

I've applied the patch with the tag above, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-15  8:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-14 14:52 [PATCH] PM / Domains: Don't return -EEXIST at attach when PM domain exists Ulf Hansson
2018-05-15  0:53 ` Tony Lindgren
2018-05-15  8:06   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).