summaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
diff options
context:
space:
mode:
authorRebecca Mckeever <remckee0@gmail.com>2022-04-07 20:12:51 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-08 15:43:36 +0200
commitf8ab914705853aa7a971977121c493fc244adb04 (patch)
tree063ccc5db8d29bb666fa6f6ae4d450f46212ef97 /drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
parent49ce1b1fbca89e8c4b1cbbd7064b26f7b9d1a365 (diff)
staging: rtl8192u: use min_t/max_t macros instead of if else
Replace if else statement with min_t or max_t macros to increase readability and conform to Linux kernel coding style. The _t versions of the macros must be used to avoid applying typeof to the bit fields pPeerHTCap->MaxRxAMPDUFactor, and pPeerHTCap->MPDUDensity. Using u32 assures the reader that the value with not be truncated without having to look up the types of the variables involved. Found with minmax coccinelle script. Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rebecca Mckeever <remckee0@gmail.com> Link: https://lore.kernel.org/r/65518c0b366bf199903c6c530774c61ba6087165.1649378587.git.remckee0@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c')
-rw-r--r--drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index dba3f2db9f48..358c35d9589c 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -940,10 +940,8 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
else
pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_64K;
} else {
- if (pPeerHTCap->MaxRxAMPDUFactor < HT_AGG_SIZE_32K)
- pHTInfo->CurrentAMPDUFactor = pPeerHTCap->MaxRxAMPDUFactor;
- else
- pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_32K;
+ pHTInfo->CurrentAMPDUFactor = min_t(u32, pPeerHTCap->MaxRxAMPDUFactor,
+ HT_AGG_SIZE_32K);
}
}
@@ -951,10 +949,9 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
* <2> Set AMPDU Minimum MPDU Start Spacing
* 802.11n 3.0 section 9.7d.3
*/
- if (pHTInfo->MPDU_Density > pPeerHTCap->MPDUDensity)
- pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
- else
- pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity;
+ pHTInfo->CurrentMPDUDensity = max_t(u32, pHTInfo->MPDU_Density,
+ pPeerHTCap->MPDUDensity);
+
if (ieee->pairwise_key_type != KEY_TYPE_NA)
pHTInfo->CurrentMPDUDensity = 7; // 8us
// Force TX AMSDU