patch-2.0.36 linux/drivers/scsi/hosts.c

Next file: linux/drivers/scsi/in2000.c
Previous file: linux/drivers/scsi/gdth_proc.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.35/linux/drivers/scsi/hosts.c linux/drivers/scsi/hosts.c
@@ -161,6 +161,10 @@
 #include "AM53C974.h"
 #endif
 
+#ifdef CONFIG_SCSI_MEGARAID
+#include "megaraid.h"
+#endif
+
 #ifdef CONFIG_SCSI_PPA
 #include "ppa.h"
 #endif
@@ -312,6 +316,9 @@
 #ifdef CONFIG_SCSI_AM53C974
     AM53C974,
 #endif
+#ifdef CONFIG_SCSI_MEGARAID
+    MEGARAID,
+#endif
 #ifdef CONFIG_SCSI_PPA
     PPA,
 #endif
@@ -357,10 +364,18 @@
     
     /* If we are removing the last host registered, it is safe to reuse
      * its host number (this avoids "holes" at boot time) (DB) 
+     * It is also safe to reuse those of numbers directly below which have
+     * been released earlier (to avoid some holes in numbering).
      */
-    if (max_scsi_hosts == next_scsi_host)
-	max_scsi_hosts--;
-    
+    if(sh->host_no == max_scsi_hosts - 1) {
+	while(--max_scsi_hosts >= next_scsi_host) {
+	    shpnt = scsi_hostlist;
+	    while(shpnt && shpnt->host_no != max_scsi_hosts - 1)
+		shpnt = shpnt->next;
+	    if(shpnt)
+		break;
+	}
+    }
     next_scsi_host--;
     scsi_init_free((char *) sh, sizeof(struct Scsi_Host) + sh->extra_bytes);
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov