aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic7xxx/aic7xxx_osm.c
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@steeleye.com>2005-05-17 22:09:52 -0400
committerJames Bottomley <jejb@titanic.(none)>2005-05-20 16:54:43 -0400
commitfb3089dfb58bf07992252b42e77c6f35d45dff5e (patch)
tree4626cee6ff060843a6d717156d3a119a8cb4b482 /drivers/scsi/aic7xxx/aic7xxx_osm.c
parentc7525233d2df39b95552f6f49c6b390a9c4d2e80 (diff)
[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>
Diffstat (limited to 'drivers/scsi/aic7xxx/aic7xxx_osm.c')
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index c03f29486071..b216de41bff4 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -645,7 +645,9 @@ ahc_linux_slave_alloc(struct scsi_device *device)
645 struct ahc_linux_target *targ; 645 struct ahc_linux_target *targ;
646 struct scsi_target *starget = device->sdev_target; 646 struct scsi_target *starget = device->sdev_target;
647 struct ahc_linux_device *dev; 647 struct ahc_linux_device *dev;
648 u_int target_offset; 648 unsigned int target_offset;
649 unsigned long flags;
650 int retval = -ENOMEM;
649 651
650 target_offset = starget->id; 652 target_offset = starget->id;
651 if (starget->channel != 0) 653 if (starget->channel != 0)
@@ -654,12 +656,14 @@ ahc_linux_slave_alloc(struct scsi_device *device)
654 ahc = *((struct ahc_softc **)device->host->hostdata); 656 ahc = *((struct ahc_softc **)device->host->hostdata);
655 if (bootverbose) 657 if (bootverbose)
656 printf("%s: Slave Alloc %d\n", ahc_name(ahc), device->id); 658 printf("%s: Slave Alloc %d\n", ahc_name(ahc), device->id);
659 ahc_lock(ahc, &flags);
657 targ = ahc->platform_data->targets[target_offset]; 660 targ = ahc->platform_data->targets[target_offset];
658 if (targ == NULL) { 661 if (targ == NULL) {
659 targ = ahc_linux_alloc_target(ahc, starget->channel, starget->id); 662 targ = ahc_linux_alloc_target(ahc, starget->channel, starget->id);
660 struct seeprom_config *sc = ahc->seep_config; 663 struct seeprom_config *sc = ahc->seep_config;
661 if (targ == NULL) 664 if (targ == NULL)
662 return -ENOMEM; 665 goto out;
666
663 if (sc) { 667 if (sc) {
664 unsigned short scsirate; 668 unsigned short scsirate;
665 struct ahc_devinfo devinfo; 669 struct ahc_devinfo devinfo;
@@ -701,10 +705,13 @@ ahc_linux_slave_alloc(struct scsi_device *device)
701 if (dev == NULL) { 705 if (dev == NULL) {
702 dev = ahc_linux_alloc_device(ahc, targ, device->lun); 706 dev = ahc_linux_alloc_device(ahc, targ, device->lun);
703 if (dev == NULL) 707 if (dev == NULL)
704 return -ENOMEM; 708 goto out;
705 } 709 }
710 retval = 0;
706 711
707 return 0; 712 out:
713 ahc_unlock(ahc, &flags);
714 return retval;
708} 715}
709 716
710static int 717static int