From: Sergio Paracuellos Date: Thu, 29 Mar 2018 18:07:51 +0000 (+0200) Subject: staging: ks7010: replace IS_11B_RATE macro with inline function X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b67cd79f38c6afe2f355c01c569a5c7c58cc1c06;p=openwrt%2Fstaging%2Fblogic.git staging: ks7010: replace IS_11B_RATE macro with inline function This commit replaces IS_11B_RATE macro with is_11b_rate inline function to improve readability. It also fix a checkpatch script warning because a line with more than 80 spaces. Signed-off-by: Sergio Paracuellos Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 676961cf4103..9f6d49e04d87 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -1884,7 +1884,7 @@ void hostif_sme_mode_setup(struct ks_wlan_private *priv) /* rate mask by phy setting */ if (priv->reg.phy_type == D_11B_ONLY_MODE) { for (i = 0; i < priv->reg.rate_set.size; i++) { - if (!IS_11B_RATE(priv->reg.rate_set.body[i])) + if (!is_11b_rate(priv->reg.rate_set.body[i])) break; if ((priv->reg.rate_set.body[i] & RATE_MASK) >= TX_RATE_5M) { diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index 2f918b11b337..ae2adbf9b8a6 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -556,15 +556,20 @@ struct hostif_mic_failure_confirm_t { #define TX_RATE_48M (uint8_t)(480 / 5) #define TX_RATE_54M (uint8_t)(540 / 5) -#define IS_11B_RATE(A) (((A & RATE_MASK) == TX_RATE_1M) || ((A & RATE_MASK) == TX_RATE_2M) || \ - ((A & RATE_MASK) == TX_RATE_5M) || ((A & RATE_MASK) == TX_RATE_11M)) +static inline bool is_11b_rate(u8 rate) +{ + return (((rate & RATE_MASK) == TX_RATE_1M) || + ((rate & RATE_MASK) == TX_RATE_2M) || + ((rate & RATE_MASK) == TX_RATE_5M) || + ((rate & RATE_MASK) == TX_RATE_11M)); +} #define IS_OFDM_RATE(A) (((A & RATE_MASK) == TX_RATE_6M) || ((A & RATE_MASK) == TX_RATE_12M) || \ ((A & RATE_MASK) == TX_RATE_24M) || ((A & RATE_MASK) == TX_RATE_9M) || \ ((A & RATE_MASK) == TX_RATE_18M) || ((A & RATE_MASK) == TX_RATE_36M) || \ ((A & RATE_MASK) == TX_RATE_48M) || ((A & RATE_MASK) == TX_RATE_54M)) -#define IS_11BG_RATE(A) (IS_11B_RATE(A) || IS_OFDM_RATE(A)) +#define IS_11BG_RATE(A) (is_11b_rate(A) || IS_OFDM_RATE(A)) #define IS_OFDM_EXT_RATE(A) (((A & RATE_MASK) == TX_RATE_9M) || ((A & RATE_MASK) == TX_RATE_18M) || \ ((A & RATE_MASK) == TX_RATE_36M) || ((A & RATE_MASK) == TX_RATE_48M) || \