[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180126102604.GB13775@amd>
Date: Fri, 26 Jan 2018 11:26:04 +0100
From: Pavel Machek <pavel@....cz>
To: Jia-Ju Bai <baijiaju1990@...il.com>
Cc: rjw@...ysocki.net, khilman@...nel.org, ulf.hansson@...aro.org,
len.brown@...el.com, gregkh@...uxfoundation.org,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] base: power: domain: Replace mdelay with msleep
On Fri 2018-01-26 16:38:19, Jia-Ju Bai wrote:
> After checking all possible call chains to genpd_dev_pm_detach() and
> genpd_dev_pm_attach() here,
> my tool finds that these functions are never called in atomic context,
> namely never in an interrupt handler or holding a spinlock.
> Thus mdelay can be replaced with msleep to avoid busy wait.
>
> This is found by a static analysis tool named DCNS written by
myself.
Well, cond_resched() just after msleep certainly looks like that.
Did the patch receive any testing?
> Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
> ---
> drivers/base/power/domain.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 0c80bea..f84ac72 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -2144,7 +2144,7 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off)
> if (ret != -EAGAIN)
> break;
>
> - mdelay(i);
> + msleep(i);
> cond_resched();
> }
>
> @@ -2231,7 +2231,7 @@ int genpd_dev_pm_attach(struct device *dev)
> if (ret != -EAGAIN)
> break;
>
> - mdelay(i);
> + msleep(i);
> cond_resched();
> }
> mutex_unlock(&gpd_list_lock);
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists