Skip to content

Commit cec4c1c

Browse files
Michael Karcherdavem330
authored andcommitted
net-next: ax88796: add interrupt status callback to platform data
To be able to tell the ax88796 driver whether it is sensible to enter the 8390 interrupt handler, an "is this interrupt caused by the 88796" callback has been added to the ax_plat_data structure (with NULL being compatible to the previous behaviour). Signed-off-by: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de> Signed-off-by: Michael Schmitz <schmitzmic@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 27cced2 commit cec4c1c

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

drivers/net/ethernet/8390/ax88796.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,21 @@ static void ax_reset_8390(struct net_device *dev)
163163
ei_outb(ENISR_RESET, addr + EN0_ISR); /* Ack intr. */
164164
}
165165

166+
/* Wrapper for __ei_interrupt for platforms that have a platform-specific
167+
* way to find out whether the interrupt request might be caused by
168+
* the ax88796 chip.
169+
*/
170+
static irqreturn_t ax_ei_interrupt_filtered(int irq, void *dev_id)
171+
{
172+
struct net_device *dev = dev_id;
173+
struct ax_device *ax = to_ax_dev(dev);
174+
struct platform_device *pdev = to_platform_device(dev->dev.parent);
175+
176+
if (!ax->plat->check_irq(pdev))
177+
return IRQ_NONE;
178+
179+
return ax_ei_interrupt(irq, dev_id);
180+
}
166181

167182
static void ax_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
168183
int ring_page)
@@ -482,8 +497,12 @@ static int ax_open(struct net_device *dev)
482497
if (ret)
483498
goto failed_mii;
484499

485-
ret = request_irq(dev->irq, ax_ei_interrupt, ax->irqflags,
486-
dev->name, dev);
500+
if (ax->plat->check_irq)
501+
ret = request_irq(dev->irq, ax_ei_interrupt_filtered,
502+
ax->irqflags, dev->name, dev);
503+
else
504+
ret = request_irq(dev->irq, ax_ei_interrupt, ax->irqflags,
505+
dev->name, dev);
487506
if (ret)
488507
goto failed_request_irq;
489508

include/net/ax88796.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
struct sk_buff;
1616
struct net_device;
17+
struct platform_device;
1718

1819
#define AXFLG_HAS_EEPROM (1<<0)
1920
#define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */
@@ -35,6 +36,10 @@ struct ax_plat_data {
3536
const unsigned char *buf, int star_page);
3637
void (*block_input)(struct net_device *dev, int count,
3738
struct sk_buff *skb, int ring_offset);
39+
/* returns nonzero if a pending interrupt request might by caused by
40+
* the ax88786. Handles all interrupts if set to NULL
41+
*/
42+
int (*check_irq)(struct platform_device *pdev);
3843
};
3944

4045
#endif /* __NET_AX88796_PLAT_H */

0 commit comments

Comments
 (0)