Skip to content

Commit a20a28b

Browse files
author
Francois Romieu
committed
via-rhine: balance interrupt acknowledge and events retrieval.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
1 parent 269f311 commit a20a28b

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

‎drivers/net/ethernet/via/via-rhine.c‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,8 @@ do { \
508508
1024 - i, __func__, __LINE__); \
509509
} while (0)
510510

511-
static inline u32 get_intr_status(struct net_device *dev)
511+
static u32 rhine_get_events(struct rhine_private *rp)
512512
{
513-
struct rhine_private *rp = netdev_priv(dev);
514513
void __iomem *ioaddr = rp->base;
515514
u32 intr_status;
516515

@@ -521,6 +520,16 @@ static inline u32 get_intr_status(struct net_device *dev)
521520
return intr_status;
522521
}
523522

523+
static void rhine_ack_events(struct rhine_private *rp, u32 mask)
524+
{
525+
void __iomem *ioaddr = rp->base;
526+
527+
if (rp->quirks & rqStatusWBRace)
528+
iowrite8(mask >> 16, ioaddr + IntrStatus2);
529+
iowrite16(mask, ioaddr + IntrStatus);
530+
IOSYNC;
531+
}
532+
524533
/*
525534
* Get power related registers into sane state.
526535
* Notify user about past WOL event.
@@ -1580,14 +1589,11 @@ static irqreturn_t rhine_interrupt(int irq, void *dev_instance)
15801589
int boguscnt = max_interrupt_work;
15811590
int handled = 0;
15821591

1583-
while ((intr_status = get_intr_status(dev))) {
1592+
while ((intr_status = rhine_get_events(rp))) {
15841593
handled = 1;
15851594

15861595
/* Acknowledge all of the current interrupt sources ASAP. */
1587-
if (intr_status & IntrTxDescRace)
1588-
iowrite8(0x08, ioaddr + IntrStatus2);
1589-
iowrite16(intr_status & 0xffff, ioaddr + IntrStatus);
1590-
IOSYNC;
1596+
rhine_ack_events(rp, intr_status);
15911597

15921598
if (debug > 4)
15931599
netdev_dbg(dev, "Interrupt, status %08x\n",
@@ -1872,7 +1878,7 @@ static void rhine_restart_tx(struct net_device *dev) {
18721878
* If new errors occurred, we need to sort them out before doing Tx.
18731879
* In that case the ISR will be back here RSN anyway.
18741880
*/
1875-
intr_status = get_intr_status(dev);
1881+
intr_status = rhine_get_events(rp);
18761882

18771883
if ((intr_status & IntrTxErrSummary) == 0) {
18781884

0 commit comments

Comments
 (0)