Commit fe51a64f authored by James Bottomley's avatar James Bottomley

g_NCR5380 - 2.6.0 - problem with reloading module

From: "Randy.Dunlap" <rddunlap@osdl.org>

The problem is that the detect function requests an IO region
of 16 bytes (at least when a command line override parameter is
used) but the release function only tries to release 8 bytes,
and this request isn't done because it doesn't match any allocated
IO region.  [NCR53C400 extensions are not enabled, so
NCR5380_region_size is 8, not 16, but the request uses
NCR5380_region_size regardless.]

Fix: save the allocated region size in instance->n_io_ports and release
   that size only;
parent 2de47969
......@@ -290,6 +290,7 @@ int __init generic_NCR5380_detect(Scsi_Host_Template * tpnt)
static int current_override = 0;
int count, i;
unsigned int *ports;
unsigned long region_size = 16;
static unsigned int __initdata ncr_53c400a_ports[] = {
0x280, 0x290, 0x300, 0x310, 0x330, 0x340, 0x348, 0x350, 0
};
......@@ -420,6 +421,7 @@ int __init generic_NCR5380_detect(Scsi_Host_Template * tpnt)
/* Not a 53C400A style setup - just grab */
if(!(request_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size, "ncr5380")))
continue;
region_size = NCR5380_region_size;
}
#else
if(!request_mem_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size, "ncr5380"))
......@@ -428,7 +430,7 @@ int __init generic_NCR5380_detect(Scsi_Host_Template * tpnt)
instance = scsi_register(tpnt, sizeof(struct NCR5380_hostdata));
if (instance == NULL) {
#ifndef CONFIG_SCSI_G_NCR5380_MEM
release_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size);
release_region(overrides[current_override].NCR5380_map_name, region_size);
#else
release_mem_region(overrides[current_override].NCR5380_map_name, NCR5380_region_size);
#endif
......@@ -436,6 +438,9 @@ int __init generic_NCR5380_detect(Scsi_Host_Template * tpnt)
}
instance->NCR5380_instance_name = overrides[current_override].NCR5380_map_name;
#ifndef CONFIG_SCSI_G_NCR5380_MEM
instance->n_io_port = region_size;
#endif
NCR5380_init(instance, flags);
......@@ -498,7 +503,7 @@ int generic_NCR5380_release_resources(struct Scsi_Host *instance)
NCR5380_setup(instance);
#ifndef CONFIG_SCSI_G_NCR5380_MEM
release_region(instance->NCR5380_instance_name, NCR5380_region_size);
release_region(instance->NCR5380_instance_name, instance->n_io_port);
#else
release_mem_region(instance->NCR5380_instance_name, NCR5380_region_size);
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment