[PATCH 1/2] staging: wlan-ng: convert P80211SKB_FRMMETA to inline function in p80211conv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 drivers/staging/wlan-ng/p80211conv.c |  4 ++--
 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)
  */
-- 
2.11.0

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux