[PATCH] ide-mod oops fix

From: Eric Lammerts (eric@scintilla.utwente.nl)
Date: Wed May 10 2000 - 19:13:42 EST


This patch fixed the following problem I have with kernel 2.3.99pre7-6
(all ide stuff compiled as modules):

# modprobe ide-mod
# rmmod ide-mod
# cat /proc/ioports

This last command produces an oops. Cause: When ide-mod is loaded,
ide_setup_dma() calls request_region() for the busmaster-ide (piix4)
i/o ports. However, when ide-mod is unloaded, ide_unregister() does
not call ide_release_dma() because hwif->present == 0 for both the
primary and secondary interface (that's because ide-probe was not
loaded). So the i/o region is never released.

This patch is not very elegant but it works.

Eric

--- linux-2.3/drivers/ide/ide.c.orig Thu May 11 00:07:34 2000
+++ linux-2.3/drivers/ide/ide.c Thu May 11 01:08:03 2000
@@ -2049,8 +2049,10 @@
                 hwgroup->hwif = HWIF(hwgroup->drive);
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
- if (hwif->dma_base)
+ if (hwif->dma_base) {
                 (void) ide_release_dma(hwif);
+ hwif->dma_base = 0;
+ }
 #endif /* CONFIG_BLK_DEV_IDEDMA */
 
         /*
@@ -3652,8 +3654,13 @@
 {
         int index;
 
- for (index = 0; index < MAX_HWIFS; ++index)
+ for (index = 0; index < MAX_HWIFS; ++index) {
                 ide_unregister(index);
+#ifdef CONFIG_BLK_DEV_IDEDMA
+ if (ide_hwifs[index].dma_base)
+ (void) ide_release_dma(&ide_hwifs[index]);
+#endif /* CONFIG_BLK_DEV_IDEDMA */
+ }
 
 #ifdef CONFIG_PROC_FS
         proc_ide_destroy();

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon May 15 2000 - 21:00:16 EST