[SCSI] aic7xxx: add back locking
Tampering with the settings has to be done under the host lock ... slave_alloc isn't called under any lock, so this has to be done explicitly. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
parent
c7525233d2
commit
fb3089dfb5
|
@ -645,7 +645,9 @@ ahc_linux_slave_alloc(struct scsi_device *device)
|
||||||
struct ahc_linux_target *targ;
|
struct ahc_linux_target *targ;
|
||||||
struct scsi_target *starget = device->sdev_target;
|
struct scsi_target *starget = device->sdev_target;
|
||||||
struct ahc_linux_device *dev;
|
struct ahc_linux_device *dev;
|
||||||
u_int target_offset;
|
unsigned int target_offset;
|
||||||
|
unsigned long flags;
|
||||||
|
int retval = -ENOMEM;
|
||||||
|
|
||||||
target_offset = starget->id;
|
target_offset = starget->id;
|
||||||
if (starget->channel != 0)
|
if (starget->channel != 0)
|
||||||
|
@ -654,12 +656,14 @@ ahc_linux_slave_alloc(struct scsi_device *device)
|
||||||
ahc = *((struct ahc_softc **)device->host->hostdata);
|
ahc = *((struct ahc_softc **)device->host->hostdata);
|
||||||
if (bootverbose)
|
if (bootverbose)
|
||||||
printf("%s: Slave Alloc %d\n", ahc_name(ahc), device->id);
|
printf("%s: Slave Alloc %d\n", ahc_name(ahc), device->id);
|
||||||
|
ahc_lock(ahc, &flags);
|
||||||
targ = ahc->platform_data->targets[target_offset];
|
targ = ahc->platform_data->targets[target_offset];
|
||||||
if (targ == NULL) {
|
if (targ == NULL) {
|
||||||
targ = ahc_linux_alloc_target(ahc, starget->channel, starget->id);
|
targ = ahc_linux_alloc_target(ahc, starget->channel, starget->id);
|
||||||
struct seeprom_config *sc = ahc->seep_config;
|
struct seeprom_config *sc = ahc->seep_config;
|
||||||
if (targ == NULL)
|
if (targ == NULL)
|
||||||
return -ENOMEM;
|
goto out;
|
||||||
|
|
||||||
if (sc) {
|
if (sc) {
|
||||||
unsigned short scsirate;
|
unsigned short scsirate;
|
||||||
struct ahc_devinfo devinfo;
|
struct ahc_devinfo devinfo;
|
||||||
|
@ -701,10 +705,13 @@ ahc_linux_slave_alloc(struct scsi_device *device)
|
||||||
if (dev == NULL) {
|
if (dev == NULL) {
|
||||||
dev = ahc_linux_alloc_device(ahc, targ, device->lun);
|
dev = ahc_linux_alloc_device(ahc, targ, device->lun);
|
||||||
if (dev == NULL)
|
if (dev == NULL)
|
||||||
return -ENOMEM;
|
goto out;
|
||||||
}
|
}
|
||||||
|
retval = 0;
|
||||||
|
|
||||||
return 0;
|
out:
|
||||||
|
ahc_unlock(ahc, &flags);
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in New Issue