From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Andrzej Siewior Subject: [PATCH 3/4] net: 3com: 3c59x: Pull locking out of ISR Date: Fri, 4 May 2018 17:17:48 +0200 Message-ID: <20180504151749.6966-4-bigeasy@linutronix.de> References: <20180504151749.6966-1-bigeasy@linutronix.de> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Cc: "David S. Miller" , tglx@linutronix.de, Anna-Maria Gleixner , Steffen Klassert , Sebastian Andrzej Siewior To: netdev@vger.kernel.org Return-path: Received: from Galois.linutronix.de ([146.0.238.70]:41157 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751470AbeEDPSH (ORCPT ); Fri, 4 May 2018 11:18:07 -0400 In-Reply-To: <20180504151749.6966-1-bigeasy@linutronix.de> Sender: netdev-owner@vger.kernel.org List-ID: From: Anna-Maria Gleixner Locking is done in the same way in _vortex_interrupt() and _boomerang_interrupt(). To prevent duplication, move the locking into the calling vortex_boomerang_interrupt() function. No functional change. Cc: Steffen Klassert Signed-off-by: Anna-Maria Gleixner Signed-off-by: Sebastian Andrzej Siewior --- drivers/net/ethernet/3com/3c59x.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/= 3c59x.c index 0cfdb07f3e59..fdafe25da153 100644 --- a/drivers/net/ethernet/3com/3c59x.c +++ b/drivers/net/ethernet/3com/3c59x.c @@ -2273,7 +2273,6 @@ _vortex_interrupt(int irq, struct net_device *dev) unsigned int bytes_compl =3D 0, pkts_compl =3D 0; =20 ioaddr =3D vp->ioaddr; - spin_lock(&vp->lock); =20 status =3D ioread16(ioaddr + EL3_STATUS); =20 @@ -2371,7 +2370,6 @@ _vortex_interrupt(int irq, struct net_device *dev) pr_debug("%s: exiting interrupt, status %4.4x.\n", dev->name, status); handler_exit: - spin_unlock(&vp->lock); return IRQ_RETVAL(handled); } =20 @@ -2392,12 +2390,6 @@ _boomerang_interrupt(int irq, struct net_device *dev) =20 ioaddr =3D vp->ioaddr; =20 - - /* - * It seems dopey to put the spinlock this early, but we could race again= st vortex_tx_timeout - * and boomerang_start_xmit - */ - spin_lock(&vp->lock); vp->handling_irq =3D 1; =20 status =3D ioread16(ioaddr + EL3_STATUS); @@ -2516,7 +2508,6 @@ _boomerang_interrupt(int irq, struct net_device *dev) dev->name, status); handler_exit: vp->handling_irq =3D 0; - spin_unlock(&vp->lock); return IRQ_RETVAL(handled); } =20 @@ -2525,11 +2516,18 @@ vortex_boomerang_interrupt(int irq, void *dev_id) { struct net_device *dev =3D dev_id; struct vortex_private *vp =3D netdev_priv(dev); + irqreturn_t ret; + + spin_lock(&vp->lock); =20 if (vp->full_bus_master_rx) - return _boomerang_interrupt(dev->irq, dev); + ret =3D _boomerang_interrupt(dev->irq, dev); else - return _vortex_interrupt(dev->irq, dev); + ret =3D _vortex_interrupt(dev->irq, dev); + + spin_unlock(&vp->lock); + + return ret; } =20 static int vortex_rx(struct net_device *dev) --=20 2.17.0