@@ -376,8 +376,6 @@ static int ahc_linux_run_command(struct ahc_softc*,
static void ahc_linux_setup_tag_info_global(char *p);
static int aic7xxx_setup(char *s);
-static int ahc_linux_unit;
-
/************************** OS Utility Wrappers *******************************/
void
@@ -1090,7 +1088,6 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *templa
char buf[80];
struct Scsi_Host *host;
char *new_name;
- u_long s;
int retval;
template->name = ahc->description;
@@ -1109,9 +1106,6 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *templa
host->max_lun = AHC_NUM_LUNS;
host->max_channel = (ahc->features & AHC_TWIN) ? 1 : 0;
host->sg_tablesize = AHC_NSEG;
- ahc_lock(ahc, &s);
- ahc_set_unit(ahc, ahc_linux_unit++);
- ahc_unlock(ahc, &s);
sprintf(buf, "scsi%d", host->host_no);
new_name = kmalloc(strlen(buf) + 1, GFP_ATOMIC);
if (new_name != NULL) {
@@ -42,6 +42,8 @@
#include "aic7xxx_osm.h"
#include "aic7xxx_pci.h"
+static int ahc_linux_unit = 0;
+
/* Define the macro locally since it's different for different class of chips.
*/
#define ID(x) ID_C(x, PCI_CLASS_STORAGE_SCSI)
@@ -249,10 +251,12 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return (-ENODEV);
}
}
+ ahc_set_unit(ahc, ahc_linux_unit++);
ahc->dev_softc = pci;
error = ahc_pci_config(ahc, entry);
if (error != 0) {
ahc_free(ahc);
+ ahc_linux_unit--;
return (-error);
}