Skip to contentSkip to conversation

drivers: dream: Code style fix

PATCH In review Jochen Maes 3 participants 3 messages Feb 10, 2010 – Feb 11, 2010 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 drivers: dream: Code style fix

Removed parenthesis from return statements,
split up assignment and if condition

---
 drivers/staging/dream/camera/s5k3e2fx.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)
drivers/staging/dream/camera/s5k3e2fx.c +12 -10
index edba198..5cb22c8 100644
@@ -743,12 +743,14 @@ static int s5k3e2fx_sensor_open_init(const struct msm_camera_sensor_info *data)
 	}
 
 	/* initialize AF */
-	if ((rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
-			0x3146, 0x3A)) < 0)
+	rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
+			0x3146, 0x3A)
+	if rc < 0
 		goto init_fail1;
 
-	if ((rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
-			0x3130, 0x03)) < 0)
+	rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
+			0x3130, 0x03)
+	rc < 0
 		goto init_fail1;
 
 	goto init_done;
@@ -814,20 +816,20 @@ static uint16_t s5k3e2fx_get_prev_lines_pf(void)
 
 static uint16_t s5k3e2fx_get_prev_pixels_pl(void)
 {
-	return (s5k3e2fx_reg_pat[S_RES_PREVIEW].size_w +
-		s5k3e2fx_reg_pat[S_RES_PREVIEW].blk_p);
+	return s5k3e2fx_reg_pat[S_RES_PREVIEW].size_w +
+		s5k3e2fx_reg_pat[S_RES_PREVIEW].blk_p;
 }
 
 static uint16_t s5k3e2fx_get_pict_lines_pf(void)
 {
-	return (s5k3e2fx_reg_pat[S_RES_CAPTURE].size_h +
-		s5k3e2fx_reg_pat[S_RES_CAPTURE].blk_l);
+	return s5k3e2fx_reg_pat[S_RES_CAPTURE].size_h +
+		s5k3e2fx_reg_pat[S_RES_CAPTURE].blk_l;
 }
 
 static uint16_t s5k3e2fx_get_pict_pixels_pl(void)
 {
-	return (s5k3e2fx_reg_pat[S_RES_CAPTURE].size_w +
-		s5k3e2fx_reg_pat[S_RES_CAPTURE].blk_p);
+	return s5k3e2fx_reg_pat[S_RES_CAPTURE].size_w +
+		s5k3e2fx_reg_pat[S_RES_CAPTURE].blk_p;
 }
 
 static uint32_t s5k3e2fx_get_pict_max_exp_lc(void)
Signature · 1 line
1.6.6
#1 lore raw
Quoted 13 lines · Jochen Maes

Removed parenthesis from return statements,
split up assignment and if condition

---
 drivers/staging/dream/camera/s5k3e2fx.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)
drivers/staging/dream/camera/s5k3e2fx.c +0 -0
index edba198..5cb22c8 100644

drivers/staging/dream/camera/s5k3e2fx.c static int s5k3e2fx_sensor_open_init(const struct msm_camera_sensor_info *data) · line 750

Quoted 10 lines
drivers/staging/dream/camera/s5k3e2fx.c +3 -2
@@ -743,12 +743,14 @@ static int s5k3e2fx_sensor_open_init(const struct msm_camera_sensor_info *data)
 	}
 
 	/* initialize AF */
-	if ((rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
-			0x3146, 0x3A)) < 0)
+	rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
+			0x3146, 0x3A)
+	if rc < 0
 		goto init_fail1;
 

I do not think this is valid C.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#2 lore raw
Quoted 16 lines · Pavel Machek
Quoted 15 lines · Jochen Maes

Removed parenthesis from return statements,
split up assignment and if condition

---
 drivers/staging/dream/camera/s5k3e2fx.c |   22 ++++++++++++----------

 1 files changed, 12 insertions(+), 10 deletions(-)
drivers/staging/dream/camera/s5k3e2fx.c +0 -0
index edba198..5cb22c8 100644
@@ -743,12 +743,14 @@ static int s5k3e2fx_sensor_open_init(const struct msm_camera_sensor_info *data)
       }
 
Quoted 9 lines

drivers/staging/dream/camera/s5k3e2fx.c static int s5k3e2fx_sensor_open_init(const struct msm_camera_sensor_info *data) · line 749

Quoted 7 lines
drivers/staging/dream/camera/s5k3e2fx.c +3 -2
       /* initialize AF */
-     if ((rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
-                     0x3146, 0x3A)) < 0)
+     rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
+                     0x3146, 0x3A)
+     if rc < 0
               goto init_fail1;

I do not think this is valid C.

Yeah, please compile-test trivial cleanups like this before sending them.