diff options
author | Quytelda Kahja <quytelda@tamalin.org> | 2018-02-19 22:35:37 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-02-22 14:55:08 +0100 |
commit | e4281f385b28d716493f6666db13e61849d6f798 (patch) | |
tree | 0f94924781c7786f6055678b98b4463c2f2cf844 /drivers/staging/ks7010 | |
parent | 2ec999e5545598df373dd00d32527bb11e7070c0 (diff) |
Staging: ks7010: hostif: Convert SME queue macros to real functions.
Convert the unsafe macros into inline functions.
Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ks7010')
-rw-r--r-- | drivers/staging/ks7010/ks_hostif.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 975dbbb3abd0..f554477fe6bc 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -21,13 +21,22 @@ /* Include Wireless Extension definition and check version */ #include <net/iw_handler.h> /* New driver API */ -/* macro */ -#define inc_smeqhead(priv) \ - (priv->sme_i.qhead = (priv->sme_i.qhead + 1) % SME_EVENT_BUFF_SIZE) -#define inc_smeqtail(priv) \ - (priv->sme_i.qtail = (priv->sme_i.qtail + 1) % SME_EVENT_BUFF_SIZE) -#define cnt_smeqbody(priv) \ - (((priv->sme_i.qtail + SME_EVENT_BUFF_SIZE) - (priv->sme_i.qhead)) % SME_EVENT_BUFF_SIZE) +static inline void inc_smeqhead(struct ks_wlan_private *priv) +{ + priv->sme_i.qhead = (priv->sme_i.qhead + 1) % SME_EVENT_BUFF_SIZE; +} + +static inline void inc_smeqtail(struct ks_wlan_private *priv) +{ + priv->sme_i.qtail = (priv->sme_i.qtail + 1) % SME_EVENT_BUFF_SIZE; +} + +static inline unsigned int cnt_smeqbody(struct ks_wlan_private *priv) +{ + unsigned int sme_cnt = priv->sme_i.qtail - priv->sme_i.qhead; + + return (sme_cnt + SME_EVENT_BUFF_SIZE) % SME_EVENT_BUFF_SIZE; +} #define KS_WLAN_MEM_FLAG (GFP_ATOMIC) |