diff mbox

[V6,01/10] PM / Domains: Fix removal of a subdomain

Message ID 1456501724-28477-2-git-send-email-jonathanh@nvidia.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Jon Hunter Feb. 26, 2016, 3:48 p.m. UTC
Commit 30e7a65b3fdb ("PM / Domains: Ensure subdomain is not in use
before removing") added a test to ensure that a subdomain is not is not
a master to another subdomain or if any devices are using the subdomain
before removing. This change incorrectly used the "slave_links" list to
determine if the subdomain is a master to another subdomain, where it
should have been using the "master_links" list instead. The
"slave_links" list will never be empty for a subdomain and so a
subdomain can never be removed. Fix this by testing if the
"master_links" list is empty instead.

Fixes: 30e7a65b3fdb ("PM / Domains: Ensure subdomain is not in use
       before removing")

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/base/power/domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thierry Reding Feb. 29, 2016, 6:58 a.m. UTC | #1
On Fri, Feb 26, 2016 at 03:48:35PM +0000, Jon Hunter wrote:
> Commit 30e7a65b3fdb ("PM / Domains: Ensure subdomain is not in use
> before removing") added a test to ensure that a subdomain is not is not

Double "is not".

> a master to another subdomain or if any devices are using the subdomain
> before removing. This change incorrectly used the "slave_links" list to
> determine if the subdomain is a master to another subdomain, where it
> should have been using the "master_links" list instead. The
> "slave_links" list will never be empty for a subdomain and so a
> subdomain can never be removed. Fix this by testing if the
> "master_links" list is empty instead.
> 
> Fixes: 30e7a65b3fdb ("PM / Domains: Ensure subdomain is not in use
>        before removing")
> 
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>

I think the Fixes: line is allowed to be longer than 72 characters (the
important bits are in the first few characters anyway) and it doesn't
need to be separated from other tags by a blank line. That said, I doubt
that any of the automation tools will be confused.

Other than that, the change looks correct:

Reviewed-by: Thierry Reding <treding@nvidia.com>

> ---
>  drivers/base/power/domain.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index e8ca290dbf9d..ea9f2aa3fc33 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1382,7 +1382,7 @@ int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
>  	mutex_lock(&subdomain->lock);
>  	mutex_lock_nested(&genpd->lock, SINGLE_DEPTH_NESTING);
>  
> -	if (!list_empty(&subdomain->slave_links) || subdomain->device_count) {
> +	if (!list_empty(&subdomain->master_links) || subdomain->device_count) {
>  		pr_warn("%s: unable to remove subdomain %s\n", genpd->name,
>  			subdomain->name);
>  		ret = -EBUSY;
> -- 
> 2.1.4
>
Ulf Hansson Feb. 29, 2016, 12:13 p.m. UTC | #2
On 26 February 2016 at 16:48, Jon Hunter <jonathanh@nvidia.com> wrote:
> Commit 30e7a65b3fdb ("PM / Domains: Ensure subdomain is not in use
> before removing") added a test to ensure that a subdomain is not is not
> a master to another subdomain or if any devices are using the subdomain
> before removing. This change incorrectly used the "slave_links" list to
> determine if the subdomain is a master to another subdomain, where it
> should have been using the "master_links" list instead. The
> "slave_links" list will never be empty for a subdomain and so a
> subdomain can never be removed. Fix this by testing if the
> "master_links" list is empty instead.
>
> Fixes: 30e7a65b3fdb ("PM / Domains: Ensure subdomain is not in use
>        before removing")
>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>

When you addressed the comments from Thierry, this also looks good to me.

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
>  drivers/base/power/domain.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index e8ca290dbf9d..ea9f2aa3fc33 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1382,7 +1382,7 @@ int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
>         mutex_lock(&subdomain->lock);
>         mutex_lock_nested(&genpd->lock, SINGLE_DEPTH_NESTING);
>
> -       if (!list_empty(&subdomain->slave_links) || subdomain->device_count) {
> +       if (!list_empty(&subdomain->master_links) || subdomain->device_count) {
>                 pr_warn("%s: unable to remove subdomain %s\n", genpd->name,
>                         subdomain->name);
>                 ret = -EBUSY;
> --
> 2.1.4
>
--
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 e8ca290dbf9d..ea9f2aa3fc33 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1382,7 +1382,7 @@  int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
 	mutex_lock(&subdomain->lock);
 	mutex_lock_nested(&genpd->lock, SINGLE_DEPTH_NESTING);
 
-	if (!list_empty(&subdomain->slave_links) || subdomain->device_count) {
+	if (!list_empty(&subdomain->master_links) || subdomain->device_count) {
 		pr_warn("%s: unable to remove subdomain %s\n", genpd->name,
 			subdomain->name);
 		ret = -EBUSY;