From: Eduardo Valentin <edubezval@gmail.com>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] thermal: armada_thermal: Replace mdelay with usleep_range in armada370_init_sensor
Date: Thu, 26 Apr 2018 19:11:24 -0700 [thread overview]
Message-ID: <20180427021122.GA30803@localhost.localdomain> (raw)
In-Reply-To: <1523347982-29373-1-git-send-email-baijiaju1990@gmail.com>
Hey Jia-Ju,
On Tue, Apr 10, 2018 at 04:13:02PM +0800, Jia-Ju Bai wrote:
> armada370_init_sensor() is never called in atomic context.
>
> armada370_init_sensor() is set as ".init_sensor" in
> struct armada_thermal_data.
> ".init_sensor" is called armada_thermal_probe().
> armada_thermal_probe() is set as ".probe" in struct platform_driver.
> This function is not called in atomic context.
>
> Despite never getting called from atomic context, armada370_init_sensor()
> calls mdelay() to busily wait.
> This is not necessary and can be replaced with usleep_range() to
> avoid busy waiting.
>
> This is found by a static analysis tool named DCNS written by myself.
> And I also manually check it.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
> drivers/thermal/armada_thermal.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
> index ae75328..807fe74 100644
> --- a/drivers/thermal/armada_thermal.c
> +++ b/drivers/thermal/armada_thermal.c
> @@ -113,7 +113,7 @@ static void armada370_init_sensor(struct platform_device *pdev,
> reg &= ~PMU_TDC0_START_CAL_MASK;
> writel(reg, priv->control);
>
> - mdelay(10);
> + usleep_range(10000, 11000);
Cool, but these have been already translated into msleep():
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/thermal/armada_thermal.c#n141
> }
>
> static void armada375_init_sensor(struct platform_device *pdev,
> --
> 1.9.1
>
prev parent reply other threads:[~2018-04-27 2:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-10 8:13 [PATCH 1/3] thermal: armada_thermal: Replace mdelay with usleep_range in armada370_init_sensor Jia-Ju Bai
2018-04-27 2:11 ` Eduardo Valentin [this message]
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=20180427021122.GA30803@localhost.localdomain \
--to=edubezval@gmail.com \
--cc=baijiaju1990@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rui.zhang@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).