From 2b1d8aa305ea981271350489ef8b0dbdc5e98e29 Mon Sep 17 00:00:00 2001 From: sos Date: Tue, 25 Feb 2003 14:46:30 +0000 Subject: [PATCH] Properly teardown the interrupt so we wont panic on detach. --- sys/dev/ata/ata-pci.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c index 065e0b0673cb..01f25274ada4 100644 --- a/sys/dev/ata/ata-pci.c +++ b/sys/dev/ata/ata-pci.c @@ -363,13 +363,13 @@ ata_pci_setup_intr(device_t dev, device_t child, struct resource *irq, #endif } else { - struct ata_pci_controller *controller = device_get_softc(dev); - int unit = ((struct ata_channel *)device_get_softc(child))->unit; + struct ata_pci_controller *controller = device_get_softc(dev); + int unit = ((struct ata_channel *)device_get_softc(child))->unit; - controller->interrupt[unit].function = function; - controller->interrupt[unit].argument = argument; - *cookiep = controller; - return 0; + controller->interrupt[unit].function = function; + controller->interrupt[unit].argument = argument; + *cookiep = controller; + return 0; } } @@ -384,8 +384,14 @@ ata_pci_teardown_intr(device_t dev, device_t child, struct resource *irq, return BUS_TEARDOWN_INTR(device_get_parent(dev), child, irq, cookie); #endif } - else + else { + struct ata_pci_controller *controller = device_get_softc(dev); + int unit = ((struct ata_channel *)device_get_softc(child))->unit; + + controller->interrupt[unit].function = NULL; + controller->interrupt[unit].argument = NULL; return 0; + } } static void