LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] gpu: drm: bridge: adv7511: Replace mdelay with usleep_range in adv7511_probe
@ 2018-04-11  8:33 Jia-Ju Bai
  2018-04-26 22:16 ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: Jia-Ju Bai @ 2018-04-11  8:33 UTC (permalink / raw)
  To: architt, a.hajda, Laurent.pinchart, airlied, daniel.vetter,
	bhumirks, narmstrong, inki.dae
  Cc: dri-devel, linux-kernel, Jia-Ju Bai

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.

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);
 	}
 
-- 
1.9.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpu: drm: bridge: adv7511: Replace mdelay with usleep_range in adv7511_probe
  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
  2018-05-04  6:08   ` Archit Taneja
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2018-04-26 22:16 UTC (permalink / raw)
  To: Jia-Ju Bai
  Cc: architt, a.hajda, airlied, daniel.vetter, bhumirks, narmstrong,
	inki.dae, dri-devel, linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpu: drm: bridge: adv7511: Replace mdelay with usleep_range in adv7511_probe
  2018-04-26 22:16 ` Laurent Pinchart
@ 2018-05-04  6:08   ` Archit Taneja
  0 siblings, 0 replies; 3+ messages in thread
From: Archit Taneja @ 2018-05-04  6:08 UTC (permalink / raw)
  To: Laurent Pinchart, Jia-Ju Bai
  Cc: a.hajda, airlied, daniel.vetter, bhumirks, narmstrong, inki.dae,
	dri-devel, linux-kernel



On Friday 27 April 2018 03:46 AM, Laurent Pinchart wrote:
> 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>

queued to drm-misc-next

Thanks,
Archit

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-04  6:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2018-05-04  6:08   ` Archit Taneja

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).