diff mbox series

[2/2] wifi: ath9k: use u32 for txgain indexes

Message ID 20230823182401.196270-2-dmantipov@yandex.ru (mailing list archive)
State Accepted
Commit 352281e4a0a020114574b3846a6eed395d0ca908
Delegated to: Kalle Valo
Headers show
Series [1/2] wifi: ath9k: simplify ar9003_hw_process_ini() | expand

Commit Message

Dmitry Antipov Aug. 23, 2023, 6:23 p.m. UTC
Since both 'ar9550_hw_get_modes_txgain_index()' and
'ar9561_hw_get_modes_txgain_index()' never returns
negative values, prefer 'u32' over 'int' and adjust
'ar9003_hw_process_ini()' accordingly.

Suggested-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 drivers/net/wireless/ath/ath9k/ar9003_phy.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Jeff Johnson Aug. 23, 2023, 7:45 p.m. UTC | #1
On 8/23/2023 11:23 AM, Dmitry Antipov wrote:
> Since both 'ar9550_hw_get_modes_txgain_index()' and
> 'ar9561_hw_get_modes_txgain_index()' never returns
> negative values, prefer 'u32' over 'int' and adjust
> 'ar9003_hw_process_ini()' accordingly.
> 
> Suggested-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>

> ---
>   drivers/net/wireless/ath/ath9k/ar9003_phy.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
> index 4731e6618209..6274d1624261 100644
> --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
> +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
> @@ -766,10 +766,10 @@ static void ar9003_hw_prog_ini(struct ath_hw *ah,
>   	}
>   }
>   
> -static int ar9550_hw_get_modes_txgain_index(struct ath_hw *ah,
> +static u32 ar9550_hw_get_modes_txgain_index(struct ath_hw *ah,
>   					    struct ath9k_channel *chan)
>   {
> -	int ret;
> +	u32 ret;
>   
>   	if (IS_CHAN_2GHZ(chan)) {
>   		if (IS_CHAN_HT40(chan))
> @@ -791,7 +791,7 @@ static int ar9550_hw_get_modes_txgain_index(struct ath_hw *ah,
>   	return ret;
>   }
>   
> -static int ar9561_hw_get_modes_txgain_index(struct ath_hw *ah,
> +static u32 ar9561_hw_get_modes_txgain_index(struct ath_hw *ah,
>   					    struct ath9k_channel *chan)
>   {
>   	if (IS_CHAN_2GHZ(chan)) {
> @@ -916,7 +916,7 @@ static int ar9003_hw_process_ini(struct ath_hw *ah,
>   	 * TXGAIN initvals.
>   	 */
>   	if (AR_SREV_9550(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah)) {
> -		int modes_txgain_index = 1;
> +		u32 modes_txgain_index = 1;
>   
>   		if (AR_SREV_9550(ah))
>   			modes_txgain_index = ar9550_hw_get_modes_txgain_index(ah, chan);
Toke Høiland-Jørgensen Sept. 1, 2023, 10:56 a.m. UTC | #2
Dmitry Antipov <dmantipov@yandex.ru> writes:

> Since both 'ar9550_hw_get_modes_txgain_index()' and
> 'ar9561_hw_get_modes_txgain_index()' never returns
> negative values, prefer 'u32' over 'int' and adjust
> 'ar9003_hw_process_ini()' accordingly.
>
> Suggested-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index 4731e6618209..6274d1624261 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -766,10 +766,10 @@  static void ar9003_hw_prog_ini(struct ath_hw *ah,
 	}
 }
 
-static int ar9550_hw_get_modes_txgain_index(struct ath_hw *ah,
+static u32 ar9550_hw_get_modes_txgain_index(struct ath_hw *ah,
 					    struct ath9k_channel *chan)
 {
-	int ret;
+	u32 ret;
 
 	if (IS_CHAN_2GHZ(chan)) {
 		if (IS_CHAN_HT40(chan))
@@ -791,7 +791,7 @@  static int ar9550_hw_get_modes_txgain_index(struct ath_hw *ah,
 	return ret;
 }
 
-static int ar9561_hw_get_modes_txgain_index(struct ath_hw *ah,
+static u32 ar9561_hw_get_modes_txgain_index(struct ath_hw *ah,
 					    struct ath9k_channel *chan)
 {
 	if (IS_CHAN_2GHZ(chan)) {
@@ -916,7 +916,7 @@  static int ar9003_hw_process_ini(struct ath_hw *ah,
 	 * TXGAIN initvals.
 	 */
 	if (AR_SREV_9550(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah)) {
-		int modes_txgain_index = 1;
+		u32 modes_txgain_index = 1;
 
 		if (AR_SREV_9550(ah))
 			modes_txgain_index = ar9550_hw_get_modes_txgain_index(ah, chan);