diff mbox

PM / Domains: fix early device initialization failure

Message ID 1344522694-31164-1-git-send-email-m.szyprowski@samsung.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Marek Szyprowski Aug. 9, 2012, 2:31 p.m. UTC
dev_pm_get_subsys_data() returns 1 when a new object has been created,
what should not be considered as an error for pm_genpd_add_device().

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/base/power/domain.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

Comments

Rafael Wysocki Aug. 9, 2012, 7:30 p.m. UTC | #1
On Thursday, August 09, 2012, Marek Szyprowski wrote:
> dev_pm_get_subsys_data() returns 1 when a new object has been created,
> what should not be considered as an error for pm_genpd_add_device().
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

This has been reported twice already and there's a patch in linux-next
to fix this issue.  And your patch is incomplete. :-)

Thanks,
Rafael


> ---
>  drivers/base/power/domain.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index ba3487c..6b61819 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1323,9 +1323,16 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
>  		}
>  
>  	ret = dev_pm_get_subsys_data(dev);
> -	if (ret)
> +
> +	if (ret < 0)
>  		goto out;
>  
> +	/*
> +	 * dev_pm_get_subsys_data() returns 1 when new object has been created
> +	 */
> +	if (ret == 1)
> +		ret = 0;
> +
>  	genpd->device_count++;
>  	genpd->max_off_time_changed = true;
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index ba3487c..6b61819 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1323,9 +1323,16 @@  int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
 		}
 
 	ret = dev_pm_get_subsys_data(dev);
-	if (ret)
+
+	if (ret < 0)
 		goto out;
 
+	/*
+	 * dev_pm_get_subsys_data() returns 1 when new object has been created
+	 */
+	if (ret == 1)
+		ret = 0;
+
 	genpd->device_count++;
 	genpd->max_off_time_changed = true;