BUG-fix for ftape (1.3.73)

Hans Lermen (lermen@elserv.ffm.fgan.de)
Wed, 13 Mar 1996 11:16:20 +0100 (MET)


Hi,

The IRQ used by ftape gets not freed after usage, so you will get
"resource busy" on subsequent accesses. I you nevertheless unload
the module, the kernel will Ooops when doing a 'cat /proc/interrupts'.
( id-string pointing to nirvana )

I suspect also some other drivers not beeing uptodate with the latest
request_/free_ -irq stuff.
NOTE: the additional "dev_id" parameter must be equal for request_irq
and free_irq, else the IRQ will not be freed. The _value_ of the
pointer is compared, _not_ the contents !

A patch for a fix is appended.

So long,
Hans
<lermen@elserv.ffm.fgan.de>

----------------------------------------------------------------------------
--- linux-1.3.73-clean/drivers/char/ftape/fdc-io.c Fri Mar 8 22:32:21 1996
+++ linux/drivers/char/ftape/fdc-io.c Wed Mar 13 11:04:15 1996
@@ -1175,17 +1175,18 @@
TRACE_EXIT;
}

+static char ftape_id[] = "ftape";
+
int fdc_grab_irq_and_dma(void)
{
TRACE_FUN(8, "fdc_grab_irq_and_dma");
int result = 0;
- static char ftape_id[] = "ftape";

if (fdc.hook == &do_ftape) {
/* Get fast interrupt handler.
*/
result = request_irq(fdc.irq, ftape_interrupt, SA_INTERRUPT,
- "ftape", ftape_id);
+ ftape_id, ftape_id);
if (result) {
TRACEx1(-1, "Unable to grab IRQ%d for ftape driver", fdc.irq);
result = -EIO;
@@ -1193,7 +1194,7 @@
result = request_dma(fdc.dma, ftape_id);
if (result) {
TRACEx1(-1, "Unable to grab DMA%d for ftape driver", fdc.dma);
- free_irq(fdc.irq, NULL);
+ free_irq(fdc.irq, ftape_id);
result = -EIO;
} else {
enable_irq(fdc.irq);
@@ -1224,7 +1225,7 @@
disable_dma(fdc.dma); /* just in case... */
free_dma(fdc.dma);
disable_irq(fdc.irq);
- free_irq(fdc.irq, NULL);
+ free_irq(fdc.irq, ftape_id);
}
#ifdef FDC_DMA
if (result == 0 && FDC_DMA == 2) {
----------------------------------------------------------------------------