Commit a8a4d304 authored by Jia-Ju Bai's avatar Jia-Ju Bai Committed by Mauro Carvalho Chehab

media: i2c: vs6624: Replace mdelay() with msleep() and usleep_range() in vs6624_probe()

vs6624_probe() is never called in atomic context.
It calls mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep() and usleep_range().

This is found by a static analysis tool named DCNS written by myself.
Signed-off-by: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 2b5c5798
...@@ -770,7 +770,7 @@ static int vs6624_probe(struct i2c_client *client, ...@@ -770,7 +770,7 @@ static int vs6624_probe(struct i2c_client *client,
return ret; return ret;
} }
/* wait 100ms before any further i2c writes are performed */ /* wait 100ms before any further i2c writes are performed */
mdelay(100); msleep(100);
sensor = devm_kzalloc(&client->dev, sizeof(*sensor), GFP_KERNEL); sensor = devm_kzalloc(&client->dev, sizeof(*sensor), GFP_KERNEL);
if (sensor == NULL) if (sensor == NULL)
...@@ -782,7 +782,7 @@ static int vs6624_probe(struct i2c_client *client, ...@@ -782,7 +782,7 @@ static int vs6624_probe(struct i2c_client *client,
vs6624_writeregs(sd, vs6624_p1); vs6624_writeregs(sd, vs6624_p1);
vs6624_write(sd, VS6624_MICRO_EN, 0x2); vs6624_write(sd, VS6624_MICRO_EN, 0x2);
vs6624_write(sd, VS6624_DIO_EN, 0x1); vs6624_write(sd, VS6624_DIO_EN, 0x1);
mdelay(10); usleep_range(10000, 11000);
vs6624_writeregs(sd, vs6624_p2); vs6624_writeregs(sd, vs6624_p2);
vs6624_writeregs(sd, vs6624_default); vs6624_writeregs(sd, vs6624_default);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment