gpu: drm: bridge: adv7511: Replace mdelay with usleep_range in adv7511_probe
authorJia-Ju Bai <baijiaju1990@gmail.com>
Wed, 11 Apr 2018 08:33:42 +0000 (16:33 +0800)
committerArchit Taneja <architt@codeaurora.org>
Fri, 4 May 2018 06:00:51 +0000 (11:30 +0530)
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>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1523435622-4329-1-git-send-email-baijiaju1990@gmail.com
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c

index 2614cea538e21ecc4770d1e8f2273b14633ae057..73021b388e12d3bc1ca7cabfc0178af223f77686 100644 (file)
@@ -1127,7 +1127,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);
        }