diff mbox series

[-next,1/3] media: dvb-frontends: drx39xyj: Remove an unnecessary ternary operator

Message ID 20230804031323.2105187-2-ruanjinjie@huawei.com (mailing list archive)
State New, archived
Headers show
Series media: Remove unnecessary ternary operators | expand

Commit Message

Jinjie Ruan Aug. 4, 2023, 3:13 a.m. UTC
There is a ternary operator, the true or false judgement of which
is unnecessary in C language semantics.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
---
 drivers/media/dvb-frontends/drx39xyj/drxj.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Uwe Kleine-König Aug. 4, 2023, 6:05 a.m. UTC | #1
On Fri, Aug 04, 2023 at 11:13:21AM +0800, Ruan Jinjie wrote:
> There is a ternary operator, the true or false judgement of which
> is unnecessary in C language semantics.
> 
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> ---
>  drivers/media/dvb-frontends/drx39xyj/drxj.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c
> index 68f4e8b5a0ab..e54e61c3518a 100644
> --- a/drivers/media/dvb-frontends/drx39xyj/drxj.c
> +++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c
> @@ -4779,7 +4779,7 @@ set_frequency(struct drx_demod_instance *demod,
>  	bool image_to_select;
>  	s32 fm_frequency_shift = 0;
>  
> -	rf_mirror = (ext_attr->mirror == DRX_MIRROR_YES) ? true : false;
> +	rf_mirror = ext_attr->mirror == DRX_MIRROR_YES;
>  	tuner_mirror = demod->my_common_attr->mirror_freq_spect ? false : true;

Maybe also do:

-	tuner_mirror = demod->my_common_attr->mirror_freq_spect ? false : true;
+	tuner_mirror = !demod->my_common_attr->mirror_freq_spect;

?

Best regards
Uwe

>  	/*
>  	   Program frequency shifter
Jinjie Ruan Aug. 4, 2023, 6:18 a.m. UTC | #2
On 2023/8/4 14:05, Uwe Kleine-König wrote:
> On Fri, Aug 04, 2023 at 11:13:21AM +0800, Ruan Jinjie wrote:
>> There is a ternary operator, the true or false judgement of which
>> is unnecessary in C language semantics.
>>
>> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
>> ---
>>  drivers/media/dvb-frontends/drx39xyj/drxj.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c
>> index 68f4e8b5a0ab..e54e61c3518a 100644
>> --- a/drivers/media/dvb-frontends/drx39xyj/drxj.c
>> +++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c
>> @@ -4779,7 +4779,7 @@ set_frequency(struct drx_demod_instance *demod,
>>  	bool image_to_select;
>>  	s32 fm_frequency_shift = 0;
>>  
>> -	rf_mirror = (ext_attr->mirror == DRX_MIRROR_YES) ? true : false;
>> +	rf_mirror = ext_attr->mirror == DRX_MIRROR_YES;
>>  	tuner_mirror = demod->my_common_attr->mirror_freq_spect ? false : true;
> 
> Maybe also do:
> 
> -	tuner_mirror = demod->my_common_attr->mirror_freq_spect ? false : true;
> +	tuner_mirror = !demod->my_common_attr->mirror_freq_spect;
> 
> ?

Right!

> 
> Best regards
> Uwe
> 
>>  	/*
>>  	   Program frequency shifter
>
diff mbox series

Patch

diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c
index 68f4e8b5a0ab..e54e61c3518a 100644
--- a/drivers/media/dvb-frontends/drx39xyj/drxj.c
+++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c
@@ -4779,7 +4779,7 @@  set_frequency(struct drx_demod_instance *demod,
 	bool image_to_select;
 	s32 fm_frequency_shift = 0;
 
-	rf_mirror = (ext_attr->mirror == DRX_MIRROR_YES) ? true : false;
+	rf_mirror = ext_attr->mirror == DRX_MIRROR_YES;
 	tuner_mirror = demod->my_common_attr->mirror_freq_spect ? false : true;
 	/*
 	   Program frequency shifter