diff options
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r-- | drivers/ata/libata-scsi.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 7ff1adfc729c..d250858d201c 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -3181,15 +3181,27 @@ static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel, | |||
3181 | void ata_scsi_dev_rescan(void *data) | 3181 | void ata_scsi_dev_rescan(void *data) |
3182 | { | 3182 | { |
3183 | struct ata_port *ap = data; | 3183 | struct ata_port *ap = data; |
3184 | struct ata_device *dev; | 3184 | unsigned long flags; |
3185 | unsigned int i; | 3185 | unsigned int i; |
3186 | 3186 | ||
3187 | spin_lock_irqsave(ap->lock, flags); | ||
3188 | |||
3187 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 3189 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
3188 | dev = &ap->device[i]; | 3190 | struct ata_device *dev = &ap->device[i]; |
3191 | struct scsi_device *sdev = dev->sdev; | ||
3189 | 3192 | ||
3190 | if (ata_dev_enabled(dev) && dev->sdev) | 3193 | if (!ata_dev_enabled(dev) || !sdev) |
3191 | scsi_rescan_device(&(dev->sdev->sdev_gendev)); | 3194 | continue; |
3195 | if (scsi_device_get(sdev)) | ||
3196 | continue; | ||
3197 | |||
3198 | spin_unlock_irqrestore(ap->lock, flags); | ||
3199 | scsi_rescan_device(&(sdev->sdev_gendev)); | ||
3200 | scsi_device_put(sdev); | ||
3201 | spin_lock_irqsave(ap->lock, flags); | ||
3192 | } | 3202 | } |
3203 | |||
3204 | spin_unlock_irqrestore(ap->lock, flags); | ||
3193 | } | 3205 | } |
3194 | 3206 | ||
3195 | /** | 3207 | /** |