diff options
author | Tim Collier <osdevtc@gmail.com> | 2018-05-23 08:30:24 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-25 18:44:14 +0200 |
commit | df6835d1f66a27f753f93b017a5a022dbdd0d372 (patch) | |
tree | 6d4cd7f7e30062b71e47d02f06a8323268316472 | |
parent | 67d412e44df5850522b7f9c2734e1c84ff89eaf7 (diff) |
staging: wlan-ng: convert P80211SKB_FRMMETA to inline function in p80211conv
To avoid possible issues with repeated reference to the macro argument
as reported by checkpatch, macro P80211SKB_FRMMETA is replaced with an
equivalent inline function. The function is named p80211skb_frmmeta to
follow the coding style guidelines; references to the macro are
updated to reference the new function.
Signed-off-by: Tim Collier <osdevtc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/wlan-ng/p80211conv.c | 4 | ||||
-rw-r--r-- | drivers/staging/wlan-ng/p80211conv.h | 15 |
2 files changed, 10 insertions, 9 deletions
diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c index 855b424f6423..646e9c205c52 100644 --- a/drivers/staging/wlan-ng/p80211conv.c +++ b/drivers/staging/wlan-ng/p80211conv.c @@ -563,7 +563,7 @@ void p80211skb_rxmeta_detach(struct sk_buff *skb) pr_debug("Called w/ null skb.\n"); return; } - frmmeta = P80211SKB_FRMMETA(skb); + frmmeta = p80211skb_frmmeta(skb); if (!frmmeta) { /* no magic */ pr_debug("Called w/ bad frmmeta magic.\n"); return; @@ -654,7 +654,7 @@ void p80211skb_free(struct wlandevice *wlandev, struct sk_buff *skb) { struct p80211_frmmeta *meta; - meta = P80211SKB_FRMMETA(skb); + meta = p80211skb_frmmeta(skb); if (meta && meta->rx) p80211skb_rxmeta_detach(skb); else diff --git a/drivers/staging/wlan-ng/p80211conv.h b/drivers/staging/wlan-ng/p80211conv.h index 5c1c35c6e02d..c3456b7eff04 100644 --- a/drivers/staging/wlan-ng/p80211conv.h +++ b/drivers/staging/wlan-ng/p80211conv.h @@ -63,14 +63,8 @@ #define P80211_FRMMETA_MAGIC 0x802110 -#define P80211SKB_FRMMETA(s) \ - (((((struct p80211_frmmeta *)((s)->cb))->magic) == \ - P80211_FRMMETA_MAGIC) ? \ - ((struct p80211_frmmeta *)((s)->cb)) : \ - (NULL)) - #define P80211SKB_RXMETA(s) \ - (P80211SKB_FRMMETA((s)) ? P80211SKB_FRMMETA((s))->rx : \ + (p80211skb_frmmeta((s)) ? p80211skb_frmmeta((s))->rx : \ ((struct p80211_rxmeta *)(NULL))) struct p80211_rxmeta { @@ -98,6 +92,13 @@ void p80211skb_free(struct wlandevice *wlandev, struct sk_buff *skb); int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb); void p80211skb_rxmeta_detach(struct sk_buff *skb); +static inline struct p80211_frmmeta *p80211skb_frmmeta(struct sk_buff *skb) +{ + struct p80211_frmmeta *frmmeta = (struct p80211_frmmeta *)skb->cb; + + return frmmeta->magic == P80211_FRMMETA_MAGIC ? frmmeta : NULL; +} + /* * Frame capture header. (See doc/capturefrm.txt) */ |