linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/7] staging: gc2235: Multiple checkpatch issues
@ 2017-03-09 22:50 simran singhal
  2017-03-09 22:50 ` [PATCH v1 1/7] staging: gc2235: Remove unnecessary typecast of c90 int constant simran singhal
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: simran singhal @ 2017-03-09 22:50 UTC (permalink / raw)
  To: mchehab; +Cc: gregkh, linux-media, devel, linux-kernel, outreachy-kernel

v1:
  -change the subject of all the patches of the patch-series


simran singhal (7):
  staging: gc2235: Remove unnecessary typecast of c90 int constant
  staging: gc2235: Add blank line after a declaration
  staging: gc2235: Replace NULL with "!"
  staging: gc2235: Remove blank line before '}' and after '{' braces
  staging: gc2235: Remove multiple assignments
  staging: gc2235: Use x instead of x != NULL
  staging: gc2235: Do not use multiple blank lines

 drivers/staging/media/atomisp/i2c/gc2235.c | 32 ++++++++++++++++--------------
 1 file changed, 17 insertions(+), 15 deletions(-)

-- 
2.7.4

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

* [PATCH v1 1/7] staging: gc2235: Remove unnecessary typecast of c90 int constant
  2017-03-09 22:50 [PATCH v1 0/7] staging: gc2235: Multiple checkpatch issues simran singhal
@ 2017-03-09 22:50 ` simran singhal
  2017-03-12 14:20   ` Greg KH
  2017-03-09 22:50 ` [PATCH v1 2/7] staging: gc2235: Add blank line after a declaration simran singhal
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: simran singhal @ 2017-03-09 22:50 UTC (permalink / raw)
  To: mchehab; +Cc: gregkh, linux-media, devel, linux-kernel, outreachy-kernel

This patch removes unnecessary typecast of c90 int constant.

WARNING: Unnecessary typecast of c90 int constant

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
 drivers/staging/media/atomisp/i2c/gc2235.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/gc2235.c b/drivers/staging/media/atomisp/i2c/gc2235.c
index 3dd5e7f..3f2b11ec 100644
--- a/drivers/staging/media/atomisp/i2c/gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/gc2235.c
@@ -706,10 +706,10 @@ static int distance(struct gc2235_resolution *res, u32 w, u32 h)
 	h_ratio = ((res->height << 13) / h);
 	if (h_ratio == 0)
 		return -1;
-	match   = abs(((w_ratio << 13) / h_ratio) - ((int)8192));
+	match   = abs(((w_ratio << 13) / h_ratio) - 8192);
 
-	if ((w_ratio < (int)8192) || (h_ratio < (int)8192)  ||
-		(match > LARGEST_ALLOWED_RATIO_MISMATCH))
+	if ((w_ratio < 8192) || (h_ratio < 8192)  ||
+	    (match > LARGEST_ALLOWED_RATIO_MISMATCH))
 		return -1;
 
 	return w_ratio + h_ratio;
-- 
2.7.4

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

