From f4d86754f956ab5ea73aa91759a0d89a2f0e3f2a Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Wed, 2 May 2007 12:55:56 +1000 Subject: SONIC interrupt handling Install the built-in macsonic interrupt handler on both IRQs when using via_alt_mapping. Otherwise the rare interrupt that still comes from the nubus slot will wedge the nubus. $ cat /proc/interrupts auto 2: 89176 via2 auto 3: 744367 sonic auto 4: 0 scc auto 6: 318363 via1 auto 7: 0 NMI mac 9: 119413 framebuffer vbl mac 10: 1971 ADB mac 14: 198517 timer mac 17: 89104 nubus mac 19: 72 Mac ESP SCSI mac 56: 629 sonic mac 62: 1142593 ide0 Version 1 of this patch had a bug where a nubus sonic card would register two interrupt handlers. Only a built-in sonic needs both. Versions 2 and 3 needed some cleanups, as Raylynn Knight and Christoph Hellwig pointed out (thanks). Signed-off-by: Finn Thain Signed-off-by: Linus Torvalds --- drivers/net/jazzsonic.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'drivers/net/jazzsonic.c') diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c index 1a73630..75f6f44 100644 --- a/drivers/net/jazzsonic.c +++ b/drivers/net/jazzsonic.c @@ -88,6 +88,23 @@ static unsigned short known_revisions[] = 0xffff /* end of list */ }; +static int jazzsonic_open(struct net_device* dev) +{ + if (request_irq(dev->irq, &sonic_interrupt, IRQF_DISABLED, "sonic", dev)) { + printk(KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, dev->irq); + return -EAGAIN; + } + return sonic_open(dev); +} + +static int jazzsonic_close(struct net_device* dev) +{ + int err; + err = sonic_close(dev); + free_irq(dev->irq, dev); + return err; +} + static int __init sonic_probe1(struct net_device *dev) { static unsigned version_printed; @@ -169,8 +186,8 @@ static int __init sonic_probe1(struct net_device *dev) lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD * SONIC_NUM_RDS * SONIC_BUS_SCALE(lp->dma_bitmode)); - dev->open = sonic_open; - dev->stop = sonic_close; + dev->open = jazzsonic_open; + dev->stop = jazzsonic_close; dev->hard_start_xmit = sonic_send_packet; dev->get_stats = sonic_get_stats; dev->set_multicast_list = &sonic_multicast_list; @@ -260,8 +277,6 @@ MODULE_DESCRIPTION("Jazz SONIC ethernet driver"); module_param(sonic_debug, int, 0); MODULE_PARM_DESC(sonic_debug, "jazzsonic debug level (1-4)"); -#define SONIC_IRQ_FLAG IRQF_DISABLED - #include "sonic.c" static int __devexit jazz_sonic_device_remove (struct platform_device *pdev) -- cgit v1.1