summaryrefslogtreecommitdiffstats
path: root/drivers/staging/vt6656/card.c
diff options
context:
space:
mode:
authorOscar Carter <oscar.carter@gmx.com>2020-04-18 15:45:53 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-23 13:38:08 +0200
commit9f8c9f4a2e6f23fc6eeecd305bfb40ddc91e0369 (patch)
treece705bfd2ff713d8405868077160761d34c15c08 /drivers/staging/vt6656/card.c
parente3436ce60cf5f5eaedda2b8c622f69feb97595e2 (diff)
downloadlinux-stable-9f8c9f4a2e6f23fc6eeecd305bfb40ddc91e0369.tar.gz
linux-stable-9f8c9f4a2e6f23fc6eeecd305bfb40ddc91e0369.tar.bz2
linux-stable-9f8c9f4a2e6f23fc6eeecd305bfb40ddc91e0369.zip
staging: vt6656: Refactor the vnt_ofdm_min_rate function
Replace the for loop by a ternary operator whose condition is an AND bitmask against the priv->basic_rates variable. The purpose of the for loop was to check if any of bits from RATE_54M to RATE_6M was set, but it's not necessary to check every individual bit. The same result can be achieved using only one single mask which comprises all the commented bits. This way avoid the iteration over an unnecessary for loop. Also change the return type to bool because it's the type that this function returns. Signed-off-by: Oscar Carter <oscar.carter@gmx.com> Link: https://lore.kernel.org/r/20200418134553.6415-1-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vt6656/card.c')
-rw-r--r--drivers/staging/vt6656/card.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index f8bfadd4b506..983b1ea399dc 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -248,16 +248,9 @@ void vnt_update_top_rates(struct vnt_private *priv)
priv->top_cck_basic_rate = top_cck;
}
-int vnt_ofdm_min_rate(struct vnt_private *priv)
+bool vnt_ofdm_min_rate(struct vnt_private *priv)
{
- int ii;
-
- for (ii = RATE_54M; ii >= RATE_6M; ii--) {
- if ((priv->basic_rates) & ((u16)BIT(ii)))
- return true;
- }
-
- return false;
+ return priv->basic_rates & GENMASK(RATE_54M, RATE_6M) ? true : false;
}
u8 vnt_get_pkt_type(struct vnt_private *priv)