All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Linux PM list <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	Kevin Hilman <khilman@kernel.org>
Subject: Re: [PATCH] PM: Avoid false-positive warnings in dev_pm_domain_set()
Date: Wed, 3 Feb 2016 10:58:21 +0100	[thread overview]
Message-ID: <CAPDyKFoCO6DY55+rsEhXqcA6dA12PvejroxDoS8G+SPKZsPWJA@mail.gmail.com> (raw)
In-Reply-To: <80793506.EZRY3UmSeu@vostro.rjw.lan>

On 30 January 2016 at 12:54, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> There is a WARN_ON() in dev_pm_domain_set() that triggers on attempts
> to set the pm_domain pointer for devices with a driver bound.
>
> However, that WARN_ON() triggers on attempts to clear the pointer
> too and the test it uses is based on checking the device's
> p->knode_driver pointer which still is set when the device bus
> type's/driver's ->remove callback has been executed.  This
> leads to false-positive warnings when bus type code calls
> dev_pm_domain_set() to clear the pm_domain pointer after
> invoking the driver's ->remove() callback.
>
> To avoid those false-positives, make dev_pm_domain_set() check
> if the pointer passed to it is NULL and skip the warning in
> that case.
>
> Fixes: 989561de9b51 (PM / Domains: add setter for dev.pm_domain)
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/base/power/common.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-pm/drivers/base/power/common.c
> ===================================================================
> --- linux-pm.orig/drivers/base/power/common.c
> +++ linux-pm/drivers/base/power/common.c
> @@ -146,7 +146,7 @@ void dev_pm_domain_set(struct device *de
>         if (dev->pm_domain == pd)
>                 return;
>
> -       WARN(device_is_bound(dev),
> +       WARN(pd && device_is_bound(dev),
>              "PM domains can only be changed for unbound devices\n");

Perhaps this information then becomes a bit misleading, as it's okay
to clear the pointer, but not assign it to a valid PM domain.

>         dev->pm_domain = pd;
>         device_pm_check_callbacks(dev);
>

Otherwise, this looks good to me!

Kind regards
Uffe

  parent reply	other threads:[~2016-02-03 10:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-30 11:54 [PATCH] PM: Avoid false-positive warnings in dev_pm_domain_set() Rafael J. Wysocki
2016-02-01 14:15 ` Andy Shevchenko
2016-02-03  9:58 ` Ulf Hansson [this message]
2016-02-03 12:08   ` Rafael J. Wysocki
2016-02-03 13:18     ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPDyKFoCO6DY55+rsEhXqcA6dA12PvejroxDoS8G+SPKZsPWJA@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=khilman@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=tomeu.vizoso@collabora.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.