Skip to contentSkip to conversation

remove check_region from drivers_scsi_cpqfcTSinit.c

PATCH New Rusty Trivial Russell 1 participant 1 message Jan 6, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove check_region from drivers_scsi_cpqfcTSinit.c

From: william stinson <[email protected]>

Hi Amy,

this proposed patch for drivers/scsi/cpqfcTSinit.c scsi driver for Linux removes two calls to check_region using request_region instead

I don't have this hardware so patch is not tested. This patch removes all references to check_region in this driver.

Patch also available at the following URL:

http://www.chez.com/wstinson/linux/kernel/patch-scsi-cpqfcTSinit

This is patch number 28 in a series of check_region patches I am doing as
part of the kernel janitors project. Removal of check_region is one of the items on the kernel janitors TODO list (http://www.kerneljanitors.org/TODO)
- get rid of check_region, use just request_region checking its return (2.2 request_region returned void) and now the driver init sequence is not to be serialized anymore, so races are possible (look at cardbus/pcihotplug code)

Best regards
William Stinson

drivers/scsi/cpqfcTSinit.c renamed from drivers/scsi/cpqfcTSinit.c.orig +8 -7
@@ -384,7 +384,8 @@
 
       // Since we have two 256-byte I/O port ranges (upper
       // and lower), check them both
-      if( check_region( cpqfcHBAdata->fcChip.Registers.IOBaseU, 0xff) )
+      if( !request_region( cpqfcHBAdata->fcChip.Registers.IOBaseU,
+      	                   0xff, DEV_NAME ) )
       {
 	printk("  cpqfcTS address in use: %x\n", 
 			cpqfcHBAdata->fcChip.Registers.IOBaseU);
@@ -393,21 +394,21 @@
 	continue;
       }	
       
-      if( check_region( cpqfcHBAdata->fcChip.Registers.IOBaseL, 0xff) )
+      if( !request_region( cpqfcHBAdata->fcChip.Registers.IOBaseL,
+      			   0xff, DEV_NAME ) )
       {
   	printk("  cpqfcTS address in use: %x\n", 
 	      			cpqfcHBAdata->fcChip.Registers.IOBaseL);
+	release_region( cpqfcHBAdata->fcChip.Registers.IOBaseU, 0xff );
 	free_irq( HostAdapter->irq, HostAdapter);
         scsi_unregister( HostAdapter);
 	continue;
       }	
       
-      // OK, we should be able to grab everything we need now.
-      request_region( cpqfcHBAdata->fcChip.Registers.IOBaseL, 0xff, DEV_NAME);
-      request_region( cpqfcHBAdata->fcChip.Registers.IOBaseU, 0xff, DEV_NAME);
-      DEBUG_PCI(printk("  Requesting 255 I/O addresses @ %x\n",
+      // OK, we have grabbed everything we need now.
+      DEBUG_PCI(printk("  Reserved 255 I/O addresses @ %x\n",
         cpqfcHBAdata->fcChip.Registers.IOBaseL ));
-      DEBUG_PCI(printk("  Requesting 255 I/O addresses @ %x\n",
+      DEBUG_PCI(printk("  Reserved 255 I/O addresses @ %x\n",
         cpqfcHBAdata->fcChip.Registers.IOBaseU ));
 
      
Signature · 2 lines
  Don't blame me: the Monkey is driving
  File: william stinson <[email protected]>: [PATCH ] remove check_region from drivers_scsi_cpqfcTSinit.c