From 173ffd0993fd3e6ec7e0e24424350a807605e6d0 Mon Sep 17 00:00:00 2001 From: Tim Collier Date: Wed, 23 May 2018 08:30:25 +0100 Subject: [PATCH] staging: wlan-ng: convert P80211SKB_RXMETA to inline function in p80211conv To avoid possible issues with repeated reference to the macro argument as reported by checkpatch, macro P80211SKB_RXMETA is replaced with an equivalent inline function. The function is named p80211skb_rxmeta to follow the coding style guidelines; references to the macro are updated to reference the new function. This change depends on the similar change for P80211SKB_FRMMETA having been applied. Signed-off-by: Tim Collier Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/hfa384x_usb.c | 2 +- drivers/staging/wlan-ng/p80211conv.c | 4 ++-- drivers/staging/wlan-ng/p80211conv.h | 11 +++++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c index c1e88b8..33e97ff 100644 --- a/drivers/staging/wlan-ng/hfa384x_usb.c +++ b/drivers/staging/wlan-ng/hfa384x_usb.c @@ -3417,7 +3417,7 @@ static void hfa384x_usbin_rx(struct wlandevice *wlandev, struct sk_buff *skb) /* Attach the rxmeta, set some stuff */ p80211skb_rxmeta_attach(wlandev, skb); - rxmeta = P80211SKB_RXMETA(skb); + rxmeta = p80211skb_rxmeta(skb); rxmeta->mactime = usbin->rxfrm.desc.time; rxmeta->rxrate = usbin->rxfrm.desc.rate; rxmeta->signal = usbin->rxfrm.desc.signal - hw->dbmadjust; diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c index 646e9c2..91debcf2 100644 --- a/drivers/staging/wlan-ng/p80211conv.c +++ b/drivers/staging/wlan-ng/p80211conv.c @@ -497,7 +497,7 @@ int skb_p80211_to_ether(struct wlandevice *wlandev, u32 ethconv, /* jkriegl: only process signal/noise if requested by iwspy */ if (wlandev->spy_number) orinoco_spy_gather(wlandev, eth_hdr(skb)->h_source, - P80211SKB_RXMETA(skb)); + p80211skb_rxmeta(skb)); /* Free the metadata */ p80211skb_rxmeta_detach(skb); @@ -605,7 +605,7 @@ int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb) struct p80211_frmmeta *frmmeta; /* If these already have metadata, we error out! */ - if (P80211SKB_RXMETA(skb)) { + if (p80211skb_rxmeta(skb)) { netdev_err(wlandev->netdev, "%s: RXmeta already attached!\n", wlandev->name); result = 0; diff --git a/drivers/staging/wlan-ng/p80211conv.h b/drivers/staging/wlan-ng/p80211conv.h index c3456b7..827002c 100644 --- a/drivers/staging/wlan-ng/p80211conv.h +++ b/drivers/staging/wlan-ng/p80211conv.h @@ -63,10 +63,6 @@ #define P80211_FRMMETA_MAGIC 0x802110 -#define P80211SKB_RXMETA(s) \ - (p80211skb_frmmeta((s)) ? p80211skb_frmmeta((s))->rx : \ - ((struct p80211_rxmeta *)(NULL))) - struct p80211_rxmeta { struct wlandevice *wlandev; @@ -99,6 +95,13 @@ static inline struct p80211_frmmeta *p80211skb_frmmeta(struct sk_buff *skb) return frmmeta->magic == P80211_FRMMETA_MAGIC ? frmmeta : NULL; } +static inline struct p80211_rxmeta *p80211skb_rxmeta(struct sk_buff *skb) +{ + struct p80211_frmmeta *frmmeta = p80211skb_frmmeta(skb); + + return frmmeta ? frmmeta->rx : NULL; +} + /* * Frame capture header. (See doc/capturefrm.txt) */ -- 2.7.4