Skip to contentSkip to conversation

staging: media: Remove ternary operator

PATCH In review Gargi Sharma 2 participants 2 messages Feb 19, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: media: Remove ternary operator

Relational and logical operators evaluate to either true or false. Explicit conversion is not needed so remove the ternary operator. Done using coccinelle:

@r@
expression A,B;
symbol true,false;
binary operator b = {==,!=,&&,||,>=,<=,>,<};
@@
- (A b B) ? true : false
+ A b B

---
 drivers/staging/media/platform/bcm2835/controls.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/media/platform/bcm2835/controls.c +1 -3
index a40987b..4d7e2a2 100644
@@ -218,9 +218,7 @@ static int ctrl_set_iso(struct bm2835_mmal_dev *dev,
 		dev->iso = iso_values[ctrl->val];
 	else if (ctrl->id == V4L2_CID_ISO_SENSITIVITY_AUTO)
 		dev->manual_iso_enabled =
-				(ctrl->val == V4L2_ISO_SENSITIVITY_MANUAL ?
-							true :
-							false);
+				(ctrl->val == V4L2_ISO_SENSITIVITY_MANUAL);
 
 	control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
 
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 12 lines · Gargi Sharma

Relational and logical operators evaluate to either true or false. Explicit conversion is not needed so remove the ternary operator. Done using coccinelle:

@r@
expression A,B;
symbol true,false;
binary operator b = {==,!=,&&,||,>=,<=,>,<};
@@
- (A b B) ? true : false
+ A b B

Quoted 1 line
Quoted 29 lines
---
 drivers/staging/media/platform/bcm2835/controls.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/media/platform/bcm2835/controls.c +1 -4
index a40987b..4d7e2a2 100644
@@ -218,9 +218,7 @@ static int ctrl_set_iso(struct bm2835_mmal_dev *dev,
 		dev->iso = iso_values[ctrl->val];
 	else if (ctrl->id == V4L2_CID_ISO_SENSITIVITY_AUTO)
 		dev->manual_iso_enabled =
-				(ctrl->val == V4L2_ISO_SENSITIVITY_MANUAL ?
-							true :
-							false);
+				(ctrl->val == V4L2_ISO_SENSITIVITY_MANUAL);
 
 	control = &dev->component[MMAL_COMPONENT_CAMERA]->control;
 
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1487531658-18368-1-git-send-email-gs051095%40gmail.com.
For more options, visit https://groups.google.com/d/optout.