wifi: iwlwifi: mvm: use min_t() for agg_size
authorJohannes Berg <johannes.berg@intel.com>
Tue, 20 Jun 2023 10:03:54 +0000 (13:03 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 21 Jun 2023 12:02:15 +0000 (14:02 +0200)
We can use min_t() for the agg_size and avoid
spelling out the (firmware) limit twice.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230620125813.211768036c1f.I78b7eea32eaae20cc9f32869aa3f42814634ce9a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/sta.c

index ff1ce99..3c24b25 100644 (file)
@@ -92,9 +92,8 @@ u32 iwl_mvm_get_sta_ampdu_dens(struct ieee80211_link_sta *link_sta,
                                    IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK);
 
        /* Limit to max A-MPDU supported by FW */
-       if (agg_size > (STA_FLG_MAX_AGG_SIZE_4M >> STA_FLG_MAX_AGG_SIZE_SHIFT))
-               agg_size = (STA_FLG_MAX_AGG_SIZE_4M >>
-                           STA_FLG_MAX_AGG_SIZE_SHIFT);
+       agg_size = min_t(u32, agg_size,
+                        STA_FLG_MAX_AGG_SIZE_4M >> STA_FLG_MAX_AGG_SIZE_SHIFT);
 
        *_agg_size = agg_size;
        return mpdu_dens;