Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH 1/2] media: ov772x: fix whitespace issues
@ 2018-02-26 14:28 Mauro Carvalho Chehab
  2018-02-26 14:28 ` [PATCH 2/2] media: tw9910: solve coding style issues Mauro Carvalho Chehab
  0 siblings, 1 reply; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2018-02-26 14:28 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
	Mauro Carvalho Chehab, Jacopo Mondi, Laurent Pinchart,
	Hans Verkuil, Guennadi Liakhovetski, Bhumika Goyal

As we're adding this as a new driver, make checkpatch happier by
solving some whitespace issues, using --fix-inplace.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
---
 drivers/media/i2c/ov772x.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c
index 3edf0cb6fd0e..16665af0c712 100644
--- a/drivers/media/i2c/ov772x.c
+++ b/drivers/media/i2c/ov772x.c
@@ -375,7 +375,7 @@
  */
 #define OV7720  0x7720
 #define OV7725  0x7721
-#define VERSION(pid, ver) ((pid<<8)|(ver&0xFF))
+#define VERSION(pid, ver) ((pid << 8) | (ver & 0xFF))
 
 /*
  * PLL multipliers
@@ -500,7 +500,6 @@ static const struct ov772x_color_format ov772x_cfmts[] = {
 	},
 };
 
-
 /*
  * window size list
  */
@@ -557,6 +556,7 @@ static int ov772x_mask_set(struct i2c_client *client, u8  command, u8  mask,
 			   u8  set)
 {
 	s32 val = ov772x_read(client, command);
+
 	if (val < 0)
 		return val;
 
@@ -919,7 +919,6 @@ static int ov772x_set_params(struct ov772x_priv *priv,
 	 * Edge Ctrl
 	 */
 	if (priv->info->edgectrl.strength & OV772X_MANUAL_EDGE_CTRL) {
-
 		/*
 		 * Manual Edge Control Mode
 		 *
@@ -1064,7 +1063,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_pad_config *cfg,
 		struct v4l2_subdev_selection *sel)
 {
 	struct ov772x_priv *priv = to_ov772x(sd);
@@ -1087,7 +1086,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_pad_config *cfg,
 		struct v4l2_subdev_format *format)
 {
 	struct v4l2_mbus_framefmt *mf = &format->format;
@@ -1106,7 +1105,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_pad_config *cfg,
 		struct v4l2_subdev_format *format)
 {
 	struct ov772x_priv *priv = to_ov772x(sd);
@@ -1219,7 +1218,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_pad_config *cfg,
 		struct v4l2_subdev_mbus_code_enum *code)
 {
 	if (code->pad || code->index >= ARRAY_SIZE(ov772x_cfmts))
@@ -1282,11 +1281,11 @@ static int ov772x_probe(struct i2c_client *client,
 	v4l2_i2c_subdev_init(&priv->subdev, client, &ov772x_subdev_ops);
 	v4l2_ctrl_handler_init(&priv->hdl, 3);
 	v4l2_ctrl_new_std(&priv->hdl, &ov772x_ctrl_ops,
-			V4L2_CID_VFLIP, 0, 1, 1, 0);
+			  V4L2_CID_VFLIP, 0, 1, 1, 0);
 	v4l2_ctrl_new_std(&priv->hdl, &ov772x_ctrl_ops,
-			V4L2_CID_HFLIP, 0, 1, 1, 0);
+			  V4L2_CID_HFLIP, 0, 1, 1, 0);
 	v4l2_ctrl_new_std(&priv->hdl, &ov772x_ctrl_ops,
-			V4L2_CID_BAND_STOP_FILTER, 0, 256, 1, 0);
+			  V4L2_CID_BAND_STOP_FILTER, 0, 256, 1, 0);
 	priv->subdev.ctrl_handler = &priv->hdl;
 	if (priv->hdl.error)
 		return priv->hdl.error;
-- 
2.14.3

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

* [PATCH 2/2] media: tw9910: solve coding style issues
  2018-02-26 14:28 [PATCH 1/2] media: ov772x: fix whitespace issues Mauro Carvalho Chehab
@ 2018-02-26 14:28 ` Mauro Carvalho Chehab
  2018-02-27 14:03   ` jacopo mondi
  0 siblings, 1 reply; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2018-02-26 14:28 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
	Mauro Carvalho Chehab, Jacopo Mondi, Laurent Pinchart,
	Hans Verkuil, Guennadi Liakhovetski, Bhumika Goyal

As we're adding this as a new driver, make checkpatch happier by
solving several style issues, using --fix-inplace at strict mode.

Some issues required manual work.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
---
 drivers/media/i2c/tw9910.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c
index 96792df45fb0..cc5d383fc6b8 100644
--- a/drivers/media/i2c/tw9910.c
+++ b/drivers/media/i2c/tw9910.c
@@ -339,6 +339,7 @@ static int tw9910_mask_set(struct i2c_client *client, u8 command,
 			   u8 mask, u8 set)
 {
 	s32 val = i2c_smbus_read_byte_data(client, command);
+
 	if (val < 0)
 		return val;
 
@@ -389,7 +390,7 @@ static int tw9910_set_hsync(struct i2c_client *client)
 
 	/* So far only revisions 0 and 1 have been seen */
 	/* bit 2 - 0 */
-	if (1 == priv->revision)
+	if (priv->revision == 1)
 		ret = tw9910_mask_set(client, HSLOWCTL, 0x77,
 				      (HSYNC_START & 0x0007) << 4 |
 				      (HSYNC_END   & 0x0007));
@@ -511,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 hact = 720;
-	const unsigned hdelay = 15;
-	unsigned vact;
-	unsigned vdelay;
+	const unsigned int hact = 720;
+	const unsigned int hdelay = 15;
+	unsigned int vact;
+	unsigned int vdelay;
 	int ret;
 
 	if (!(norm & (V4L2_STD_NTSC | V4L2_STD_PAL)))
@@ -532,16 +533,16 @@ 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) |
+						((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);
+						vdelay & 0xff);
 	if (!ret)
 		ret = i2c_smbus_write_byte_data(client, VACTIVE_LO,
-			vact & 0xff);
+						vact & 0xff);
 
 	return ret;
 }
@@ -731,7 +732,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_pad_config *cfg,
 		struct v4l2_subdev_selection *sel)
 {
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
@@ -756,7 +757,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_pad_config *cfg,
 		struct v4l2_subdev_format *format)
 {
 	struct v4l2_mbus_framefmt *mf = &format->format;
@@ -807,7 +808,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_pad_config *cfg,
 		struct v4l2_subdev_format *format)
 {
 	struct v4l2_mbus_framefmt *mf = &format->format;
@@ -818,9 +819,9 @@ static int tw9910_set_fmt(struct v4l2_subdev *sd,
 	if (format->pad)
 		return -EINVAL;
 
-	if (V4L2_FIELD_ANY == mf->field) {
+	if (mf->field == V4L2_FIELD_ANY) {
 		mf->field = V4L2_FIELD_INTERLACED_BT;
-	} else if (V4L2_FIELD_INTERLACED_BT != mf->field) {
+	} else if (mf->field != V4L2_FIELD_INTERLACED_BT) {
 		dev_err(&client->dev, "Field type %d invalid.\n", mf->field);
 		return -EINVAL;
 	}
@@ -870,8 +871,7 @@ static int tw9910_video_probe(struct i2c_client *client)
 	priv->revision = GET_REV(id);
 	id = GET_ID(id);
 
-	if (0x0B != id ||
-	    0x01 < priv->revision) {
+	if (id != 0x0b || priv->revision > 0x01) {
 		dev_err(&client->dev,
 			"Product ID error %x:%x\n",
 			id, priv->revision);
@@ -899,7 +899,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_pad_config *cfg,
 		struct v4l2_subdev_mbus_code_enum *code)
 {
 	if (code->pad || code->index)
-- 
2.14.3

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

* Re: [PATCH 2/2] media: tw9910: solve coding style issues
  2018-02-26 14:28 ` [PATCH 2/2] media: tw9910: solve coding style issues Mauro Carvalho Chehab
