Skip to contentSkip to conversation

drivers/scsi/wd7000.c: check_region -> request_region (241p9)

PATCH New Rasmus Andersen 1 participant 1 message Jan 23, 2001 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/scsi/wd7000.c: check_region -> request_region (241p9)

Hi.

The following patch makes drivers/scsi/wd7000.c use request_region instead of check_region+request_region. It also drops a panic() and changes error paths to be forward gotos (in part necessary by the request_region change).

It applies cleanly against ac10 and 241p9.

Comments?

drivers/scsi/wd7000.c +16 -16
@@ -863,7 +863,7 @@
 	 */
 	if (freescbs < needed) {
 	    busy = 0;
-	    panic ("wd7000: can't get enough free SCBs.\n");
+	    printk (KERN_ERR "wd7000: can't get enough free SCBs.\n");
 	    restore_flags (flags);
 	    return (NULL);
 	}
@@ -1593,7 +1593,7 @@
 	printk ("wd7000_detect: check IO 0x%x region...\n", iobase);
 #endif
 
-	if (!check_region (iobase, 4)) {
+	if (request_region (iobase, 4, "wd7000")) {
 
 #ifdef WD7000_DEBUG
 	    printk ("wd7000_detect: ASC reset (IO 0x%x) ...", iobase);
@@ -1609,12 +1609,12 @@
 #ifdef WD7000_DEBUG
 	    {
 		printk ("failed!\n");
-		continue;
+		goto err_release;
 	    }
-	    else
+	    else 
 		printk ("ok!\n");
 #else
-		continue;
+	    goto err_release;
 #endif
 
 	    if (inb (iobase + ASC_INTR_STAT) == 1) {
@@ -1627,7 +1627,8 @@
 		 */
 		sh = scsi_register (tpnt, sizeof (Adapter));
 		if(sh==NULL)
-			continue;
+		    goto err_release;
+
 		host = (Adapter *) sh->hostdata;
 
 #ifdef WD7000_DEBUG
@@ -1650,11 +1651,8 @@
 			host->iobase, host->irq, host->dma);
 #endif
 
-		if (!wd7000_init (host)) {	/* Initialization failed */
-		    scsi_unregister (sh);
-
-		    continue;
-		}
+		if (!wd7000_init (host)) 	/* Initialization failed */
+		    goto err_unregister;
 
 		/*
 		 *  OK from here - we'll use this adapter/configuration.
@@ -1662,11 +1660,6 @@
 		wd7000_revision (host);		/* important for scatter/gather */
 
 		/*
-		 * Register our ports.
-		 */
-		request_region (host->iobase, 4, "wd7000");
-
-		/*
 		 *  For boards before rev 6.0, scatter/gather isn't supported.
 		 */
 		if (host->rev1 < 6)
@@ -1690,6 +1683,13 @@
 	else
 	    printk ("wd7000_detect: IO 0x%x region already allocated!\n", iobase);
 #endif
+
+	continue;
+
+    err_unregister:
+	scsi_unregister (sh);
+    err_release:
+	release_region(iobase, 4);
 
     }
 
Signature · 10 lines
Regards,
        Rasmus([email protected])

First snow, then silence.
This thousand dollar screen dies
so beautifully.           --- Error messages in haiku
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/