From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
tglx@linutronix.de,
Anna-Maria Gleixner <anna-maria@linutronix.de>,
Steffen Klassert <klassert@mathematik.tu-chemnitz.de>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH 2/4] net: 3com: 3c59x: Move boomerang/vortex conditional into function
Date: Fri, 4 May 2018 17:17:47 +0200 [thread overview]
Message-ID: <20180504151749.6966-3-bigeasy@linutronix.de> (raw)
In-Reply-To: <20180504151749.6966-1-bigeasy@linutronix.de>
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
If vp->full_bus_master_tx is set, vp->full_bus_master_rx is set as well
(see vortex_probe1()). Therefore the conditionals for the decision if
boomerang or vortex ISR is executed have the same result. Instead of
repeating the explicit conditional execution of the boomerang/vortex ISR,
move it into an own function.
No functional change.
Cc: Steffen Klassert <klassert@mathematik.tu-chemnitz.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/net/ethernet/3com/3c59x.c | 34 ++++++++++++++++++-------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
index 36c8950dbd2d..0cfdb07f3e59 100644
--- a/drivers/net/ethernet/3com/3c59x.c
+++ b/drivers/net/ethernet/3com/3c59x.c
@@ -765,8 +765,9 @@ static netdev_tx_t boomerang_start_xmit(struct sk_buff *skb,
struct net_device *dev);
static int vortex_rx(struct net_device *dev);
static int boomerang_rx(struct net_device *dev);
-static irqreturn_t vortex_interrupt(int irq, void *dev_id);
-static irqreturn_t boomerang_interrupt(int irq, void *dev_id);
+static irqreturn_t vortex_boomerang_interrupt(int irq, void *dev_id);
+static irqreturn_t _vortex_interrupt(int irq, struct net_device *dev);
+static irqreturn_t _boomerang_interrupt(int irq, struct net_device *dev);
static int vortex_close(struct net_device *dev);
static void dump_tx_ring(struct net_device *dev);
static void update_stats(void __iomem *ioaddr, struct net_device *dev);
@@ -838,10 +839,9 @@ MODULE_PARM_DESC(use_mmio, "3c59x: use memory-mapped PCI I/O resource (0-1)");
#ifdef CONFIG_NET_POLL_CONTROLLER
static void poll_vortex(struct net_device *dev)
{
- struct vortex_private *vp = netdev_priv(dev);
unsigned long flags;
local_irq_save(flags);
- (vp->full_bus_master_rx ? boomerang_interrupt:vortex_interrupt)(dev->irq,dev);
+ vortex_boomerang_interrupt(dev->irq, dev);
local_irq_restore(flags);
}
#endif
@@ -1729,8 +1729,7 @@ vortex_open(struct net_device *dev)
dma_addr_t dma;
/* Use the now-standard shared IRQ implementation. */
- if ((retval = request_irq(dev->irq, vp->full_bus_master_rx ?
- boomerang_interrupt : vortex_interrupt, IRQF_SHARED, dev->name, dev))) {
+ if ((retval = request_irq(dev->irq, vortex_boomerang_interrupt, IRQF_SHARED, dev->name, dev))) {
pr_err("%s: Could not reserve IRQ %d\n", dev->name, dev->irq);
goto err;
}
@@ -1911,10 +1910,7 @@ static void vortex_tx_timeout(struct net_device *dev)
*/
unsigned long flags;
local_irq_save(flags);
- if (vp->full_bus_master_tx)
- boomerang_interrupt(dev->irq, dev);
- else
- vortex_interrupt(dev->irq, dev);
+ vortex_boomerang_interrupt(dev->irq, dev);
local_irq_restore(flags);
}
}
@@ -2267,9 +2263,8 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
*/
static irqreturn_t
-vortex_interrupt(int irq, void *dev_id)
+_vortex_interrupt(int irq, struct net_device *dev)
{
- struct net_device *dev = dev_id;
struct vortex_private *vp = netdev_priv(dev);
void __iomem *ioaddr;
int status;
@@ -2386,9 +2381,8 @@ vortex_interrupt(int irq, void *dev_id)
*/
static irqreturn_t
-boomerang_interrupt(int irq, void *dev_id)
+_boomerang_interrupt(int irq, struct net_device *dev)
{
- struct net_device *dev = dev_id;
struct vortex_private *vp = netdev_priv(dev);
void __iomem *ioaddr;
int status;
@@ -2526,6 +2520,18 @@ boomerang_interrupt(int irq, void *dev_id)
return IRQ_RETVAL(handled);
}
+static irqreturn_t
+vortex_boomerang_interrupt(int irq, void *dev_id)
+{
+ struct net_device *dev = dev_id;
+ struct vortex_private *vp = netdev_priv(dev);
+
+ if (vp->full_bus_master_rx)
+ return _boomerang_interrupt(dev->irq, dev);
+ else
+ return _vortex_interrupt(dev->irq, dev);
+}
+
static int vortex_rx(struct net_device *dev)
{
struct vortex_private *vp = netdev_priv(dev);
--
2.17.0
next prev parent reply other threads:[~2018-05-04 15:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-04 15:17 3c59x patches and the removal of an unused function Sebastian Andrzej Siewior
2018-05-04 15:17 ` [PATCH 1/4] net: u64_stats_sync: Remove functions without user Sebastian Andrzej Siewior
2018-05-04 15:17 ` Sebastian Andrzej Siewior [this message]
2018-05-04 15:22 ` [PATCH 2/4] net: 3com: 3c59x: Move boomerang/vortex conditional into function Sebastian Andrzej Siewior
2018-05-07 10:25 ` Steffen Klassert
2018-05-04 15:17 ` [PATCH 3/4] net: 3com: 3c59x: Pull locking out of ISR Sebastian Andrzej Siewior
2018-05-04 15:17 ` [PATCH 4/4] net: 3com: 3c59x: irq save variant " Sebastian Andrzej Siewior
2018-05-08 3:26 ` 3c59x patches and the removal of an unused function David Miller
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=20180504151749.6966-3-bigeasy@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=anna-maria@linutronix.de \
--cc=davem@davemloft.net \
--cc=klassert@mathematik.tu-chemnitz.de \
--cc=netdev@vger.kernel.org \
--cc=tglx@linutronix.de \
/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