diff options
author | Tejun Heo <htejun@gmail.com> | 2006-05-31 05:27:40 -0400 |
---|---|---|
committer | Tejun Heo <htejun@gmail.com> | 2006-05-31 05:27:40 -0400 |
commit | 3edebac41bab7e146578ad9e723ee7fff71c99c0 (patch) | |
tree | c5f1276f7c0e93b51ad67b12e241b37c05f4f38a /drivers/scsi/libata-scsi.c | |
parent | 5a04bf4befa8bffa012eedc3a0903c158b9131a9 (diff) |
[PATCH] libata-hp-prep: store attached SCSI device
Add device persistent field dev->sdev and store the attached SCSI
device. With hotplug, libata needs to know the attached SCSI device
to offline and detach it, but scsi_device_lookup() cannot be used
because libata will reuse SCSI ID numbers - dead but not gone devices
(due to zombie opens, etc...) interfere with the lookup.
dev->sdev doesn't hold reference to the SCSI device. It's cleared
when the SCSI device goes away.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Diffstat (limited to 'drivers/scsi/libata-scsi.c')
-rw-r--r-- | drivers/scsi/libata-scsi.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 05090768d9a8..da9689b70826 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -2743,16 +2743,22 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, | |||
2743 | 2743 | ||
2744 | void ata_scsi_scan_host(struct ata_port *ap) | 2744 | void ata_scsi_scan_host(struct ata_port *ap) |
2745 | { | 2745 | { |
2746 | struct ata_device *dev; | ||
2747 | unsigned int i; | 2746 | unsigned int i; |
2748 | 2747 | ||
2749 | if (ap->flags & ATA_FLAG_DISABLED) | 2748 | if (ap->flags & ATA_FLAG_DISABLED) |
2750 | return; | 2749 | return; |
2751 | 2750 | ||
2752 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 2751 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
2753 | dev = &ap->device[i]; | 2752 | struct ata_device *dev = &ap->device[i]; |
2753 | struct scsi_device *sdev; | ||
2754 | |||
2755 | if (!ata_dev_enabled(dev) || dev->sdev) | ||
2756 | continue; | ||
2754 | 2757 | ||
2755 | if (ata_dev_enabled(dev)) | 2758 | sdev = __scsi_add_device(ap->host, 0, i, 0, NULL); |
2756 | scsi_scan_target(&ap->host->shost_gendev, 0, i, 0, 0); | 2759 | if (!IS_ERR(sdev)) { |
2760 | dev->sdev = sdev; | ||
2761 | scsi_device_put(sdev); | ||
2762 | } | ||
2757 | } | 2763 | } |
2758 | } | 2764 | } |