* [PATCH v1 2/7] staging: gc2235: Add blank line after a declaration
  2017-03-09 22:50 [PATCH v1 0/7] staging: gc2235: Multiple checkpatch issues simran singhal
  2017-03-09 22:50 ` [PATCH v1 1/7] staging: gc2235: Remove unnecessary typecast of c90 int constant simran singhal
@ 2017-03-09 22:50 ` simran singhal
  2017-03-09 22:50 ` [PATCH v1 3/7] staging: gc2235: Replace NULL with "!" simran singhal
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: simran singhal @ 2017-03-09 22:50 UTC (permalink / raw)
  To: mchehab; +Cc: gregkh, linux-media, devel, linux-kernel, outreachy-kernel

Add blank line after a declaration. Problem found
using checkpatch.

This patch fixes these warning messages found by checkpatch.pl:
WARNING : Missing a blank line after declarations.

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
 drivers/staging/media/atomisp/i2c/gc2235.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/staging/media/atomisp/i2c/gc2235.c b/drivers/staging/media/atomisp/i2c/gc2235.c
index 3f2b11ec..7de7e24 100644
--- a/drivers/staging/media/atomisp/i2c/gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/gc2235.c
@@ -359,6 +359,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;
 
@@ -410,6 +411,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;
 	}
@@ -546,6 +548,7 @@ static int is_init;
 static int gc2235_init(struct v4l2_subdev *sd)
 {
 	int ret = 0;
+
 	ret = __gc2235_init(sd);
 
 	return ret;
@@ -759,6 +762,7 @@ 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
@@ -893,6 +897,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)
@@ -1007,6 +1012,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);
@@ -1112,6 +1118,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)
-- 
2.7.4

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

* [PATCH v1 3/7] staging: gc2235: Replace NULL with "!"
  2017-03-09 22:50 [PATCH v1 0/7] staging: gc2235: Multiple checkpatch issues simran singhal
  2017-03-09 22:50 ` [PATCH v1 1/7] staging: gc2235: Remove unnecessary typecast of c90 int constant simran singhal
  2017-03-09 22:50 ` [PATCH v1 2/7] staging: gc2235: Add blank line after a declaration simran singhal
@ 2017-03-09 22:50 ` simran singhal
  2017-03-09 22:50 ` [PATCH v1 4/7] staging: gc2235: Remove blank line before '}' and after '{' braces simran singhal
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: simran singhal @ 2017-03-09 22:50 UTC (permalink / raw)
  To: mchehab; +Cc: gregkh, linux-media, devel, linux-kernel, outreachy-kernel

Use ! in comparison tests using "==NULL" rather than moving the
"==NULL" to the right side of the test.

Addesses multiple instances of the checkpatch.pl warning:
WARNING: Comparisons should place the constant on the right side of the
test

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
 drivers/staging/media/atomisp/i2c/gc2235.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/gc2235.c b/drivers/staging/media/atomisp/i2c/gc2235.c
index 7de7e24..2ef876a 100644
--- a/drivers/staging/media/atomisp/i2c/gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/gc2235.c
@@ -603,7 +603,7 @@ static int power_up(struct v4l2_subdev *sd)
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
 	int ret;
 
-	if (NULL == dev->platform_data) {
+	if (!dev->platform_data) {
 		dev_err(&client->dev,
 			"no camera_sensor_platform_data");
 		return -ENODEV;
@@ -647,7 +647,7 @@ static int power_down(struct v4l2_subdev *sd)
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
 	int ret = 0;
 
-	if (NULL == dev->platform_data) {
+	if (!dev->platform_data) {
 		dev_err(&client->dev,
 			"no camera_sensor_platform_data");
 		return -ENODEV;
-- 
2.7.4

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

* [PATCH v1 4/7] staging: gc2235: Remove blank line before '}' and after '{' braces
  2017-03-09 22:50 [PATCH v1 0/7] staging: gc2235: Multiple checkpatch issues simran singhal
                   ` (2 preceding siblings ...)
  2017-03-09 22:50 ` [PATCH v1 3/7] staging: gc2235: Replace NULL with "!" simran singhal
@ 2017-03-09 22:50 ` simran singhal
  2017-03-09 22:50 ` [PATCH v1 5/7] staging: gc2235: Remove multiple assignments simran singhal
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: simran singhal @ 2017-03-09 22:50 UTC (permalink / raw)
  To: mchehab; +Cc: gregkh, linux-media, devel, linux-kernel, outreachy-kernel

Remove unneeded blank lines preceding/following '}' and '{' braces, as
pointed out by checkpatch.

This patch addresses the following checkpatch checks:

CHECK: Blank lines aren't necessary before a close brace '}'
CHECK: Blank lines aren't necessary after an open brace '{'

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
 drivers/staging/media/atomisp/i2c/gc2235.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/gc2235.c b/drivers/staging/media/atomisp/i2c/gc2235.c
index 2ef876a..198df22 100644
--- a/drivers/staging/media/atomisp/i2c/gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/gc2235.c
@@ -788,7 +788,6 @@ static int gc2235_set_fmt(struct v4l2_subdev *sd,
 			  struct v4l2_subdev_pad_config *cfg,
 			  struct v4l2_subdev_format *format)
 {
-
 	struct v4l2_mbus_framefmt *fmt = &format->format;
 	struct gc2235_device *dev = to_gc2235_sensor(sd);
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
@@ -1070,7 +1069,6 @@ static int gc2235_enum_frame_size(struct v4l2_subdev *sd,
 	fse->max_height = gc2235_res[index].height;
 
 	return 0;
-
 }
 
 static int gc2235_g_skip_frames(struct v4l2_subdev *sd, u32 *frames)
@@ -1228,7 +1226,6 @@ static int init_gc2235(void)
 
 static void exit_gc2235(void)
 {
-
 	i2c_del_driver(&gc2235_driver);
 }
 
-- 
2.7.4

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

* [PATCH v1 5/7] staging: gc2235: Remove multiple assignments
  2017-03-09 22:50 [PATCH v1 0/7] staging: gc2235: Multiple checkpatch issues simran singhal
                   ` (3 preceding siblings ...)
  2017-03-09 22:50 ` [PATCH v1 4/7] staging: gc2235: Remove blank line before '}' and after '{' braces simran singhal
@ 2017-03-09 22:50 ` simran singhal
  2017-03-09 22:50 ` [PATCH v1 6/7] staging: gc2235: Use x instead of x != NULL simran singhal
  2017-03-09 22:50 ` [PATCH v1 7/7] staging: gc2235: Do not use multiple blank lines simran singhal
  6 siblings, 0 replies; 9+ messages in thread
