From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: narmstrong@baylibre.com, airlied@linux.ie,
daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, bhumirks@gmail.com
Subject: Re: [PATCH] gpu: drm: bridge: adv7511: Replace mdelay with usleep_range in adv7511_probe
Date: Fri, 27 Apr 2018 01:16:59 +0300 [thread overview]
Message-ID: <5009396.5p49gfLLAe@avalon> (raw)
In-Reply-To: <1523435622-4329-1-git-send-email-baijiaju1990@gmail.com>
Hi Jia-Ju,
Thank you for the patch.
On Wednesday, 11 April 2018 11:33:42 EEST Jia-Ju Bai wrote:
> adv7511_probe() is never called in atomic context.
> This function is only set as ".probe" in struct i2c_driver.
>
> Despite never getting called from atomic context, adv7511_probe()
> 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.
Nice work ! Is the tool open-source ?
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
> drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index b2431ae..2cf7fa1
> 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> @@ -1054,7 +1054,7 @@ static int adv7511_probe(struct i2c_client *i2c, const
> struct i2c_device_id *id) }
>
> if (adv7511->gpio_pd) {
> - mdelay(5);
> + usleep_range(5000, 6000);
> gpiod_set_value_cansleep(adv7511->gpio_pd, 0);
> }
The patch looks good to me.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
--
Regards,
Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: architt@codeaurora.org, a.hajda@samsung.com, airlied@linux.ie,
daniel.vetter@ffwll.ch, bhumirks@gmail.com,
narmstrong@baylibre.com, inki.dae@samsung.com,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] gpu: drm: bridge: adv7511: Replace mdelay with usleep_range in adv7511_probe
Date: Fri, 27 Apr 2018 01:16:59 +0300 [thread overview]
Message-ID: <5009396.5p49gfLLAe@avalon> (raw)
In-Reply-To: <1523435622-4329-1-git-send-email-baijiaju1990@gmail.com>
Hi Jia-Ju,
Thank you for the patch.
On Wednesday, 11 April 2018 11:33:42 EEST Jia-Ju Bai wrote:
> adv7511_probe() is never called in atomic context.
> This function is only set as ".probe" in struct i2c_driver.
>
> Despite never getting called from atomic context, adv7511_probe()
> 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.
Nice work ! Is the tool open-source ?
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
> drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index b2431ae..2cf7fa1
> 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> @@ -1054,7 +1054,7 @@ static int adv7511_probe(struct i2c_client *i2c, const
> struct i2c_device_id *id) }
>
> if (adv7511->gpio_pd) {
> - mdelay(5);
> + usleep_range(5000, 6000);
> gpiod_set_value_cansleep(adv7511->gpio_pd, 0);
> }
The patch looks good to me.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2018-04-26 22:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-11 8:33 [PATCH] gpu: drm: bridge: adv7511: Replace mdelay with usleep_range in adv7511_probe Jia-Ju Bai
2018-04-26 22:16 ` Laurent Pinchart [this message]
2018-04-26 22:16 ` Laurent Pinchart
2018-05-04 6:08 ` Archit Taneja
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=5009396.5p49gfLLAe@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=airlied@linux.ie \
--cc=baijiaju1990@gmail.com \
--cc=bhumirks@gmail.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=narmstrong@baylibre.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.