diff mbox series

[-next] ath9k: Remove unnecessary ternary operators

Message ID 20230731124455.2039184-1-ruanjinjie@huawei.com
State New
Headers show
Series [-next] ath9k: Remove unnecessary ternary operators | expand

Commit Message

Jinjie Ruan July 31, 2023, 12:44 p.m. UTC
Ther are a little ternary operators, the true or false judgement
of which is unnecessary in C language semantics.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
---
 drivers/net/wireless/ath/ath9k/eeprom_9287.c  | 3 +--
 drivers/net/wireless/ath/ath9k/hif_usb.c      | 2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

Comments

Jinjie Ruan Aug. 4, 2023, 1:19 a.m. UTC | #1
Ping.

On 2023/7/31 20:44, Ruan Jinjie wrote:
> Ther are a little ternary operators, the true or false judgement
> of which is unnecessary in C language semantics.
> 
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> ---
>  drivers/net/wireless/ath/ath9k/eeprom_9287.c  | 3 +--
>  drivers/net/wireless/ath/ath9k/hif_usb.c      | 2 +-
>  drivers/net/wireless/ath/ath9k/htc_drv_main.c | 2 +-
>  3 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
> index 3caa149b1013..fd5312c2a7e3 100644
> --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
> +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
> @@ -572,8 +572,7 @@ static void ath9k_hw_set_ar9287_power_per_rate_table(struct ath_hw *ah,
>  	}
>  
>  	for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) {
> -		bool isHt40CtlMode =
> -			(pCtlMode[ctlMode] == CTL_2GHT40) ? true : false;
> +		bool isHt40CtlMode = pCtlMode[ctlMode] == CTL_2GHT40;
>  
>  		if (isHt40CtlMode)
>  			freq = centers.synth_center;
> diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
> index 27ff1ca2631f..e5414435b141 100644
> --- a/drivers/net/wireless/ath/ath9k/hif_usb.c
> +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
> @@ -1432,7 +1432,7 @@ static void ath9k_hif_usb_disconnect(struct usb_interface *interface)
>  {
>  	struct usb_device *udev = interface_to_usbdev(interface);
>  	struct hif_device_usb *hif_dev = usb_get_intfdata(interface);
> -	bool unplugged = (udev->state == USB_STATE_NOTATTACHED) ? true : false;
> +	bool unplugged = udev->state == USB_STATE_NOTATTACHED;
>  
>  	if (!hif_dev)
>  		return;
> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> index 51766de5ec3b..44e02cfe2438 100644
> --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> @@ -719,7 +719,7 @@ static int ath9k_htc_tx_aggr_oper(struct ath9k_htc_priv *priv,
>  
>  	aggr.sta_index = ista->index;
>  	aggr.tidno = tid & 0xf;
> -	aggr.aggr_enable = (action == IEEE80211_AMPDU_TX_START) ? true : false;
> +	aggr.aggr_enable = action == IEEE80211_AMPDU_TX_START;
>  
>  	WMI_CMD_BUF(WMI_TX_AGGR_ENABLE_CMDID, &aggr);
>  	if (ret)
Kalle Valo Aug. 4, 2023, 7:05 a.m. UTC | #2
Ruan Jinjie <ruanjinjie@huawei.com> writes:

> Ping.

Please don't top post. And also don't ping, you can check the patch
status from our patchwork. Read more from the wiki link below.
Toke Høiland-Jørgensen Aug. 4, 2023, 9:29 a.m. UTC | #3
Kalle Valo <kvalo@kernel.org> writes:

> Ruan Jinjie <ruanjinjie@huawei.com> writes:
>
>> Ping.
>
> Please don't top post. And also don't ping, you can check the patch
> status from our patchwork. Read more from the wiki link below.

Also, in this case the maintainer is on holiday :)

I'll be back starting next week, but will probably take some time
getting through my backlog...

-Toke
Toke Høiland-Jørgensen Aug. 8, 2023, 1:42 p.m. UTC | #4
Ruan Jinjie <ruanjinjie@huawei.com> writes:

> Ther are a little ternary operators, the true or false judgement
> of which is unnecessary in C language semantics.
>
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>

Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Kalle Valo Aug. 22, 2023, 1:38 p.m. UTC | #5
Ruan Jinjie <ruanjinjie@huawei.com> wrote:

> Ther are a little ternary operators, the true or false judgement
> of which is unnecessary in C language semantics.
> 
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

b2fd72aafb13 wifi: ath9k: Remove unnecessary ternary operators
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
index 3caa149b1013..fd5312c2a7e3 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
@@ -572,8 +572,7 @@  static void ath9k_hw_set_ar9287_power_per_rate_table(struct ath_hw *ah,
 	}
 
 	for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) {
-		bool isHt40CtlMode =
-			(pCtlMode[ctlMode] == CTL_2GHT40) ? true : false;
+		bool isHt40CtlMode = pCtlMode[ctlMode] == CTL_2GHT40;
 
 		if (isHt40CtlMode)
 			freq = centers.synth_center;
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 27ff1ca2631f..e5414435b141 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -1432,7 +1432,7 @@  static void ath9k_hif_usb_disconnect(struct usb_interface *interface)
 {
 	struct usb_device *udev = interface_to_usbdev(interface);
 	struct hif_device_usb *hif_dev = usb_get_intfdata(interface);
-	bool unplugged = (udev->state == USB_STATE_NOTATTACHED) ? true : false;
+	bool unplugged = udev->state == USB_STATE_NOTATTACHED;
 
 	if (!hif_dev)
 		return;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 51766de5ec3b..44e02cfe2438 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -719,7 +719,7 @@  static int ath9k_htc_tx_aggr_oper(struct ath9k_htc_priv *priv,
 
 	aggr.sta_index = ista->index;
 	aggr.tidno = tid & 0xf;
-	aggr.aggr_enable = (action == IEEE80211_AMPDU_TX_START) ? true : false;
+	aggr.aggr_enable = action == IEEE80211_AMPDU_TX_START;
 
 	WMI_CMD_BUF(WMI_TX_AGGR_ENABLE_CMDID, &aggr);
 	if (ret)