From: simran singhal @ 2017-03-09 22:50 UTC (permalink / raw)
  To: mchehab; +Cc: gregkh, linux-media, devel, linux-kernel, outreachy-kernel

Remove multiple assignments by factorizing them. Problem found using
checkpatch.pl

CHECK: multiple assignments should be avoided

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
 drivers/staging/media/atomisp/i2c/gc2235.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/i2c/gc2235.c b/drivers/staging/media/atomisp/i2c/gc2235.c
index 198df22..165dcb3 100644
--- a/drivers/staging/media/atomisp/i2c/gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/gc2235.c
@@ -259,7 +259,8 @@ static int gc2235_get_intg_factor(struct i2c_client *client,
 		return -EINVAL;
 
 	/* pixel clock calculattion */
-	buf->vt_pix_clk_freq_mhz = dev->vt_pix_clk_freq_mhz = 30000000;
+	buf->vt_pix_clk_freq_mhz = 30000000;
+	dev->vt_pix_clk_freq_mhz = 30000000;
 
 	/* get integration time */
 	buf->coarse_integration_time_min = GC2235_COARSE_INTG_TIME_MIN;
-- 
2.7.4

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

* [PATCH v1 6/7] staging: gc2235: Use x instead of x != NULL
  2017-03-09 22:50 [PATCH v1 0/7] staging: gc2235: Multiple checkpatch issues simran singhal
                   ` (4 preceding siblings ...)
  2017-03-09 22:50 ` [PATCH v1 5/7] staging: gc2235: Remove multiple assignments simran singhal
@ 2017-03-09 22:50 ` simran singhal
  2017-03-09 22:50 ` [PATCH v1 7/7] staging: gc2235: Do not use multiple blank lines simran singhal
  6 siblings, 0 replies; 9+ messages in thread
From: simran singhal @ 2017-03-09 22:50 UTC (permalink / raw)
  To: mchehab; +Cc: gregkh, linux-media, devel, linux-kernel, outreachy-kernel

Use x instead of x != NULL .
This patch removes the explicit NULL comparisons.This issue is found by
checkpatch.pl script.

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
 drivers/staging/media/atomisp/i2c/gc2235.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/gc2235.c b/drivers/staging/media/atomisp/i2c/gc2235.c
index 165dcb3..40a5a2f 100644
--- a/drivers/staging/media/atomisp/i2c/gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/gc2235.c
@@ -255,7 +255,7 @@ static int gc2235_get_intg_factor(struct i2c_client *client,
 	u16 reg_val, reg_val_h, dummy;
 	int ret;
 
-	if (info == NULL)
+	if (!info)
 		return -EINVAL;
 
 	/* pixel clock calculattion */
@@ -797,7 +797,7 @@ static int gc2235_set_fmt(struct v4l2_subdev *sd,
 	int idx;
 
 	gc2235_info = v4l2_get_subdev_hostdata(sd);
-	if (gc2235_info == NULL)
+	if (!gc2235_info)
 		return -EINVAL;
 	if (format->pad)
 		return -EINVAL;
@@ -917,7 +917,7 @@ static int gc2235_s_config(struct v4l2_subdev *sd,
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
 	int ret = 0;
 
-	if (platform_data == NULL)
+	if (!platform_data)
 		return -ENODEV;
 
 	dev->platform_data =
-- 
2.7.4

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

* [PATCH v1 7/7] staging: gc2235: Do not use multiple blank lines
  2017-03-09 22:50 [PATCH v1 0/7] staging: gc2235: Multiple checkpatch issues simran singhal
                   ` (5 preceding siblings ...)
  2017-03-09 22:50 ` [PATCH v1 6/7] staging: gc2235: Use x instead of x != NULL simran singhal
@ 2017-03-09 22:50 ` simran singhal
  6 siblings, 0 replies; 9+ messages in thread
From: simran singhal @ 2017-03-09 22:50 UTC (permalink / raw)
  To: mchehab; +Cc: gregkh, linux-media, devel, linux-kernel, outreachy-kernel

Remove multiple blank lines. Problem found using checkpatch.pl
"CHECK: Please don't use multiple blank lines".

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
 drivers/staging/media/atomisp/i2c/gc2235.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/gc2235.c b/drivers/staging/media/atomisp/i2c/gc2235.c
index 40a5a2f..b97a74b 100644
--- a/drivers/staging/media/atomisp/i2c/gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/gc2235.c
@@ -244,7 +244,6 @@ static int gc2235_g_fnumber_range(struct v4l2_subdev *sd, s32 *val)
 	return 0;
 }
 
-
 static int gc2235_get_intg_factor(struct i2c_client *client,
 				struct camera_mipi_info *info,
 				const struct gc2235_resolution *res)
@@ -388,7 +387,6 @@ static long __gc2235_set_exposure(struct v4l2_subdev *sd, int coarse_itg,
 	return ret;
 }
 
-
 static int gc2235_set_exposure(struct v4l2_subdev *sd, int exposure,
 	int gain, int digitgain)
 {
@@ -909,7 +907,6 @@ static int gc2235_s_stream(struct v4l2_subdev *sd, int enable)
 	return ret;
 }
 
-
 static int gc2235_s_config(struct v4l2_subdev *sd,
 			   int irq, void *platform_data)
 {
-- 
2.7.4

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

* Re: [PATCH v1 1/7] staging: gc2235: Remove unnecessary typecast of c90 int constant
  2017-03-09 22:50 ` [PATCH v1 1/7] staging: gc2235: Remove unnecessary typecast of c90 int constant simran singhal
@ 2017-03-12 14:20   ` Greg KH
  0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2017-03-12 14:20 UTC (permalink / raw)
  To: simran singhal
  Cc: mchehab, devel, outreachy-kernel, linux-kernel, linux-media

On Fri, Mar 10, 2017 at 04:20:23AM +0530, simran singhal wrote:
> This patch removes unnecessary typecast of c90 int constant.
> 
> WARNING: Unnecessary typecast of c90 int constant
> 
> Signed-off-by: simran singhal <singhalsimran0@gmail.com>
> ---
>  drivers/staging/media/atomisp/i2c/gc2235.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

This series doesn't apply to my tree at all, please rebase and resend.

thanks,

greg k-h

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

end of thread, other threads:[~2017-03-12 14:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-09 22:50 [PATCH v1 0/7] staging: gc2235: Multiple checkpatch issues simran singhal
2017-03-09 22:50 ` [PATCH v1 1/7] staging: gc2235: Remove unnecessary typecast of c90 int constant simran singhal
2017-03-12 14:20   ` Greg KH
2017-03-09 22:50 ` [PATCH v1 2/7] staging: gc2235: Add blank line after a declaration simran singhal
2017-03-09 22:50 ` [PATCH v1 3/7] staging: gc2235: Replace NULL with "!" simran singhal
2017-03-09 22:50 ` [PATCH v1 4/7] staging: gc2235: Remove blank line before '}' and after '{' braces simran singhal
2017-03-09 22:50 ` [PATCH v1 5/7] staging: gc2235: Remove multiple assignments simran singhal
2017-03-09 22:50 ` [PATCH v1 6/7] staging: gc2235: Use x instead of x != NULL simran singhal
2017-03-09 22:50 ` [PATCH v1 7/7] staging: gc2235: Do not use multiple blank lines simran singhal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).