@ 2018-02-27 14:03   ` jacopo mondi
  0 siblings, 0 replies; 3+ messages in thread
From: jacopo mondi @ 2018-02-27 14:03 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Linux Media Mailing List, Mauro Carvalho Chehab, Jacopo Mondi,
	Laurent Pinchart, Hans Verkuil, Guennadi Liakhovetski,
	Bhumika Goyal

Hi Mauro,
   thanks for doing this.

I didn't dare to touch this driver style issues as it was mainline
already, but since you addressed this I now would have more changes to
apply...

On Mon, Feb 26, 2018 at 09:28:08AM -0500, Mauro Carvalho Chehab wrote:
> As we're adding this as a new driver, make checkpatch happier by
> solving several style issues, using --fix-inplace at strict mode.
>
> Some issues required manual work.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> ---
>  drivers/media/i2c/tw9910.c | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)

[snip]

>
>  	if (!(norm & (V4L2_STD_NTSC | V4L2_STD_PAL)))
> @@ -532,16 +533,16 @@ 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) |
> +						((vdelay >> 2) & 0xc0) |
>  			((vact >> 4) & 0x30) |
>  			((hdelay >> 6) & 0x0c) |
>  			((hact >> 8) & 0x03));

If you move the first line, all the following ones should be be moved
too.

I can send a few patches more on top of this two, to address this and
a few other style issues on this driver.

Would this work for you?

Thanks
  j

>  	if (!ret)
>  		ret = i2c_smbus_write_byte_data(client, VDELAY_LO,
> -			vdelay & 0xff);
> +						vdelay & 0xff);
>  	if (!ret)
>  		ret = i2c_smbus_write_byte_data(client, VACTIVE_LO,
> -			vact & 0xff);
> +						vact & 0xff);
>
>  	return ret;
>  }
> @@ -731,7 +732,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_pad_config *cfg,
>  		struct v4l2_subdev_selection *sel)
>  {
>  	struct i2c_client *client = v4l2_get_subdevdata(sd);
> @@ -756,7 +757,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_pad_config *cfg,
>  		struct v4l2_subdev_format *format)
>  {
>  	struct v4l2_mbus_framefmt *mf = &format->format;
> @@ -807,7 +808,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_pad_config *cfg,
>  		struct v4l2_subdev_format *format)
>  {
>  	struct v4l2_mbus_framefmt *mf = &format->format;
> @@ -818,9 +819,9 @@ static int tw9910_set_fmt(struct v4l2_subdev *sd,
>  	if (format->pad)
>  		return -EINVAL;
>
> -	if (V4L2_FIELD_ANY == mf->field) {
> +	if (mf->field == V4L2_FIELD_ANY) {
>  		mf->field = V4L2_FIELD_INTERLACED_BT;
> -	} else if (V4L2_FIELD_INTERLACED_BT != mf->field) {
> +	} else if (mf->field != V4L2_FIELD_INTERLACED_BT) {
>  		dev_err(&client->dev, "Field type %d invalid.\n", mf->field);
>  		return -EINVAL;
>  	}
> @@ -870,8 +871,7 @@ static int tw9910_video_probe(struct i2c_client *client)
>  	priv->revision = GET_REV(id);
>  	id = GET_ID(id);
>
> -	if (0x0B != id ||
> -	    0x01 < priv->revision) {
> +	if (id != 0x0b || priv->revision > 0x01) {
>  		dev_err(&client->dev,
>  			"Product ID error %x:%x\n",
>  			id, priv->revision);
> @@ -899,7 +899,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_pad_config *cfg,
>  		struct v4l2_subdev_mbus_code_enum *code)
>  {
>  	if (code->pad || code->index)
> --
> 2.14.3
>

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

end of thread, other threads:[~2018-02-27 14:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-26 14:28 [PATCH 1/2] media: ov772x: fix whitespace issues Mauro Carvalho Chehab
2018-02-26 14:28 ` [PATCH 2/2] media: tw9910: solve coding style issues Mauro Carvalho Chehab
2018-02-27 14:03   ` jacopo mondi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox