--- drivers/scsi/hosts-2.4.19-pre4.c Thu Mar 21 03:35:41 2002 +++ drivers/scsi/hosts.c Thu Mar 21 04:02:18 2002 @@ -81,8 +81,8 @@ struct Scsi_Host * scsi_hostlist; struct Scsi_Device_Template * scsi_devicelist; -int max_scsi_hosts; -int next_scsi_host; +int max_scsi_hosts; /* host_no for next new host */ +int next_scsi_host; /* count of registered scsi hosts */ void scsi_unregister(struct Scsi_Host * sh){ @@ -107,6 +107,18 @@ if (shn) shn->host_registered = 0; /* else {} : This should not happen, we should panic here... */ +#if 1 + /* We shoult not decrement max_scsi_hosts (and make this value + * candidate for re-allocation by a different driver). + * Reason: the device is _still_ on the + * scsi_host_no_list and it's identified by its name. When the same + * device is re-registered it will get the same host_no again while + * new devices may use the allocation scheme and get this very same + * host_no. + * It's OK to have "holes" in the allocation but it does not mean + * "leaks". + */ +#else // if 0 /* 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 @@ -121,7 +133,9 @@ break; } } +#endif next_scsi_host--; + kfree((char *) sh); }