Skip to contentSkip to conversation

staging: most: convert macro to static function

PATCH New George Edward Bulmer 1 participant 1 message Dec 29, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: most: convert macro to static function

This fixes checkpatch warning:
CHECK: Macro argument reuse 'buf' - possible side effects?

---
 drivers/staging/most/net/net.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/staging/most/net/net.c +7 -5
index 33606584e50e..30d816b7e165 100644
@@ -46,10 +46,12 @@
 	((len) > MEP_HDR_LEN && \
 	 EXTRACT_BIT_SET(PMS_FIFONO, (buf)[3]) == PMS_FIFONO_MEP)
 
-#define PMS_IS_MAMAC(buf, len) \
-	((len) > MDP_HDR_LEN && \
-	 EXTRACT_BIT_SET(PMS_FIFONO, (buf)[3]) == PMS_FIFONO_MDP && \
-	 EXTRACT_BIT_SET(PMS_TELID, (buf)[14]) == PMS_TELID_UNSEGM_MAMAC)
+static inline bool pms_is_mamac(char *buf, u32 len)
+{
+	return (len > MDP_HDR_LEN &&
+		EXTRACT_BIT_SET(PMS_FIFONO, buf[3]) == PMS_FIFONO_MDP &&
+		EXTRACT_BIT_SET(PMS_TELID, buf[14]) == PMS_TELID_UNSEGM_MAMAC);
+}
 
 struct net_dev_channel {
 	bool linked;
@@ -435,7 +437,7 @@ static int comp_rx_data(struct mbo *mbo)
 	dev = nd->dev;
 
 	if (nd->is_mamac) {
-		if (!PMS_IS_MAMAC(buf, len)) {
+		if (!pms_is_mamac(buf, len)) {
 			ret = -EIO;
 			goto put_nd;
 		}
Signature · 1 line
2.15.1