wifi: nxpwifi: Use str_on_off() helper
Subsystems (2)
PATCH 1/1 wifi: nxpwifi: Use str_on_off() helper
Both carrier prints open code the on/off ternary. Use the helper from string_choices.h instead. No change in output.
Signed-off-by Aryan Sinha <[email protected]>
--- drivers/net/wireless/nxp/nxpwifi/debugfs.c | 5 +++-- drivers/net/wireless/nxp/nxpwifi/main.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/net/wireless/nxp/nxpwifi/debugfs.c +3 -2
@@ -6,6 +6,7 @@*/ #include <linux/debugfs.h> +#include <linux/string_choices.h> #include "main.h" #include "cmdevt.h"
@@ -98,8 +99,8 @@ nxpwifi_info_read(struct file *file, char __user *ubuf, p +=sprintf (p,"num_rx_pkts_dropped = %lu\n" , priv->stats.rx_dropped); p +=sprintf (p,"num_tx_pkts_err = %lu\n" , priv->stats.tx_errors); p +=sprintf (p,"num_rx_pkts_err = %lu\n" , priv->stats.rx_errors); - p +=sprintf (p,"carrier %s\n" , ((netif_carrier_ok (priv->netdev)) - ?"on" :"off" )); + p +=sprintf (p,"carrier %s\n" , +str_on_off (netif_carrier_ok (priv->netdev))); p +=sprintf (p,"tx queue" );for (i =0 ; i < netdev->num_tx_queues; i++) { txq =netdev_get_tx_queue (netdev, i);
drivers/net/wireless/nxp/nxpwifi/main.c +3 -2
@@ -5,6 +5,7 @@* Copyright 2011-2024 NXP */ +#include <linux/string_choices.h> #include <linux/suspend.h> #include "main.h"
@@ -1088,8 +1089,8 @@ void nxpwifi_drv_info_dump(struct nxpwifi_adapter *adapter) atomic_read(&priv->wmm_tx_pending[3])); p +=sprintf (p,"media_state=\"%s\"\n" , !priv->media_connected ?"Disconnected" :"Connected" ); - p +=sprintf (p,"carrier %s\n" , (netif_carrier_ok (priv->netdev) - ?"on" :"off" )); + p +=sprintf (p,"carrier %s\n" , +str_on_off (netif_carrier_ok (priv->netdev)));for (idx =0 ; idx < priv->netdev->num_tx_queues; idx++) { txq =netdev_get_tx_queue (priv->netdev, idx); p += sprintf(p, "tx queue %d:%s ", idx,
Signature · 1 line
2.46.0
From: Jeff Chen <[email protected]>
Quoted 4 lines · Aryan Sinha
Both carrier prints open code the on/off ternary. Use the helper from
string_choices.hinstead. No change in output.Signed-off-by Aryan Sinha <[email protected]>
Thanks for the patch.
Perhaps the subject could be a bit more descriptive, e.g. "use str_on_off() for carrier state".