mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drivers/scsi/wd7000.c: check_region -> request_region (241p9)
@ 2001-01-23 22:52 Rasmus Andersen
  0 siblings, 0 replies; only message in thread
From: Rasmus Andersen @ 2001-01-23 22:52 UTC (permalink / raw)
  To: zaga; +Cc: linux-kernel, linux-scsi

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?



--- linux-ac10-clean/drivers/scsi/wd7000.c	Sun Nov 12 04:01:11 2000
+++ linux-ac10/drivers/scsi/wd7000.c	Mon Jan 22 21:05:10 2001
@@ -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);
 
     }
 


-- 
Regards,
        Rasmus(rasmus@jaquet.dk)

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 majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-01-23 22:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-23 22:52 [PATCH] drivers/scsi/wd7000.c: check_region -> request_region (241p9) Rasmus Andersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®