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>
This commit is contained in:
Tim Collier 2018-05-23 08:30:24 +01:00 committed by Greg Kroah-Hartman
parent 67d412e44d
commit df6835d1f6
2 changed files with 10 additions and 9 deletions

View File

@ -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

View File

@ -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)
*/