aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libata-scsi.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-06-22 23:46:10 -0400
committerJeff Garzik <jeff@garzik.org>2006-06-22 23:46:10 -0400
commitba6a13083c1b720a47c05bee7bedbb6ef06c4611 (patch)
tree26f9d8d37145fac426744f96ecf006ec0a481e31 /drivers/scsi/libata-scsi.c
parent47005f255ed126a4b48a1a2f63164fb1d83bcb0a (diff)
[libata] Add host lock to struct ata_port
Prepare for changes required to support SATA devices attached to SAS HBAs. For these devices we don't want to use host_set at all, since libata will not be the owner of struct scsi_host. Signed-off-by: Brian King <brking@us.ibm.com> (with slight merge modifications made by...) Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/scsi/libata-scsi.c')
-rw-r--r--drivers/scsi/libata-scsi.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 9698949fa52a..d86abed62007 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -752,7 +752,7 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev)
752 if (!ap->ops->error_handler) 752 if (!ap->ops->error_handler)
753 return; 753 return;
754 754
755 spin_lock_irqsave(&ap->host_set->lock, flags); 755 spin_lock_irqsave(ap->lock, flags);
756 dev = __ata_scsi_find_dev(ap, sdev); 756 dev = __ata_scsi_find_dev(ap, sdev);
757 if (dev && dev->sdev) { 757 if (dev && dev->sdev) {
758 /* SCSI device already in CANCEL state, no need to offline it */ 758 /* SCSI device already in CANCEL state, no need to offline it */
@@ -760,7 +760,7 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev)
760 dev->flags |= ATA_DFLAG_DETACH; 760 dev->flags |= ATA_DFLAG_DETACH;
761 ata_port_schedule_eh(ap); 761 ata_port_schedule_eh(ap);
762 } 762 }
763 spin_unlock_irqrestore(&ap->host_set->lock, flags); 763 spin_unlock_irqrestore(ap->lock, flags);
764} 764}
765 765
766/** 766/**
@@ -2684,7 +2684,7 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
2684 ap = ata_shost_to_port(shost); 2684 ap = ata_shost_to_port(shost);
2685 2685
2686 spin_unlock(shost->host_lock); 2686 spin_unlock(shost->host_lock);
2687 spin_lock(&ap->host_set->lock); 2687 spin_lock(ap->lock);
2688 2688
2689 ata_scsi_dump_cdb(ap, cmd); 2689 ata_scsi_dump_cdb(ap, cmd);
2690 2690
@@ -2696,7 +2696,7 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
2696 done(cmd); 2696 done(cmd);
2697 } 2697 }
2698 2698
2699 spin_unlock(&ap->host_set->lock); 2699 spin_unlock(ap->lock);
2700 spin_lock(shost->host_lock); 2700 spin_lock(shost->host_lock);
2701 return rc; 2701 return rc;
2702} 2702}
@@ -2858,7 +2858,7 @@ static void ata_scsi_remove_dev(struct ata_device *dev)
2858 * increments reference counts regardless of device state. 2858 * increments reference counts regardless of device state.
2859 */ 2859 */
2860 mutex_lock(&ap->host->scan_mutex); 2860 mutex_lock(&ap->host->scan_mutex);
2861 spin_lock_irqsave(&ap->host_set->lock, flags); 2861 spin_lock_irqsave(ap->lock, flags);
2862 2862
2863 /* clearing dev->sdev is protected by host_set lock */ 2863 /* clearing dev->sdev is protected by host_set lock */
2864 sdev = dev->sdev; 2864 sdev = dev->sdev;
@@ -2882,7 +2882,7 @@ static void ata_scsi_remove_dev(struct ata_device *dev)
2882 } 2882 }
2883 } 2883 }
2884 2884
2885 spin_unlock_irqrestore(&ap->host_set->lock, flags); 2885 spin_unlock_irqrestore(ap->lock, flags);
2886 mutex_unlock(&ap->host->scan_mutex); 2886 mutex_unlock(&ap->host->scan_mutex);
2887 2887
2888 if (sdev) { 2888 if (sdev) {
@@ -2926,9 +2926,9 @@ void ata_scsi_hotplug(void *data)
2926 if (!(dev->flags & ATA_DFLAG_DETACHED)) 2926 if (!(dev->flags & ATA_DFLAG_DETACHED))
2927 continue; 2927 continue;
2928 2928
2929 spin_lock_irqsave(&ap->host_set->lock, flags); 2929 spin_lock_irqsave(ap->lock, flags);
2930 dev->flags &= ~ATA_DFLAG_DETACHED; 2930 dev->flags &= ~ATA_DFLAG_DETACHED;
2931 spin_unlock_irqrestore(&ap->host_set->lock, flags); 2931 spin_unlock_irqrestore(ap->lock, flags);
2932 2932
2933 ata_scsi_remove_dev(dev); 2933 ata_scsi_remove_dev(dev);
2934 } 2934 }
@@ -2981,7 +2981,7 @@ static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
2981 (lun != SCAN_WILD_CARD && lun != 0)) 2981 (lun != SCAN_WILD_CARD && lun != 0))
2982 return -EINVAL; 2982 return -EINVAL;
2983 2983
2984 spin_lock_irqsave(&ap->host_set->lock, flags); 2984 spin_lock_irqsave(ap->lock, flags);
2985 2985
2986 if (id == SCAN_WILD_CARD) { 2986 if (id == SCAN_WILD_CARD) {
2987 ap->eh_info.probe_mask |= (1 << ATA_MAX_DEVICES) - 1; 2987 ap->eh_info.probe_mask |= (1 << ATA_MAX_DEVICES) - 1;
@@ -2999,7 +2999,7 @@ static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
2999 if (rc == 0) 2999 if (rc == 0)
3000 ata_port_schedule_eh(ap); 3000 ata_port_schedule_eh(ap);
3001 3001
3002 spin_unlock_irqrestore(&ap->host_set->lock, flags); 3002 spin_unlock_irqrestore(ap->lock, flags);
3003 3003
3004 return rc; 3004 return rc;
3005} 3005}