* [PATCH 00/13] media: ov772x/tw9910 cleanup
@ 2018-02-27 15:40 Jacopo Mondi
2018-02-27 15:40 ` [PATCH 01/13] media: tw9910: Fix parameter alignment issue Jacopo Mondi
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: Jacopo Mondi @ 2018-02-27 15:40 UTC (permalink / raw)
To: mchehab, laurent.pinchart, hans.verkuil, g.liakhovetski, bhumirks
Cc: Jacopo Mondi, linux-media
Hi Mauro,
as you have started cleaning up those two drivers as they've been now
moved away from soc_camera I have added a few style fixes for both of them
on top of your two patches:
commit ae24b8a1d5f9 ("media: tw9910: solve coding style issues")
commit 2d595d14fe8b ("media: ov772x: fix whitespace issues")
checkpatch now returns no error apart from a > 80 columns in ov772x I did not
break for sake of readability.
Thanks
j
Jacopo Mondi (13):
media: tw9910: Fix parameter alignment issue
media: tw9910: Empty line before end-of-function return
media: tw9910: Align function parameters
media: tw9910: Re-order variables declaration
media: tw9910: Re-organize in-code comments
media: tw9910: Mixed style fixes
media: tw9910: Sort includes alphabetically
media: tw9910: Replace msleep(1) with usleep_range
media: ov772x: Align function parameters
media: ov772x: Re-organize in-code comments
media: ov772x: Empty line before end-of-function return
media: ov772x: Re-order variables declaration
media: ov772x: Replace msleep(1) with usleep_range
drivers/media/i2c/ov772x.c | 63 +++++++++++++---------------
drivers/media/i2c/tw9910.c | 101 ++++++++++++++++++++-------------------------
2 files changed, 72 insertions(+), 92 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 01/13] media: tw9910: Fix parameter alignment issue
2018-02-27 15:40 [PATCH 00/13] media: ov772x/tw9910 cleanup Jacopo Mondi
@ 2018-02-27 15:40 ` Jacopo Mondi
2018-02-27 15:40 ` [PATCH 02/13] media: tw9910: Empty line before end-of-function return Jacopo Mondi
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jacopo Mondi @ 2018-02-27 15:40 UTC (permalink / raw)
To: mchehab, laurent.pinchart, hans.verkuil, g.liakhovetski, bhumirks
Cc: Jacopo Mondi, linux-media
Align parameters to first open brace.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
drivers/media/i2c/tw9910.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c
index cc5d383..70e0ae2 100644
--- a/drivers/media/i2c/tw9910.c
+++ b/drivers/media/i2c/tw9910.c
@@ -533,10 +533,10 @@ static int tw9910_s_std(struct v4l2_subdev *sd, v4l2_std_id norm)
}
if (!ret)
ret = i2c_smbus_write_byte_data(client, CROP_HI,
- ((vdelay >> 2) & 0xc0) |
- ((vact >> 4) & 0x30) |
- ((hdelay >> 6) & 0x0c) |
- ((hact >> 8) & 0x03));
+ ((vdelay >> 2) & 0xc0) |
+ ((vact >> 4) & 0x30) |
+ ((hdelay >> 6) & 0x0c) |
+ ((hact >> 8) & 0x03));
if (!ret)
ret = i2c_smbus_write_byte_data(client, VDELAY_LO,
vdelay & 0xff);
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 02/13] media: tw9910: Empty line before end-of-function return
2018-02-27 15:40 [PATCH 00/13] media: ov772x/tw9910 cleanup Jacopo Mondi
2018-02-27 15:40 ` [PATCH 01/13] media: tw9910: Fix parameter alignment issue Jacopo Mondi
@ 2018-02-27 15:40 ` Jacopo Mondi
2018-02-27 15:40 ` [PATCH 03/13] media: tw9910: Align function parameters Jacopo Mondi
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jacopo Mondi @ 2018-02-27 15:40 UTC (permalink / raw)
To: mchehab, laurent.pinchart, hans.verkuil, g.liakhovetski, bhumirks
Cc: Jacopo Mondi, linux-media
Add an empty line before return at the end of functions.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
drivers/media/i2c/tw9910.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c
index 70e0ae2..3e4b530 100644
--- a/drivers/media/i2c/tw9910.c
+++ b/drivers/media/i2c/tw9910.c
@@ -753,6 +753,7 @@ static int tw9910_get_selection(struct v4l2_subdev *sd,
sel->r.width = 768;
sel->r.height = 576;
}
+
return 0;
}
@@ -804,6 +805,7 @@ static int tw9910_s_fmt(struct v4l2_subdev *sd,
mf->width = width;
mf->height = height;
}
+
return ret;
}
@@ -842,6 +844,7 @@ static int tw9910_set_fmt(struct v4l2_subdev *sd,
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
return tw9910_s_fmt(sd, mf);
cfg->try_fmt = *mf;
+
return 0;
}
@@ -887,6 +890,7 @@ static int tw9910_video_probe(struct i2c_client *client)
done:
tw9910_s_power(&priv->subdev, 0);
+
return ret;
}
@@ -906,12 +910,14 @@ static int tw9910_enum_mbus_code(struct v4l2_subdev *sd,
return -EINVAL;
code->code = MEDIA_BUS_FMT_UYVY8_2X8;
+
return 0;
}
static int tw9910_g_tvnorms(struct v4l2_subdev *sd, v4l2_std_id *norm)
{
*norm = V4L2_STD_NTSC | V4L2_STD_PAL;
+
return 0;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 03/13] media: tw9910: Align function parameters
2018-02-27 15:40 [PATCH 00/13] media: ov772x/tw9910 cleanup Jacopo Mondi
2018-02-27 15:40 ` [PATCH 01/13] media: tw9910: Fix parameter alignment issue Jacopo Mondi
2018-02-27 15:40 ` [PATCH 02/13] media: tw9910: Empty line before end-of-function return Jacopo Mondi
@ 2018-02-27 15:40 ` Jacopo Mondi
2018-02-27 15:40 ` [PATCH 04/13] media: tw9910: Re-order variables declaration Jacopo Mondi
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jacopo Mondi @ 2018-02-27 15:40 UTC (permalink / raw)
To: mchehab, laurent.pinchart, hans.verkuil, g.liakhovetski, bhumirks
Cc: Jacopo Mondi, linux-media
Align all function parameters to first open brace when declaring
functions.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
drivers/media/i2c/tw9910.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c
index 3e4b530..45afdb9 100644
--- a/drivers/media/i2c/tw9910.c
+++ b/drivers/media/i2c/tw9910.c
@@ -733,7 +733,7 @@ static int tw9910_set_frame(struct v4l2_subdev *sd, u32 *width, u32 *height)
static int tw9910_get_selection(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
- struct v4l2_subdev_selection *sel)
+ struct v4l2_subdev_selection *sel)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct tw9910_priv *priv = to_tw9910(client);
@@ -759,7 +759,7 @@ static int tw9910_get_selection(struct v4l2_subdev *sd,
static int tw9910_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
- struct v4l2_subdev_format *format)
+ struct v4l2_subdev_format *format)
{
struct v4l2_mbus_framefmt *mf = &format->format;
struct i2c_client *client = v4l2_get_subdevdata(sd);
@@ -811,7 +811,7 @@ static int tw9910_s_fmt(struct v4l2_subdev *sd,
static int tw9910_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
- struct v4l2_subdev_format *format)
+ struct v4l2_subdev_format *format)
{
struct v4l2_mbus_framefmt *mf = &format->format;
struct i2c_client *client = v4l2_get_subdevdata(sd);
@@ -904,7 +904,7 @@ static const struct v4l2_subdev_core_ops tw9910_subdev_core_ops = {
static int tw9910_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
- struct v4l2_subdev_mbus_code_enum *code)
+ struct v4l2_subdev_mbus_code_enum *code)
{
if (code->pad || code->index)
return -EINVAL;
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 04/13] media: tw9910: Re-order variables declaration
2018-02-27 15:40 [PATCH 00/13] media: ov772x/tw9910 cleanup Jacopo Mondi
` (2 preceding siblings ...)
2018-02-27 15:40 ` [PATCH 03/13] media: tw9910: Align function parameters Jacopo Mondi
@ 2018-02-27 15:40 ` Jacopo Mondi
2018-02-27 15:40 ` [PATCH 05/13] media: tw9910: Re-organize in-code comments Jacopo Mondi
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jacopo Mondi @ 2018-02-27 15:40 UTC (permalink / raw)
To: mchehab, laurent.pinchart, hans.verkuil, g.liakhovetski, bhumirks
Cc: Jacopo Mondi, linux-media
Re-order variables declaration to respect 'reverse christmas tree'
ordering whenever possible.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
drivers/media/i2c/tw9910.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c
index 45afdb9..f88cc93 100644
--- a/drivers/media/i2c/tw9910.c
+++ b/drivers/media/i2c/tw9910.c
@@ -406,9 +406,9 @@ static void tw9910_reset(struct i2c_client *client)
static int tw9910_power(struct i2c_client *client, int enable)
{
- int ret;
u8 acntl1;
u8 acntl2;
+ int ret;
if (enable) {
acntl1 = 0;
@@ -428,8 +428,8 @@ static int tw9910_power(struct i2c_client *client, int enable)
static const struct tw9910_scale_ctrl *tw9910_select_norm(v4l2_std_id norm,
u32 width, u32 height)
{
- const struct tw9910_scale_ctrl *scale;
const struct tw9910_scale_ctrl *ret = NULL;
+ const struct tw9910_scale_ctrl *scale;
__u32 diff = 0xffffffff, tmp;
int size, i;
@@ -462,8 +462,8 @@ static int tw9910_s_stream(struct v4l2_subdev *sd, int enable)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct tw9910_priv *priv = to_tw9910(client);
- u8 val;
int ret;
+ u8 val;
if (!enable) {
switch (priv->revision) {
@@ -512,10 +512,10 @@ static int tw9910_s_std(struct v4l2_subdev *sd, v4l2_std_id norm)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct tw9910_priv *priv = to_tw9910(client);
- const unsigned int hact = 720;
const unsigned int hdelay = 15;
- unsigned int vact;
+ const unsigned int hact = 720;
unsigned int vdelay;
+ unsigned int vact;
int ret;
if (!(norm & (V4L2_STD_NTSC | V4L2_STD_PAL)))
@@ -761,8 +761,8 @@ static int tw9910_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *format)
{
- struct v4l2_mbus_framefmt *mf = &format->format;
struct i2c_client *client = v4l2_get_subdevdata(sd);
+ struct v4l2_mbus_framefmt *mf = &format->format;
struct tw9910_priv *priv = to_tw9910(client);
if (format->pad)
@@ -813,8 +813,8 @@ static int tw9910_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *format)
{
- struct v4l2_mbus_framefmt *mf = &format->format;
struct i2c_client *client = v4l2_get_subdevdata(sd);
+ struct v4l2_mbus_framefmt *mf = &format->format;
struct tw9910_priv *priv = to_tw9910(client);
const struct tw9910_scale_ctrl *scale;
@@ -851,8 +851,8 @@ static int tw9910_set_fmt(struct v4l2_subdev *sd,
static int tw9910_video_probe(struct i2c_client *client)
{
struct tw9910_priv *priv = to_tw9910(client);
- s32 id;
int ret;
+ s32 id;
/*
* tw9910 only use 8 or 16 bit bus width
@@ -949,10 +949,9 @@ static int tw9910_probe(struct i2c_client *client,
const struct i2c_device_id *did)
{
- struct tw9910_priv *priv;
- struct tw9910_video_info *info;
- struct i2c_adapter *adapter =
- to_i2c_adapter(client->dev.parent);
+ struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
+ struct tw9910_video_info *info;
+ struct tw9910_priv *priv;
int ret;
if (!client->dev.platform_data) {
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 05/13] media: tw9910: Re-organize in-code comments
2018-02-27 15:40 [PATCH 00/13] media: ov772x/tw9910 cleanup Jacopo Mondi
` (3 preceding siblings ...)
2018-02-27 15:40 ` [PATCH 04/13] media: tw9910: Re-order variables declaration Jacopo Mondi
@ 2018-02-27 15:40 ` Jacopo Mondi
2018-02-27 15:40 ` [PATCH 06/13] media: tw9910: Mixed style fixes Jacopo Mondi
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jacopo Mondi @ 2018-02-27 15:40 UTC (permalink / raw)
To: mchehab, laurent.pinchart, hans.verkuil, g.liakhovetski, bhumirks
Cc: Jacopo Mondi, linux-media
A lot of comments that would fit a single line were spread on two or
more lines. Also fix capitalization and punctuation where appropriate.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
drivers/media/i2c/tw9910.c | 44 +++++++++++++-------------------------------
1 file changed, 13 insertions(+), 31 deletions(-)
diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c
index f88cc93..f082f6d 100644
--- a/drivers/media/i2c/tw9910.c
+++ b/drivers/media/i2c/tw9910.c
@@ -388,7 +388,7 @@ static int tw9910_set_hsync(struct i2c_client *client)
if (ret < 0)
return ret;
- /* So far only revisions 0 and 1 have been seen */
+ /* So far only revisions 0 and 1 have been seen. */
/* bit 2 - 0 */
if (priv->revision == 1)
ret = tw9910_mask_set(client, HSLOWCTL, 0x77,
@@ -653,21 +653,15 @@ static int tw9910_set_frame(struct v4l2_subdev *sd, u32 *width, u32 *height)
int ret = -EINVAL;
u8 val;
- /*
- * select suitable norm
- */
+ /* Select suitable norm. */
priv->scale = tw9910_select_norm(priv->norm, *width, *height);
if (!priv->scale)
goto tw9910_set_fmt_error;
- /*
- * reset hardware
- */
+ /* Reset hardware. */
tw9910_reset(client);
- /*
- * set bus width
- */
+ /* Set bus width. */
val = 0x00;
if (priv->info->buswidth == 16)
val = LEN;
@@ -676,9 +670,7 @@ static int tw9910_set_frame(struct v4l2_subdev *sd, u32 *width, u32 *height)
if (ret < 0)
goto tw9910_set_fmt_error;
- /*
- * select MPOUT behavior
- */
+ /* Select MPOUT behavior. */
switch (priv->info->mpout) {
case TW9910_MPO_VLOSS:
val = RTSEL_VLOSS; break;
@@ -704,16 +696,12 @@ static int tw9910_set_frame(struct v4l2_subdev *sd, u32 *width, u32 *height)
if (ret < 0)
goto tw9910_set_fmt_error;
- /*
- * set scale
- */
+ /* Set scale. */
ret = tw9910_set_scale(client, priv->scale);
if (ret < 0)
goto tw9910_set_fmt_error;
- /*
- * set hsync
- */
+ /* Set hsync. */
ret = tw9910_set_hsync(client);
if (ret < 0)
goto tw9910_set_fmt_error;
@@ -740,7 +728,7 @@ static int tw9910_get_selection(struct v4l2_subdev *sd,
if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE)
return -EINVAL;
- /* Only CROP, CROP_DEFAULT and CROP_BOUNDS are supported */
+ /* Only CROP, CROP_DEFAULT and CROP_BOUNDS are supported. */
if (sel->target > V4L2_SEL_TGT_CROP_BOUNDS)
return -EINVAL;
@@ -792,9 +780,7 @@ static int tw9910_s_fmt(struct v4l2_subdev *sd,
WARN_ON(mf->field != V4L2_FIELD_ANY &&
mf->field != V4L2_FIELD_INTERLACED_BT);
- /*
- * check color format
- */
+ /* Check color format. */
if (mf->code != MEDIA_BUS_FMT_UYVY8_2X8)
return -EINVAL;
@@ -831,9 +817,7 @@ static int tw9910_set_fmt(struct v4l2_subdev *sd,
mf->code = MEDIA_BUS_FMT_UYVY8_2X8;
mf->colorspace = V4L2_COLORSPACE_SMPTE170M;
- /*
- * select suitable norm
- */
+ /* Select suitable norm. */
scale = tw9910_select_norm(priv->norm, mf->width, mf->height);
if (!scale)
return -EINVAL;
@@ -854,9 +838,7 @@ static int tw9910_video_probe(struct i2c_client *client)
int ret;
s32 id;
- /*
- * tw9910 only use 8 or 16 bit bus width
- */
+ /* TW9910 only use 8 or 16 bit bus width. */
if (priv->info->buswidth != 16 && priv->info->buswidth != 8) {
dev_err(&client->dev, "bus width error\n");
return -ENODEV;
@@ -867,8 +849,8 @@ static int tw9910_video_probe(struct i2c_client *client)
return ret;
/*
- * check and show Product ID
- * So far only revisions 0 and 1 have been seen
+ * Check and show Product ID.
+ * So far only revisions 0 and 1 have been seen.
*/
id = i2c_smbus_read_byte_data(client, ID);
priv->revision = GET_REV(id);
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 06/13] media: tw9910: Mixed style fixes
2018-02-27 15:40 [PATCH 00/13] media: ov772x/tw9910 cleanup Jacopo Mondi
` (4 preceding siblings ...)
2018-02-27 15:40 ` [PATCH 05/13] media: tw9910: Re-organize in-code comments Jacopo Mondi
@ 2018-02-27 15:40 ` Jacopo Mondi
2018-02-27 15:40 ` [PATCH 07/13] media: tw9910: Sort includes alphabetically Jacopo Mondi
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jacopo Mondi @ 2018-02-27 15:40 UTC (permalink / raw)
To: mchehab, laurent.pinchart, hans.verkuil, g.liakhovetski, bhumirks
Cc: Jacopo Mondi, linux-media
Two minor style fixes, align function parameter and remove un-necessary
spaces.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
drivers/media/i2c/tw9910.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c
index f082f6d..f9b75c1 100644
--- a/drivers/media/i2c/tw9910.c
+++ b/drivers/media/i2c/tw9910.c
@@ -445,7 +445,7 @@ static const struct tw9910_scale_ctrl *tw9910_select_norm(v4l2_std_id norm,
for (i = 0; i < size; i++) {
tmp = abs(width - scale[i].width) +
- abs(height - scale[i].height);
+ abs(height - scale[i].height);
if (tmp < diff) {
diff = tmp;
ret = scale + i;
@@ -953,7 +953,7 @@ static int tw9910_probe(struct i2c_client *client,
if (!priv)
return -ENOMEM;
- priv->info = info;
+ priv->info = info;
v4l2_i2c_subdev_init(&priv->subdev, client, &tw9910_subdev_ops);
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 07/13] media: tw9910: Sort includes alphabetically
2018-02-27 15:40 [PATCH 00/13] media: ov772x/tw9910 cleanup Jacopo Mondi
` (5 preceding siblings ...)
2018-02-27 15:40 ` [PATCH 06/13] media: tw9910: Mixed style fixes Jacopo Mondi
@ 2018-02-27 15:40 ` Jacopo Mondi
2018-02-27 15:40 ` [PATCH 08/13] media: tw9910: Replace msleep(1) with usleep_range Jacopo Mondi
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jacopo Mondi @ 2018-02-27 15:40 UTC (permalink / raw)
To: mchehab, laurent.pinchart, hans.verkuil, g.liakhovetski, bhumirks
Cc: Jacopo Mondi, linux-media
Sort include directives alphabetically to ease maintenance.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
drivers/media/i2c/tw9910.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c
index f9b75c1..1043f7d 100644
--- a/drivers/media/i2c/tw9910.c
+++ b/drivers/media/i2c/tw9910.c
@@ -16,13 +16,13 @@
*/
#include <linux/clk.h>
+#include <linux/delay.h>
#include <linux/gpio/consumer.h>
+#include <linux/i2c.h>
#include <linux/init.h>
+#include <linux/kernel.h>
#include <linux/module.h>
-#include <linux/i2c.h>
#include <linux/slab.h>
-#include <linux/kernel.h>
-#include <linux/delay.h>
#include <linux/v4l2-mediabus.h>
#include <linux/videodev2.h>
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 08/13] media: tw9910: Replace msleep(1) with usleep_range
2018-02-27 15:40 [PATCH 00/13] media: ov772x/tw9910 cleanup Jacopo Mondi
` (6 preceding siblings ...)
2018-02-27 15:40 ` [PATCH 07/13] media: tw9910: Sort includes alphabetically Jacopo Mondi
@ 2018-02-27 15:40 ` Jacopo Mondi
2018-02-27 15:40 ` [PATCH 09/13] media: ov772x: Align function parameters Jacopo Mondi
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jacopo Mondi @ 2018-02-27 15:40 UTC (permalink / raw)
To: mchehab, laurent.pinchart, hans.verkuil, g.liakhovetski, bhumirks
Cc: Jacopo Mondi, linux-media
msleep() can sleep up to 20ms.
As suggested by Documentation/timers/timers_howto.txt replace it with
usleep_range() with up to 5ms delay.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
drivers/media/i2c/tw9910.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c
index 1043f7d..920877a 100644
--- a/drivers/media/i2c/tw9910.c
+++ b/drivers/media/i2c/tw9910.c
@@ -401,7 +401,7 @@ static int tw9910_set_hsync(struct i2c_client *client)
static void tw9910_reset(struct i2c_client *client)
{
tw9910_mask_set(client, ACNTL1, SRESET, SRESET);
- msleep(1);
+ usleep_range(1000, 5000);
}
static int tw9910_power(struct i2c_client *client, int enable)
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 09/13] media: ov772x: Align function parameters
2018-02-27 15:40 [PATCH 00/13] media: ov772x/tw9910 cleanup Jacopo Mondi
` (7 preceding siblings ...)
2018-02-27 15:40 ` [PATCH 08/13] media: tw9910: Replace msleep(1) with usleep_range Jacopo Mondi
@ 2018-02-27 15:40 ` Jacopo Mondi
2018-02-27 15:40 ` [PATCH 10/13] media: ov772x: Re-organize in-code comments Jacopo Mondi
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jacopo Mondi @ 2018-02-27 15:40 UTC (permalink / raw)
To: mchehab, laurent.pinchart, hans.verkuil, g.liakhovetski, bhumirks
Cc: Jacopo Mondi, linux-media
Align all function parameters to first open brace when declaring
functions.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
drivers/media/i2c/ov772x.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c
index 16665af..a418455 100644
--- a/drivers/media/i2c/ov772x.c
+++ b/drivers/media/i2c/ov772x.c
@@ -1064,7 +1064,7 @@ static int ov772x_set_params(struct ov772x_priv *priv,
static int ov772x_get_selection(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
- struct v4l2_subdev_selection *sel)
+ struct v4l2_subdev_selection *sel)
{
struct ov772x_priv *priv = to_ov772x(sd);
@@ -1087,7 +1087,7 @@ static int ov772x_get_selection(struct v4l2_subdev *sd,
static int ov772x_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
- struct v4l2_subdev_format *format)
+ struct v4l2_subdev_format *format)
{
struct v4l2_mbus_framefmt *mf = &format->format;
struct ov772x_priv *priv = to_ov772x(sd);
@@ -1106,7 +1106,7 @@ static int ov772x_get_fmt(struct v4l2_subdev *sd,
static int ov772x_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
- struct v4l2_subdev_format *format)
+ struct v4l2_subdev_format *format)
{
struct ov772x_priv *priv = to_ov772x(sd);
struct v4l2_mbus_framefmt *mf = &format->format;
@@ -1219,7 +1219,7 @@ static int ov772x_enum_frame_interval(struct v4l2_subdev *sd,
static int ov772x_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
- struct v4l2_subdev_mbus_code_enum *code)
+ struct v4l2_subdev_mbus_code_enum *code)
{
if (code->pad || code->index >= ARRAY_SIZE(ov772x_cfmts))
return -EINVAL;
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 10/13] media: ov772x: Re-organize in-code comments
2018-02-27 15:40 [PATCH 00/13] media: ov772x/tw9910 cleanup Jacopo Mondi
` (8 preceding siblings ...)
2018-02-27 15:40 ` [PATCH 09/13] media: ov772x: Align function parameters Jacopo Mondi
@ 2018-02-27 15:40 ` Jacopo Mondi
2018-02-27 15:40 ` [PATCH 11/13] media: ov772x: Empty line before end-of-function return Jacopo Mondi
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Jacopo Mondi @ 2018-02-27 15:40 UTC (permalink / raw)
To: mchehab, laurent.pinchart, hans.verkuil, g.liakhovetski, bhumirks
Cc: Jacopo Mondi, linux-media
A lot of comments that would fit a single line were spread on two or
more lines. Also fix capitalization and punctuation where appropriate.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
drivers/media/i2c/ov772x.c | 32 ++++++++++----------------------
1 file changed, 10 insertions(+), 22 deletions(-)
diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c
index a418455..8849da1 100644
--- a/drivers/media/i2c/ov772x.c
+++ b/drivers/media/i2c/ov772x.c
@@ -910,17 +910,13 @@ static int ov772x_set_params(struct ov772x_priv *priv,
int ret;
u8 val;
- /*
- * reset hardware
- */
+ /* Reset hardware. */
ov772x_reset(client);
- /*
- * Edge Ctrl
- */
+ /* Edge Ctrl. */
if (priv->info->edgectrl.strength & OV772X_MANUAL_EDGE_CTRL) {
/*
- * Manual Edge Control Mode
+ * Manual Edge Control Mode.
*
* Edge auto strength bit is set by default.
* Remove it when manual mode.
@@ -944,9 +940,9 @@ static int ov772x_set_params(struct ov772x_priv *priv,
} else if (priv->info->edgectrl.upper > priv->info->edgectrl.lower) {
/*
- * Auto Edge Control Mode
+ * Auto Edge Control Mode.
*
- * set upper and lower limit
+ * Set upper and lower limit.
*/
ret = ov772x_mask_set(client,
EDGE_UPPER, OV772X_EDGE_UPPER_MASK,
@@ -961,7 +957,7 @@ static int ov772x_set_params(struct ov772x_priv *priv,
goto ov772x_set_fmt_error;
}
- /* Format and window size */
+ /* Format and window size. */
ret = ov772x_write(client, HSTART, win->rect.left >> 2);
if (ret < 0)
goto ov772x_set_fmt_error;
@@ -993,9 +989,7 @@ static int ov772x_set_params(struct ov772x_priv *priv,
if (ret < 0)
goto ov772x_set_fmt_error;
- /*
- * set DSP_CTRL3
- */
+ /* Set DSP_CTRL3. */
val = cfmt->dsp3;
if (val) {
ret = ov772x_mask_set(client,
@@ -1011,9 +1005,7 @@ static int ov772x_set_params(struct ov772x_priv *priv,
goto ov772x_set_fmt_error;
}
- /*
- * set COM3
- */
+ /* Set COM3. */
val = cfmt->com3;
if (priv->info->flags & OV772X_FLAG_VFLIP)
val |= VFLIP_IMG;
@@ -1041,9 +1033,7 @@ static int ov772x_set_params(struct ov772x_priv *priv,
if (ret < 0)
goto ov772x_set_fmt_error;
- /*
- * set COM8
- */
+ /* Set COM8. */
if (priv->band_filter) {
ret = ov772x_mask_set(client, COM8, BNDF_ON_OFF, 1);
if (!ret)
@@ -1153,9 +1143,7 @@ static int ov772x_video_probe(struct ov772x_priv *priv)
if (ret < 0)
return ret;
- /*
- * check and show product ID and manufacturer ID
- */
+ /* Check and show product ID and manufacturer ID. */
pid = ov772x_read(client, PID);
ver = ov772x_read(client, VER);
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 11/13] media: ov772x: Empty line before end-of-function return
2018-02-27 15:40 [PATCH 00/13] media: ov772x/tw9910 cleanup Jacopo Mondi
` (9 preceding siblings ...)
2018-02-27 15:40 ` [PATCH 10/13] media: ov772x: Re-organize in-code comments Jacopo Mondi
@ 2018-02-27 15:40 ` Jacopo Mondi
2018-02-27 15:40 ` [PATCH 12/13] media: ov772x: Re-order variables declaration Jacopo Mondi
2018-02-27 15:40 ` [PATCH 13/13] media: ov772x: Replace msleep(1) with usleep_range Jacopo Mondi
12 siblings, 0 replies; 14+ messages in thread
From: Jacopo Mondi @ 2018-02-27 15:40 UTC (permalink / raw)
To: mchehab, laurent.pinchart, hans.verkuil, g.liakhovetski, bhumirks
Cc: Jacopo Mondi, linux-media
Add an empty line before return at the end of functions.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
drivers/media/i2c/ov772x.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c
index 8849da1..4f464ac 100644
--- a/drivers/media/i2c/ov772x.c
+++ b/drivers/media/i2c/ov772x.c
@@ -1129,6 +1129,7 @@ static int ov772x_set_fmt(struct v4l2_subdev *sd,
priv->win = win;
priv->cfmt = cfmt;
+
return 0;
}
@@ -1172,6 +1173,7 @@ static int ov772x_video_probe(struct ov772x_priv *priv)
done:
ov772x_s_power(&priv->subdev, 0);
+
return ret;
}
@@ -1213,6 +1215,7 @@ static int ov772x_enum_mbus_code(struct v4l2_subdev *sd,
return -EINVAL;
code->code = ov772x_cfmts[code->index].code;
+
return 0;
}
@@ -1327,6 +1330,7 @@ static int ov772x_remove(struct i2c_client *client)
gpiod_put(priv->pwdn_gpio);
v4l2_device_unregister_subdev(&priv->subdev);
v4l2_ctrl_handler_free(&priv->hdl);
+
return 0;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 12/13] media: ov772x: Re-order variables declaration
2018-02-27 15:40 [PATCH 00/13] media: ov772x/tw9910 cleanup Jacopo Mondi
` (10 preceding siblings ...)
2018-02-27 15:40 ` [PATCH 11/13] media: ov772x: Empty line before end-of-function return Jacopo Mondi
@ 2018-02-27 15:40 ` Jacopo Mondi
2018-02-27 15:40 ` [PATCH 13/13] media: ov772x: Replace msleep(1) with usleep_range Jacopo Mondi
12 siblings, 0 replies; 14+ messages in thread
From: Jacopo Mondi @ 2018-02-27 15:40 UTC (permalink / raw)
To: mchehab, laurent.pinchart, hans.verkuil, g.liakhovetski, bhumirks
Cc: Jacopo Mondi, linux-media
Re-order variables declaration to respect 'reverse christmas tree'
ordering whenever possible.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
drivers/media/i2c/ov772x.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c
index 4f464ac..1fd6d4b 100644
--- a/drivers/media/i2c/ov772x.c
+++ b/drivers/media/i2c/ov772x.c
@@ -1098,8 +1098,8 @@ static int ov772x_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *format)
{
- struct ov772x_priv *priv = to_ov772x(sd);
struct v4l2_mbus_framefmt *mf = &format->format;
+ struct ov772x_priv *priv = to_ov772x(sd);
const struct ov772x_color_format *cfmt;
const struct ov772x_win_size *win;
int ret;
@@ -1135,10 +1135,11 @@ static int ov772x_set_fmt(struct v4l2_subdev *sd,
static int ov772x_video_probe(struct ov772x_priv *priv)
{
- struct i2c_client *client = v4l2_get_subdevdata(&priv->subdev);
- u8 pid, ver;
- const char *devname;
- int ret;
+ struct i2c_client *client = v4l2_get_subdevdata(&priv->subdev);
+ const char *devname;
+ int ret;
+ u8 pid;
+ u8 ver;
ret = ov772x_s_power(&priv->subdev, 1);
if (ret < 0)
@@ -1246,9 +1247,9 @@ static const struct v4l2_subdev_ops ov772x_subdev_ops = {
static int ov772x_probe(struct i2c_client *client,
const struct i2c_device_id *did)
{
- struct ov772x_priv *priv;
- struct i2c_adapter *adapter = client->adapter;
- int ret;
+ struct i2c_adapter *adapter = client->adapter;
+ struct ov772x_priv *priv;
+ int ret;
if (!client->dev.platform_data) {
dev_err(&client->dev, "Missing ov772x platform data\n");
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 13/13] media: ov772x: Replace msleep(1) with usleep_range
2018-02-27 15:40 [PATCH 00/13] media: ov772x/tw9910 cleanup Jacopo Mondi
` (11 preceding siblings ...)
2018-02-27 15:40 ` [PATCH 12/13] media: ov772x: Re-order variables declaration Jacopo Mondi
@ 2018-02-27 15:40 ` Jacopo Mondi
12 siblings, 0 replies; 14+ messages in thread
From: Jacopo Mondi @ 2018-02-27 15:40 UTC (permalink / raw)
To: mchehab, laurent.pinchart, hans.verkuil, g.liakhovetski, bhumirks
Cc: Jacopo Mondi, linux-media
msleep() can sleep up to 20ms.
As suggested by Documentation/timers/timers_howto.txt replace it with
usleep_range() with up to 5ms delay.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
drivers/media/i2c/ov772x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c
index 1fd6d4b..2d5281a 100644
--- a/drivers/media/i2c/ov772x.c
+++ b/drivers/media/i2c/ov772x.c
@@ -574,7 +574,7 @@ static int ov772x_reset(struct i2c_client *client)
if (ret < 0)
return ret;
- msleep(1);
+ usleep_range(1000, 5000);
return ov772x_mask_set(client, COM2, SOFT_SLEEP_MODE, SOFT_SLEEP_MODE);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2018-02-27 15:41 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-27 15:40 [PATCH 00/13] media: ov772x/tw9910 cleanup Jacopo Mondi
2018-02-27 15:40 ` [PATCH 01/13] media: tw9910: Fix parameter alignment issue Jacopo Mondi
2018-02-27 15:40 ` [PATCH 02/13] media: tw9910: Empty line before end-of-function return Jacopo Mondi
2018-02-27 15:40 ` [PATCH 03/13] media: tw9910: Align function parameters Jacopo Mondi
2018-02-27 15:40 ` [PATCH 04/13] media: tw9910: Re-order variables declaration Jacopo Mondi
2018-02-27 15:40 ` [PATCH 05/13] media: tw9910: Re-organize in-code comments Jacopo Mondi
2018-02-27 15:40 ` [PATCH 06/13] media: tw9910: Mixed style fixes Jacopo Mondi
2018-02-27 15:40 ` [PATCH 07/13] media: tw9910: Sort includes alphabetically Jacopo Mondi
2018-02-27 15:40 ` [PATCH 08/13] media: tw9910: Replace msleep(1) with usleep_range Jacopo Mondi
2018-02-27 15:40 ` [PATCH 09/13] media: ov772x: Align function parameters Jacopo Mondi
2018-02-27 15:40 ` [PATCH 10/13] media: ov772x: Re-organize in-code comments Jacopo Mondi
2018-02-27 15:40 ` [PATCH 11/13] media: ov772x: Empty line before end-of-function return Jacopo Mondi
2018-02-27 15:40 ` [PATCH 12/13] media: ov772x: Re-order variables declaration Jacopo Mondi
2018-02-27 15:40 ` [PATCH 13/13] media: ov772x: Replace msleep(1) with usleep_range Jacopo Mondi
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.