[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>

authored by James Bottomley and committed by James Bottomley fb3089df c7525233

+11 -4
+11 -4
drivers/scsi/aic7xxx/aic7xxx_osm.c
··· 645 645 struct ahc_linux_target *targ; 646 646 struct scsi_target *starget = device->sdev_target; 647 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 652 target_offset = starget->id; 651 653 if (starget->channel != 0) ··· 656 654 ahc = *((struct ahc_softc **)device->host->hostdata); 657 655 if (bootverbose) 658 656 printf("%s: Slave Alloc %d\n", ahc_name(ahc), device->id); 657 + ahc_lock(ahc, &flags); 659 658 targ = ahc->platform_data->targets[target_offset]; 660 659 if (targ == NULL) { 661 660 targ = ahc_linux_alloc_target(ahc, starget->channel, starget->id); 662 661 struct seeprom_config *sc = ahc->seep_config; 663 662 if (targ == NULL) 664 - return -ENOMEM; 663 + goto out; 664 + 665 665 if (sc) { 666 666 unsigned short scsirate; 667 667 struct ahc_devinfo devinfo; ··· 705 701 if (dev == NULL) { 706 702 dev = ahc_linux_alloc_device(ahc, targ, device->lun); 707 703 if (dev == NULL) 708 - return -ENOMEM; 704 + goto out; 709 705 } 706 + retval = 0; 710 707 711 - return 0; 708 + out: 709 + ahc_unlock(ahc, &flags); 710 + return retval; 712 711 } 713 712 714 713 static int