aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8192u/r8192U_core.c
diff options
context:
space:
mode:
authorXenia Ragiadakou <burzalodowa@gmail.com>2013-06-04 23:32:32 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-05 15:37:22 -0700
commitf2c3d800972670fb49bc0ebaeb02450aa591eb0a (patch)
tree3d7037ba2d239cbeccd528e8d4420422c0cd365e /drivers/staging/rtl8192u/r8192U_core.c
parentstaging: rtl8192u: remove trailing whitespace in r8192U_core.c (diff)
downloadlinux-dev-f2c3d800972670fb49bc0ebaeb02450aa591eb0a.tar.xz
linux-dev-f2c3d800972670fb49bc0ebaeb02450aa591eb0a.zip
staging: rtl8192u: replace macro rx_hal_is_cck_rate() in r8192U_core.c
This patch replaces macro rx_hal_is_cck_rate() with the static inline function rx_hal_is_cck_rate(). This replacement was suggested by Dan Carpenter and has the following benefits: - improves code readability - guarantees type safety - improves code efficiency by enforcing the evaluation of the simple boolean expression (!pdrvinfo->RxHT) to be done before the evaluation of the more complex one (pdrvinfo->RxRate == DESC90_RATE1M || pdrvinfo->RxRate == DESC90_RATE2M || pdrvinfo->RxRate == DESC90_RATE5_5M || pdrvinfo->RxRate == DESC90_RATE11M) Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8192u/r8192U_core.c')
-rw-r--r--drivers/staging/rtl8192u/r8192U_core.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index 7037ff64daa2..74d2d7767650 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -236,12 +236,6 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv *priv)
}
-#define rx_hal_is_cck_rate(_pdrvinfo)\
- (_pdrvinfo->RxRate == DESC90_RATE1M ||\
- _pdrvinfo->RxRate == DESC90_RATE2M ||\
- _pdrvinfo->RxRate == DESC90_RATE5_5M ||\
- _pdrvinfo->RxRate == DESC90_RATE11M) &&\
- !_pdrvinfo->RxHT\
void CamResetAllEntry(struct net_device *dev)
@@ -4228,6 +4222,22 @@ long rtl819x_signal_scale_mapping(long currsig)
return retsig;
}
+static inline bool rx_hal_is_cck_rate(struct rx_drvinfo_819x_usb *pdrvinfo)
+{
+ if (pdrvinfo->RxHT)
+ return false;
+
+ switch (pdrvinfo->RxRate) {
+ case DESC90_RATE1M:
+ case DESC90_RATE2M:
+ case DESC90_RATE5_5M:
+ case DESC90_RATE11M:
+ return true;
+ default:
+ return false;
+ }
+}
+
static void rtl8192_query_rxphystatus(struct r8192_priv *priv,
struct ieee80211_rx_stats *pstats,
rx_drvinfo_819x_usb *pdrvinfo,