diff options
-rw-r--r-- | drivers/scsi/libata-scsi.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index b45b8b34c0ca..05090768d9a8 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -399,7 +399,7 @@ void ata_dump_status(unsigned id, struct ata_taskfile *tf) | |||
399 | int ata_scsi_device_resume(struct scsi_device *sdev) | 399 | int ata_scsi_device_resume(struct scsi_device *sdev) |
400 | { | 400 | { |
401 | struct ata_port *ap = ata_shost_to_port(sdev->host); | 401 | struct ata_port *ap = ata_shost_to_port(sdev->host); |
402 | struct ata_device *dev = &ap->device[sdev->id]; | 402 | struct ata_device *dev = __ata_scsi_find_dev(ap, sdev); |
403 | 403 | ||
404 | return ata_device_resume(dev); | 404 | return ata_device_resume(dev); |
405 | } | 405 | } |
@@ -407,7 +407,7 @@ int ata_scsi_device_resume(struct scsi_device *sdev) | |||
407 | int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t state) | 407 | int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t state) |
408 | { | 408 | { |
409 | struct ata_port *ap = ata_shost_to_port(sdev->host); | 409 | struct ata_port *ap = ata_shost_to_port(sdev->host); |
410 | struct ata_device *dev = &ap->device[sdev->id]; | 410 | struct ata_device *dev = __ata_scsi_find_dev(ap, sdev); |
411 | 411 | ||
412 | return ata_device_suspend(dev, state); | 412 | return ata_device_suspend(dev, state); |
413 | } | 413 | } |
@@ -713,19 +713,15 @@ static void ata_scsi_dev_config(struct scsi_device *sdev, | |||
713 | 713 | ||
714 | int ata_scsi_slave_config(struct scsi_device *sdev) | 714 | int ata_scsi_slave_config(struct scsi_device *sdev) |
715 | { | 715 | { |
716 | struct ata_port *ap = ata_shost_to_port(sdev->host); | ||
717 | struct ata_device *dev = __ata_scsi_find_dev(ap, sdev); | ||
718 | |||
716 | ata_scsi_sdev_config(sdev); | 719 | ata_scsi_sdev_config(sdev); |
717 | 720 | ||
718 | blk_queue_max_phys_segments(sdev->request_queue, LIBATA_MAX_PRD); | 721 | blk_queue_max_phys_segments(sdev->request_queue, LIBATA_MAX_PRD); |
719 | 722 | ||
720 | if (sdev->id < ATA_MAX_DEVICES) { | 723 | if (dev) |
721 | struct ata_port *ap; | ||
722 | struct ata_device *dev; | ||
723 | |||
724 | ap = ata_shost_to_port(sdev->host); | ||
725 | dev = &ap->device[sdev->id]; | ||
726 | |||
727 | ata_scsi_dev_config(sdev, dev); | 724 | ata_scsi_dev_config(sdev, dev); |
728 | } | ||
729 | 725 | ||
730 | return 0; /* scsi layer doesn't check return value, sigh */ | 726 | return 0; /* scsi layer doesn't check return value, sigh */ |
731 | } | 727 | } |