ok - the following patches now give correct resource handling for
the initio scsi drivers (both: i9100u and a100u2w) - in detail:
* add dev_id field to the request_irq of the a100 driver
(instead of NULL)
* add a _release function to both drivers for proper release of
the requested resources on module unload
* move the request_region in both drivers below the init_ routines
so that the baseadress used in request_region is defined (before
it was always 0 and thus the request_region silently failed)
now everything works fine as far as i can see (tested both drivers)
i'll also append a second patch here which fixes a simple typo in
drivers/ide/ide-disk.c ...
a lot of thanks to alan cox for pointing me into the right
direction ...
t
ok - now the patches (they are against 2.3.99-pre8 but should
also work fine against 2.2.x i assume):
--- inia100.c.org Mon May 22 15:39:34 2000
+++ inia100.c Mon May 22 15:43:07 2000
@@ -370,7 +370,6 @@
memset((unsigned char *) pHCB->HCS_virEscbArray, 0, sz);
pHCB->HCS_physEscbArray = (U32) VIRT_TO_BUS(pHCB->HCS_virEscbArray);
- request_region(pHCB->HCS_Base, 0x100, "inia100"); /* Register */
get_orcPCIConfig(pHCB, i);
dBiosAdr = pHCB->HCS_BIOS;
@@ -382,6 +381,8 @@
printk("inia100: initial orchid fail!!\n");
return (0);
}
+ request_region(pHCB->HCS_Base, 256, "inia100"); /* Register */
+
hreg = scsi_register(tpnt, sizeof(ORC_HCS));
if (hreg == NULL) {
printk("Invalid scsi_register pointer.\n");
@@ -411,28 +412,28 @@
/* Initial orc chip */
switch (i) {
case 0:
- ok = request_irq(pHCB->HCS_Intr, inia100_intr0, SA_INTERRUPT | SA_SHIRQ, "inia100", NULL);
+ ok = request_irq(pHCB->HCS_Intr, inia100_intr0, SA_INTERRUPT | SA_SHIRQ, "inia100", hreg);
break;
case 1:
- ok = request_irq(pHCB->HCS_Intr, inia100_intr1, SA_INTERRUPT | SA_SHIRQ, "inia100", NULL);
+ ok = request_irq(pHCB->HCS_Intr, inia100_intr1, SA_INTERRUPT | SA_SHIRQ, "inia100", hreg);
break;
case 2:
- ok = request_irq(pHCB->HCS_Intr, inia100_intr2, SA_INTERRUPT | SA_SHIRQ, "inia100", NULL);
+ ok = request_irq(pHCB->HCS_Intr, inia100_intr2, SA_INTERRUPT | SA_SHIRQ, "inia100", hreg);
break;
case 3:
- ok = request_irq(pHCB->HCS_Intr, inia100_intr3, SA_INTERRUPT | SA_SHIRQ, "inia100", NULL);
+ ok = request_irq(pHCB->HCS_Intr, inia100_intr3, SA_INTERRUPT | SA_SHIRQ, "inia100", hreg);
break;
case 4:
- ok = request_irq(pHCB->HCS_Intr, inia100_intr4, SA_INTERRUPT | SA_SHIRQ, "inia100", NULL);
+ ok = request_irq(pHCB->HCS_Intr, inia100_intr4, SA_INTERRUPT | SA_SHIRQ, "inia100", hreg);
break;
case 5:
- ok = request_irq(pHCB->HCS_Intr, inia100_intr5, SA_INTERRUPT | SA_SHIRQ, "inia100", NULL);
+ ok = request_irq(pHCB->HCS_Intr, inia100_intr5, SA_INTERRUPT | SA_SHIRQ, "inia100", hreg);
break;
case 6:
- ok = request_irq(pHCB->HCS_Intr, inia100_intr6, SA_INTERRUPT | SA_SHIRQ, "inia100", NULL);
+ ok = request_irq(pHCB->HCS_Intr, inia100_intr6, SA_INTERRUPT | SA_SHIRQ, "inia100", hreg);
break;
case 7:
- ok = request_irq(pHCB->HCS_Intr, inia100_intr7, SA_INTERRUPT | SA_SHIRQ, "inia100", NULL);
+ ok = request_irq(pHCB->HCS_Intr, inia100_intr7, SA_INTERRUPT | SA_SHIRQ, "inia100", hreg);
break;
default:
inia100_panic("inia100: Too many host adapters\n");
@@ -784,5 +785,15 @@
printk("\ninia100_panic: %s\n", msg);
panic("inia100 panic");
}
+
+/*
+ * Release ressources
+ */
+int inia100_release(struct Scsi_Host *hreg)
+{
+ free_irq(hreg->irq, hreg);
+ release_region(hreg->io_port, 256);
+ return 0;
+}
/*#include "inia100scsi.c" */
--- inia100.h.org Mon May 22 15:39:40 2000
+++ inia100.h Mon May 22 15:44:22 2000
@@ -71,6 +71,7 @@
#include "sd.h"
extern int inia100_detect(Scsi_Host_Template *);
+extern int inia100_release(struct Scsi_Host *);
extern int inia100_command(Scsi_Cmnd *);
extern int inia100_queue(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
extern int inia100_abort(Scsi_Cmnd *);
@@ -87,7 +88,7 @@
proc_info: NULL, \
name: inia100_REVID, \
detect: inia100_detect, \
- release: NULL, \
+ release: inia100_release, \
info: NULL, \
command: inia100_command, \
queuecommand: inia100_queue, \
--- ini9100u.c.org Sat May 20 18:49:10 2000
+++ ini9100u.c Mon May 22 15:38:48 2000
@@ -377,8 +377,6 @@
pHCB->pSRB_head = NULL; /* Initial SRB save queue */
pHCB->pSRB_tail = NULL; /* Initial SRB save queue */
pHCB->pSRB_lock = SPIN_LOCK_UNLOCKED; /* SRB save queue lock */
- request_region(pHCB->HCS_Base, 0x100, "i91u"); /* Register */
-
get_tulipPCIConfig(pHCB, i);
dBiosAdr = pHCB->HCS_BIOS;
@@ -387,6 +385,8 @@
pbBiosAdr = phys_to_virt(dBiosAdr);
init_tulip(pHCB, tul_scb + (i * tul_num_scb), tul_num_scb, pbBiosAdr, 10);
+ request_region(pHCB->HCS_Base, 256, "i91u"); /* Register */
+
pHCB->HCS_Index = i; /* 7/29/98 */
hreg = scsi_register(tpnt, sizeof(HCS));
hreg->io_port = pHCB->HCS_Base;
@@ -812,4 +812,14 @@
{
printk("\ni91u_panic: %s\n", msg);
panic("i91u panic");
+}
+
+/*
+ * Release ressources
+ */
+int i91u_release(struct Scsi_Host *hreg)
+{
+ free_irq(hreg->irq, hreg);
+ release_region(hreg->io_port, 256);
+ return 0;
}
--- ini9100u.h.org Sat May 20 18:56:28 2000
+++ ini9100u.h Sat May 20 18:57:44 2000
@@ -78,6 +78,7 @@
#include "sd.h"
extern int i91u_detect(Scsi_Host_Template *);
+extern int i91u_release(struct Scsi_Host *);
extern int i91u_command(Scsi_Cmnd *);
extern int i91u_queue(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
extern int i91u_abort(Scsi_Cmnd *);
@@ -93,7 +94,7 @@
proc_info: NULL, \
name: i91u_REVID, \
detect: i91u_detect, \
- release: NULL, \
+ release: i91u_release, \
info: NULL, \
command: i91u_command, \
queuecommand: i91u_queue, \
... and here the typo fix patch for the ide-disk.c:
--- ide-disk.c.org Mon May 22 16:54:15 2000
+++ ide-disk.c Mon May 22 16:54:23 2000
@@ -829,7 +829,7 @@
/* Only print cache size when it was specified */
if (id->buf_size)
- printk (" w/%dKiB Cache", id->buf_size/2);
+ printk (" w/%dkB Cache", id->buf_size/2);
printk(", CHS=%d/%d/%d",
drive->bios_cyl, drive->bios_head, drive->bios_sect);
-- thomas.graichen@innominate.de innominate AG networking people fon: +49.30.308806-13 fax: -77 web: http://innominate.de pgp: /pgp/tg- 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 : Tue May 23 2000 - 21:00:22 EST