staging: slicoss: change some macros into inline functions
authorSergio Paracuellos <sergio.paracuellos@gmail.com>
Mon, 21 Nov 2016 16:48:24 +0000 (17:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Nov 2016 07:52:09 +0000 (08:52 +0100)
This patch changes macros into inline functions to avoid this checkpatch
check:
Macro argument 'x' may be better as '(x)' to avoid precedence issues

It also removes two macros because they aren't being used.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/slicoss/slic.h
drivers/staging/slicoss/slicoss.c

index f04d3046be407b399d7ee85d10be4f59d1354bba..1f6562c691fc310a3b1e5a3a17ec6b1582555726 100644 (file)
@@ -215,12 +215,20 @@ struct mcast_address {
 #define MAC_LOOPBACK     0x00000010
 #define MAC_ALLMCAST     0x00000020
 
-#define SLIC_DUPLEX(x)    ((x == LINK_FULLD) ? "FDX" : "HDX")
-#define SLIC_SPEED(x)     ((x == LINK_100MB) ? "100Mb" : ((x == LINK_1000MB) ?\
-                               "1000Mb" : " 10Mb"))
-#define SLIC_LINKSTATE(x) ((x == LINK_DOWN) ? "Down" : "Up  ")
-#define SLIC_ADAPTER_STATE(x) ((x == ADAPT_UP) ? "UP" : "Down")
-#define SLIC_CARD_STATE(x)    ((x == CARD_UP) ? "UP" : "Down")
+static inline const char *slic_linkstate(unsigned char x)
+{
+       return ((x == LINK_DOWN) ? "Down" : "Up  ");
+}
+
+static inline const char *slic_adapter_state(unsigned char x)
+{
+       return ((x == ADAPT_UP) ? "UP" : "Down");
+}
+
+static inline const char *slic_card_state(uint x)
+{
+       return ((x == CARD_UP) ? "UP" : "Down");
+}
 
 struct slic_iface_stats {
        /*
index 99e9084200ed39bf5e535c807ab690db1460ae5f..b6ec0a1fc33e9d06044689136e18a0a9a2433ba5 100644 (file)
@@ -1806,10 +1806,10 @@ static void slic_xmit_fail(struct adapter *adapter,
                        dev_err(&adapter->netdev->dev,
                                "reject xmit skb[%p: %x] linkstate[%s] adapter[%s:%d] card[%s:%d]\n",
                                skb, skb->pkt_type,
-                               SLIC_LINKSTATE(adapter->linkstate),
-                               SLIC_ADAPTER_STATE(adapter->state),
+                               slic_linkstate(adapter->linkstate),
+                               slic_adapter_state(adapter->state),
                                adapter->state,
-                               SLIC_CARD_STATE(adapter->card->state),
+                               slic_card_state(adapter->card->state),
                                adapter->card->state);
                        break;
                case XMIT_FAIL_ZERO_LENGTH: