public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, davem@davemloft.net,
	tony@bakeyournoodle.com, mmarek@suse.cz, lacombar@gmail.com,
	Paul Gortmaker <paul.gortmaker@windriver.com>
Subject: [PATCH 3/5] drivers/net: remove IS_ENABLED usage from wiznet drivers
Date: Wed, 11 Apr 2012 19:50:55 -0400	[thread overview]
Message-ID: <1334188257-3449-4-git-send-email-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <1334188257-3449-1-git-send-email-paul.gortmaker@windriver.com>

The use of IS_ENABLED in C code (vs just in CPP #if directives)
causes us to carry the burden of a huge autoconf.h file.  It is
also misleading in that a casual inspection of the code would
leave one thinking that the if statements were evaluated at
runtime, when TX_FLOW is a Kconfig bool and hence evaluated
at configure time as an either/or.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/net/ethernet/wiznet/w5100.c |    9 ++++++---
 drivers/net/ethernet/wiznet/w5300.c |   18 ++++++++++++------
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c
index c28e1d5..fdac57d 100644
--- a/drivers/net/ethernet/wiznet/w5100.c
+++ b/drivers/net/ethernet/wiznet/w5100.c
@@ -441,8 +441,9 @@ static int w5100_start_tx(struct sk_buff *skb, struct net_device *ndev)
 	struct w5100_priv *priv = netdev_priv(ndev);
 	u16 offset;
 
-	if (IS_ENABLED(CONFIG_WIZNET_TX_FLOW))
-		netif_stop_queue(ndev);
+#ifdef CONFIG_WIZNET_TX_FLOW
+	netif_stop_queue(ndev);
+#endif
 
 	offset = w5100_read16(priv, W5100_S0_TX_WR);
 	w5100_writebuf(priv, offset, skb->data, skb->len);
@@ -517,10 +518,12 @@ static irqreturn_t w5100_interrupt(int irq, void *ndev_instance)
 	w5100_write(priv, W5100_S0_IR, ir);
 	mmiowb();
 
-	if (IS_ENABLED(CONFIG_WIZNET_TX_FLOW) && (ir & S0_IR_SENDOK)) {
+#ifdef CONFIG_WIZNET_TX_FLOW
+	if (ir & S0_IR_SENDOK) {
 		netif_dbg(priv, tx_done, ndev, "tx done\n");
 		netif_wake_queue(ndev);
 	}
+#endif
 
 	if (ir & S0_IR_RECV) {
 		if (napi_schedule_prep(&priv->napi)) {
diff --git a/drivers/net/ethernet/wiznet/w5300.c b/drivers/net/ethernet/wiznet/w5300.c
index 88afde9..294b3fd 100644
--- a/drivers/net/ethernet/wiznet/w5300.c
+++ b/drivers/net/ethernet/wiznet/w5300.c
@@ -73,6 +73,11 @@ MODULE_LICENSE("GPL");
 #define W5300_S0_IR		0x0206	/* S0 Interrupt Register */
 #define   S0_IR_RECV		  0x0004  /* Receive interrupt */
 #define   S0_IR_SENDOK		  0x0010  /* Send OK interrupt */
+#ifdef CONFIG_WIZNET_TX_FLOW
+#define   S0_IR_FLAGS		  (S0_IR_RECV | S0_IR_SENDOK)
+#else
+#define   S0_IR_FLAGS		  S0_IR_RECV
+#endif
 #define W5300_S0_SSR		0x0208	/* S0 Socket Status Register */
 #define W5300_S0_TX_WRSR	0x0220	/* S0 TX Write Size Register */
 #define W5300_S0_TX_FSR		0x0224	/* S0 TX Free Size Register */
@@ -273,9 +278,7 @@ static void w5300_hw_start(struct w5300_priv *priv)
 			  S0_MR_MACRAW : S0_MR_MACRAW_MF);
 	mmiowb();
 	w5300_command(priv, S0_CR_OPEN);
-	w5300_write(priv, W5300_S0_IMR, IS_ENABLED(CONFIG_WIZNET_TX_FLOW) ?
-					S0_IR_RECV | S0_IR_SENDOK :
-					S0_IR_RECV);
+	w5300_write(priv, W5300_S0_IMR, S0_IR_FLAGS);
 	w5300_write(priv, W5300_IMR, IR_S0);
 	mmiowb();
 }
@@ -371,8 +374,9 @@ static int w5300_start_tx(struct sk_buff *skb, struct net_device *ndev)
 {
 	struct w5300_priv *priv = netdev_priv(ndev);
 
-	if (IS_ENABLED(CONFIG_WIZNET_TX_FLOW))
-		netif_stop_queue(ndev);
+#ifdef CONFIG_WIZNET_TX_FLOW
+	netif_stop_queue(ndev);
+#endif
 
 	w5300_write_frame(priv, skb->data, skb->len);
 	mmiowb();
@@ -439,10 +443,12 @@ static irqreturn_t w5300_interrupt(int irq, void *ndev_instance)
 	w5300_write(priv, W5300_S0_IR, ir);
 	mmiowb();
 
-	if (IS_ENABLED(CONFIG_WIZNET_TX_FLOW) && (ir & S0_IR_SENDOK)) {
+#ifdef CONFIG_WIZNET_TX_FLOW
+	if (ir & S0_IR_SENDOK) {
 		netif_dbg(priv, tx_done, ndev, "tx done\n");
 		netif_wake_queue(ndev);
 	}
+#endif
 
 	if (ir & S0_IR_RECV) {
 		if (napi_schedule_prep(&priv->napi)) {
-- 
1.7.9.1


  parent reply	other threads:[~2012-04-11 23:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11 23:50 [PATCH 0/5] RFC: strip 15,000 lines from a typical autoconf.h Paul Gortmaker
2012-04-11 23:50 ` [PATCH 1/5] Revert "mm: replace PAGE_MIGRATION with IS_ENABLED(CONFIG_MIGRATION)" Paul Gortmaker
2012-04-12  0:05   ` Andrew Morton
2012-04-11 23:50 ` [PATCH 2/5] ARM: remove C users of IS_ENABLED on THUMB2_KERNEL Paul Gortmaker
2012-04-11 23:50 ` Paul Gortmaker [this message]
2012-04-11 23:54   ` [PATCH 3/5] drivers/net: remove IS_ENABLED usage from wiznet drivers David Miller
2012-04-12  0:06     ` Stephen Rothwell
2012-04-12  0:22       ` Stephen Rothwell
2012-04-12 17:15     ` Paul Gortmaker
2012-04-11 23:50 ` [PATCH 4/5] Revert "kconfig: fix __enabled_ macros definition for invisible and un-selected symbols" Paul Gortmaker
2012-04-11 23:50 ` [PATCH 5/5] kconfig: limit IS_ENABLED & similar to CPP usage Paul Gortmaker
2012-04-12  0:04   ` Linus Torvalds
2012-04-12 17:46     ` Paul Gortmaker
2012-04-11 23:58 ` [PATCH 0/5] RFC: strip 15,000 lines from a typical autoconf.h Linus Torvalds
2012-04-12  1:19   ` Linus Torvalds
2012-04-12  1:45     ` Andrew Morton
2012-04-12  1:55       ` Linus Torvalds
2012-04-12  3:10         ` Stephen Rothwell
2012-04-12 19:29           ` Linus Torvalds
2012-04-12 23:46             ` [PATCH 0/3] RFC v2: " Paul Gortmaker
2012-04-12 23:46               ` [PATCH 1/3] kconfig: fix IS_ENABLED to not require all options to be defined Paul Gortmaker
2012-04-12 23:46               ` [PATCH 2/3] Revert "kconfig: fix __enabled_ macros definition for invisible and un-selected symbols" Paul Gortmaker
2012-04-12 23:46               ` [PATCH 3/3] kconfig: delete last traces of __enabled_ from autoconf.h Paul Gortmaker
2012-04-12  9:27     ` [PATCH 0/5] RFC: strip 15,000 lines from a typical autoconf.h Michal Marek

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=1334188257-3449-4-git-send-email-paul.gortmaker@windriver.com \
    --to=paul.gortmaker@windriver.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=lacombar@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=tony@bakeyournoodle.com \
    --cc=torvalds@linux-foundation.org \
    /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