Skip to contentSkip to conversation

Fixing Coding Style Errors & Warning

PATCH New [email protected] 3 participants 9 messages Mar 27, 2017 – Mar 29, 2017 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [PATCH 1/1] Correcting coding style errors & warnings

#1 lore raw

PATCH 1/1 Fixing Coding Style Errors & Warning

From: Vaibhav Kothari <[email protected]>

- Removed white-space before comma in memset()
- Added blanck line between declaration and defination at various places

---
 drivers/staging/media/atomisp/i2c/gc2235.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/staging/media/atomisp/i2c/gc2235.c +11 -5
index 9b41023..0df20ba 100644
@@ -55,7 +55,7 @@ static int gc2235_read_reg(struct i2c_client *client,
 		return -EINVAL;
 	}
 
-	memset(msg, 0 , sizeof(msg));
+	memset(msg, 0, sizeof(msg));
 
 	msg[0].addr = client->addr;
 	msg[0].flags = 0;
@@ -354,6 +354,7 @@ static long __gc2235_set_exposure(struct v4l2_subdev *sd, int coarse_itg,
 	u16 coarse_integration = (u16)coarse_itg;
 	int ret = 0;
 	u16 expo_coarse_h, expo_coarse_l, gain_val = 0xF0, gain_val2 = 0xF0;
+
 	expo_coarse_h = coarse_integration >> 8;
 	expo_coarse_l = coarse_integration & 0xff;
 
@@ -405,6 +406,7 @@ static long gc2235_s_exposure(struct v4l2_subdev *sd,
 	/* we should not accept the invalid value below. */
 	if (gain == 0) {
 		struct i2c_client *client = v4l2_get_subdevdata(sd);
+
 		v4l2_err(client, "%s: invalid value\n", __func__);
 		return -EINVAL;
 	}
@@ -746,12 +748,13 @@ static int startup(struct v4l2_subdev *sd)
 	struct gc2235_device *dev = to_gc2235_sensor(sd);
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
 	int ret = 0;
+
 	if (is_init == 0) {
 		/* force gc2235 to do a reset in res change, otherwise it
-		* can not output normal after switching res. and it is not
-		* necessary for first time run up after power on, for the sack
-		* of performance
-		*/
+		 * can not output normal after switching res. and it is not
+		 * necessary for first time run up after power on, for the sack
+		 * of performance
+		 */
 		power_down(sd);
 		power_up(sd);
 		gc2235_write_reg_array(client, gc2235_init_settings);
@@ -880,6 +883,7 @@ static int gc2235_s_stream(struct v4l2_subdev *sd, int enable)
 	struct gc2235_device *dev = to_gc2235_sensor(sd);
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
 	int ret;
+
 	mutex_lock(&dev->input_lock);
 
 	if (enable)
@@ -994,6 +998,7 @@ static int gc2235_s_parm(struct v4l2_subdev *sd,
 			struct v4l2_streamparm *param)
 {
 	struct gc2235_device *dev = to_gc2235_sensor(sd);
+
 	dev->run_mode = param->parm.capture.capturemode;
 
 	mutex_lock(&dev->input_lock);
@@ -1099,6 +1104,7 @@ static int gc2235_remove(struct i2c_client *client)
 {
 	struct v4l2_subdev *sd = i2c_get_clientdata(client);
 	struct gc2235_device *dev = to_gc2235_sensor(sd);
+
 	dev_dbg(&client->dev, "gc2235_remove...\n");
 
 	if (dev->platform_data->platform_deinit)
Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/1 Fixing up check-patch error & Warnings

From: Vaibhav Kothari <[email protected]>

- Removed white-space before comma in memset()
- Added blank line between declaration and defination at various places

---
 drivers/staging/media/atomisp/i2c/gc2235.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/staging/media/atomisp/i2c/gc2235.c +11 -5
index 9b41023..0df20ba 100644
@@ -55,7 +55,7 @@ static int gc2235_read_reg(struct i2c_client *client,
 		return -EINVAL;
 	}
 
-	memset(msg, 0 , sizeof(msg));
+	memset(msg, 0, sizeof(msg));
 
 	msg[0].addr = client->addr;
 	msg[0].flags = 0;
@@ -354,6 +354,7 @@ static long __gc2235_set_exposure(struct v4l2_subdev *sd, int coarse_itg,
 	u16 coarse_integration = (u16)coarse_itg;
 	int ret = 0;
 	u16 expo_coarse_h, expo_coarse_l, gain_val = 0xF0, gain_val2 = 0xF0;
+
 	expo_coarse_h = coarse_integration >> 8;
 	expo_coarse_l = coarse_integration & 0xff;
 
@@ -405,6 +406,7 @@ static long gc2235_s_exposure(struct v4l2_subdev *sd,
 	/* we should not accept the invalid value below. */
 	if (gain == 0) {
 		struct i2c_client *client = v4l2_get_subdevdata(sd);
+
 		v4l2_err(client, "%s: invalid value\n", __func__);
 		return -EINVAL;
 	}
@@ -746,12 +748,13 @@ static int startup(struct v4l2_subdev *sd)
 	struct gc2235_device *dev = to_gc2235_sensor(sd);
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
 	int ret = 0;
+
 	if (is_init == 0) {
 		/* force gc2235 to do a reset in res change, otherwise it
-		* can not output normal after switching res. and it is not
-		* necessary for first time run up after power on, for the sack
-		* of performance
-		*/
+		 * can not output normal after switching res. and it is not
+		 * necessary for first time run up after power on, for the sack
+		 * of performance
+		 */
 		power_down(sd);
 		power_up(sd);
 		gc2235_write_reg_array(client, gc2235_init_settings);
@@ -880,6 +883,7 @@ static int gc2235_s_stream(struct v4l2_subdev *sd, int enable)
 	struct gc2235_device *dev = to_gc2235_sensor(sd);
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
 	int ret;
+
 	mutex_lock(&dev->input_lock);
 
 	if (enable)
@@ -994,6 +998,7 @@ static int gc2235_s_parm(struct v4l2_subdev *sd,
 			struct v4l2_streamparm *param)
 {
 	struct gc2235_device *dev = to_gc2235_sensor(sd);
+
 	dev->run_mode = param->parm.capture.capturemode;
 
 	mutex_lock(&dev->input_lock);
@@ -1099,6 +1104,7 @@ static int gc2235_remove(struct i2c_client *client)
 {
 	struct v4l2_subdev *sd = i2c_get_clientdata(client);
 	struct gc2235_device *dev = to_gc2235_sensor(sd);
+
 	dev_dbg(&client->dev, "gc2235_remove...\n");
 
 	if (dev->platform_data->platform_deinit)
Signature · 1 line
1.9.1
#3 lore raw

PATCH 1/1 staging:media:atomisp:i2c removed unnecessary white space before comma in memset()

In reply to [email protected]

From: Vaibhav Kothari <[email protected]>

- Fixing up check-patch error & Warnings
- Added blank line between declaration and defination at various places

---
 drivers/staging/media/atomisp/i2c/gc2235.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/staging/media/atomisp/i2c/gc2235.c +11 -5
index 9b41023..0df20ba 100644
@@ -55,7 +55,7 @@ static int gc2235_read_reg(struct i2c_client *client,
 		return -EINVAL;
 	}
 
-	memset(msg, 0 , sizeof(msg));
+	memset(msg, 0, sizeof(msg));
 
 	msg[0].addr = client->addr;
 	msg[0].flags = 0;
@@ -354,6 +354,7 @@ static long __gc2235_set_exposure(struct v4l2_subdev *sd, int coarse_itg,
 	u16 coarse_integration = (u16)coarse_itg;
 	int ret = 0;
 	u16 expo_coarse_h, expo_coarse_l, gain_val = 0xF0, gain_val2 = 0xF0;
+
 	expo_coarse_h = coarse_integration >> 8;
 	expo_coarse_l = coarse_integration & 0xff;
 
@@ -405,6 +406,7 @@ static long gc2235_s_exposure(struct v4l2_subdev *sd,
 	/* we should not accept the invalid value below. */
 	if (gain == 0) {
 		struct i2c_client *client = v4l2_get_subdevdata(sd);
+
 		v4l2_err(client, "%s: invalid value\n", __func__);
 		return -EINVAL;
 	}
@@ -746,12 +748,13 @@ static int startup(struct v4l2_subdev *sd)
 	struct gc2235_device *dev = to_gc2235_sensor(sd);
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
 	int ret = 0;
+
 	if (is_init == 0) {
 		/* force gc2235 to do a reset in res change, otherwise it
-		* can not output normal after switching res. and it is not
-		* necessary for first time run up after power on, for the sack
-		* of performance
-		*/
+		 * can not output normal after switching res. and it is not
+		 * necessary for first time run up after power on, for the sack
+		 * of performance
+		 */
 		power_down(sd);
 		power_up(sd);
 		gc2235_write_reg_array(client, gc2235_init_settings);
@@ -880,6 +883,7 @@ static int gc2235_s_stream(struct v4l2_subdev *sd, int enable)
 	struct gc2235_device *dev = to_gc2235_sensor(sd);
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
 	int ret;
+
 	mutex_lock(&dev->input_lock);
 
 	if (enable)
@@ -994,6 +998,7 @@ static int gc2235_s_parm(struct v4l2_subdev *sd,
 			struct v4l2_streamparm *param)
 {
 	struct gc2235_device *dev = to_gc2235_sensor(sd);
+
 	dev->run_mode = param->parm.capture.capturemode;
 
 	mutex_lock(&dev->input_lock);
@@ -1099,6 +1104,7 @@ static int gc2235_remove(struct i2c_client *client)
 {
 	struct v4l2_subdev *sd = i2c_get_clientdata(client);
 	struct gc2235_device *dev = to_gc2235_sensor(sd);
+
 	dev_dbg(&client->dev, "gc2235_remove...\n");
 
 	if (dev->platform_data->platform_deinit)
Signature · 1 line
1.9.1
#4 lore raw

Re: [PATCH] staging:media:atomisp:i2c removed unnecessary white space before comma in memset()

Quoted 1 line · On Mon, Mar 27, 2017 at 5:12 PM, <[email protected]> wrote:

From: Vaibhav Kothari <[email protected]>

"From: .." should not be included in the patch. The subject is still incorrect, there should be a space after each colon. The subject should give overview of changes made in the patch.
It is preferred to fix single checkpatch issue in a patch.

Quoted 3 lines

- Fixing up check-patch error & Warnings
- Added blank line between declaration and defination at various places

The commit message is not proper. There are no full stops at the end of any sentence. Also change defination to definition. Check git log for example.

static int gc2235_read_reg(struct i2c_client *client,

drivers/staging/media/atomisp/i2c/gc2235.c static int gc2235_read_reg(struct i2c_client *client, · line 58

Quoted 5 lines
                return -EINVAL;
        }
drivers/staging/media/atomisp/i2c/gc2235.c +1 -1
-       memset(msg, 0 , sizeof(msg));
+       memset(msg, 0, sizeof(msg));

This change is not reflected in commit message.

drivers/staging/media/atomisp/i2c/gc2235.c static int startup(struct v4l2_subdev *sd) · line 757

Quoted 10 lines
        if (is_init == 0) {
                /* force gc2235 to do a reset in res change, otherwise it
drivers/staging/media/atomisp/i2c/gc2235.c +4 -4
-               * can not output normal after switching res. and it is not
-               * necessary for first time run up after power on, for the sack
-               * of performance
-               */
+                * can not output normal after switching res. and it is not
+                * necessary for first time run up after power on, for the sack
+                * of performance
+                */

Even this change fixes a different issue.

Send patch for a single checkpatch issue.

https://kernelnewbies.org/FirstKernelPatch#submit%2Ba%2Bpatch
Check the First Kernel Patch page.

Thanks,
Varsha Rao

#5 lore raw

PATCH 1/1 staging: media: atomisp: i2c: removed unnecessary white space before comma in memset()

In reply to [email protected]

gc2235.c

Removed extra space before comma in memset() as a part of checkpatch.pl fix-up.

---
 drivers/staging/media/atomisp/i2c/gc2235.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/i2c/gc2235.c +1 -1
index 9b41023..50f4317 100644
@@ -55,7 +55,7 @@ static int gc2235_read_reg(struct i2c_client *client,
 		return -EINVAL;
 	}
 
-	memset(msg, 0 , sizeof(msg));
+	memset(msg, 0, sizeof(msg));
 
 	msg[0].addr = client->addr;
 	msg[0].flags = 0;
Signature · 1 line
1.9.1
#6 lore raw

Re: [PATCH] staging: media: atomisp: i2c: removed unnecessary white space before comma in memset()

Quoted 1 line · On Tue, Mar 28, 2017 at 10:44:44AM +0530, [email protected] wrote:

gc2235.c

Why is this file name here?

Quoted 3 lines

Removed extra space before comma in memset() as a part of checkpatch.pl fix-up.

Why the extra space at the beginning of the line?

Quoted 1 line

This doesn't match your "From:" line above :(

Please fix up.

thanks,

greg k-h

author
#7 lore raw

Re: [PATCH] staging: media: atomisp: i2c: removed unnecessary white space before comma in memset()

Corrected all comments.

Thanks,

Vaibhav

Quoted 16 lines · Greg KH
Quoted 1 line · On Tue, Mar 28, 2017 at 10:44:44AM +0530, [email protected] wrote:

gc2235.c

Why is this file name here?

Quoted 2 lines

Removed extra space before comma in memset() as a part of checkpatch.pl fix-up.

Why the extra space at the beginning of the line?

Quoted 1 line

This doesn't match your "From:" line above :(

Please fix up.

thanks,

greg k-h

#8 lore raw

PATCH 1/1 staging: media: atomisp: i2c: removed unnecessary white space before comma in memset()

In reply to [email protected]

From: Vaibhav Kothari <[email protected]>

Removed extra space before comma in memset() as a part of checkpatch.pl fix-up.

---
 drivers/staging/media/atomisp/i2c/gc2235.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/i2c/gc2235.c +1 -1
index 9b41023..50f4317 100644
@@ -55,7 +55,7 @@ static int gc2235_read_reg(struct i2c_client *client,
 		return -EINVAL;
 	}
 
-	memset(msg, 0 , sizeof(msg));
+	memset(msg, 0, sizeof(msg));
 
 	msg[0].addr = client->addr;
 	msg[0].flags = 0;
Signature · 1 line
1.9.1
#9 lore raw

Re: [PATCH] staging: media: atomisp: i2c: removed unnecessary white space before comma in memset()

Quoted 9 lines · On Tue, Mar 28, 2017 at 11:02:45AM +0530, [email protected] wrote:

From: Vaibhav Kothari <[email protected]>

Removed extra space before comma in memset() as a part of checkpatch.pl fix-up.

---
 drivers/staging/media/atomisp/i2c/gc2235.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

What changed from your prior emails with the same subject? Always version your patches, as SubmittingPatches describes how to do.

Please fix up and resend.

thanks,

greg k-h