mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergio Paracuellos <sergio.paracuellos@gmail.com>
To: gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	liodot@gmail.com, charrer@alacritech.com
Subject: [PATCH] staging: slicoss: change some macros into inline functions
Date: Mon, 21 Nov 2016 17:48:24 +0100	[thread overview]
Message-ID: <1479746904-15701-1-git-send-email-sergio.paracuellos@gmail.com> (raw)

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>
---
 drivers/staging/slicoss/slic.h    | 20 ++++++++++++++------
 drivers/staging/slicoss/slicoss.c |  6 +++---
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index f04d304..1f6562c 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -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 {
 	/*
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 99e9084..b6ec0a1 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -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:
-- 
1.9.1

                 reply	other threads:[~2016-11-21 16:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1479746904-15701-1-git-send-email-sergio.paracuellos@gmail.com \
    --to=sergio.paracuellos@gmail.com \
    --cc=charrer@alacritech.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liodot@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®