[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPDyKFpwyu4OYZo0yyM=8VEE75ONgwX2wF0j2OFZs-YnrWW-DA@mail.gmail.com>
Date: Wed, 3 Feb 2016 14:18:30 +0100
From: Ulf Hansson <ulf.hansson@...aro.org>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Linux PM list <linux-pm@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Tomeu Vizoso <tomeu.vizoso@...labora.com>,
Kevin Hilman <khilman@...nel.org>
Subject: Re: [PATCH] PM: Avoid false-positive warnings in dev_pm_domain_set()
On 3 February 2016 at 13:08, Rafael J. Wysocki <rafael@...nel.org> wrote:
> On Wed, Feb 3, 2016 at 10:58 AM, Ulf Hansson <ulf.hansson@...aro.org> wrote:
>> On 30 January 2016 at 12:54, Rafael J. Wysocki <rjw@...ysocki.net> wrote:
>>> From: Rafael J. Wysocki <rafael.j.wysocki@...el.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@...el.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.
>
> Well, this is a "you're doing a wrong thing" warning and it does say
> what the wrong thing is. Does it have to be more specific? I don't
> think so.
Okay! I don't have a strong opinion.
Feel free to add:
Acked-by: Ulf Hansson <ulf.hansson@...aro.org>
Kind regards
Uffe
Powered by blists - more mailing lists