* [PATCH] staging: media: Remove ternary operator
@ 2017-02-19 20:18 Gargi Sharma
2017-02-19 20:21 ` Gargi Sharma
0 siblings, 1 reply; 3+ messages in thread
From: Gargi Sharma @ 2017-02-19 20:18 UTC (permalink / raw)
To: outreachy-kernel; +Cc: gregkh, 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
Signed-off-by: Gargi Sharma <gs051095@gmail.com>
---
drivers/staging/media/platform/bcm2835/controls.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/media/platform/bcm2835/controls.c b/drivers/staging/media/platform/bcm2835/controls.c
index a40987b..4d7e2a2 100644
--- a/drivers/staging/media/platform/bcm2835/controls.c
+++ b/drivers/staging/media/platform/bcm2835/controls.c
@@ -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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: media: Remove ternary operator
2017-02-19 20:18 [PATCH] staging: media: Remove ternary operator Gargi Sharma
@ 2017-02-19 20:21 ` Gargi Sharma
0 siblings, 0 replies; 3+ messages in thread
From: Gargi Sharma @ 2017-02-19 20:21 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Greg KH, Gargi Sharma
[-- Attachment #1: Type: text/plain, Size: 1435 bytes --]
Please ignore.
On Mon, Feb 20, 2017 at 1:48 AM, Gargi Sharma <gs051095@gmail.com> wrote:
>
> 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
>
> Signed-off-by: Gargi Sharma <gs051095@gmail.com>
> ---
> drivers/staging/media/platform/bcm2835/controls.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/media/platform/bcm2835/controls.c
b/drivers/staging/media/platform/bcm2835/controls.c
> index a40987b..4d7e2a2 100644
> --- a/drivers/staging/media/platform/bcm2835/controls.c
> +++ b/drivers/staging/media/platform/bcm2835/controls.c
> @@ -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
>
[-- Attachment #2: Type: text/html, Size: 1930 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] staging: media: Remove ternary operator
@ 2017-02-19 19:14 Gargi Sharma
0 siblings, 0 replies; 3+ messages in thread
From: Gargi Sharma @ 2017-02-19 19:14 UTC (permalink / raw)
To: outreachy-kernel; +Cc: gregkh, 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
Signed-off-by: Gargi Sharma <gs051095@gmail.com>
---
drivers/staging/media/platform/bcm2835/controls.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/media/platform/bcm2835/controls.c b/drivers/staging/media/platform/bcm2835/controls.c
index a40987b..4d7e2a2 100644
--- a/drivers/staging/media/platform/bcm2835/controls.c
+++ b/drivers/staging/media/platform/bcm2835/controls.c
@@ -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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-02-19 20:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-19 20:18 [PATCH] staging: media: Remove ternary operator Gargi Sharma
2017-02-19 20:21 ` Gargi Sharma
-- strict thread matches above, loose matches on Subject: below --
2017-02-19 19:14 Gargi Sharma
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.