libata: Add helper ata_shost_to_port()
[deliverable/linux.git] / drivers / scsi / libata-scsi.c
index 5ae7613bc15728ed4a278b266ee1508c48816648..9871f8272df0b53a74aa68a42243e63e91c49f13 100644 (file)
@@ -395,7 +395,7 @@ void ata_dump_status(unsigned id, struct ata_taskfile *tf)
 
 int ata_scsi_device_resume(struct scsi_device *sdev)
 {
-       struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0];
+       struct ata_port *ap = ata_shost_to_port(sdev->host);
        struct ata_device *dev = &ap->device[sdev->id];
 
        return ata_device_resume(ap, dev);
@@ -403,7 +403,7 @@ int ata_scsi_device_resume(struct scsi_device *sdev)
 
 int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t state)
 {
-       struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0];
+       struct ata_port *ap = ata_shost_to_port(sdev->host);
        struct ata_device *dev = &ap->device[sdev->id];
 
        return ata_device_suspend(ap, dev, state);
@@ -704,7 +704,7 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
                struct ata_port *ap;
                struct ata_device *dev;
 
-               ap = (struct ata_port *) &sdev->host->hostdata[0];
+               ap = ata_shost_to_port(sdev->host);
                dev = &ap->device[sdev->id];
 
                ata_scsi_dev_config(sdev, dev);
@@ -2478,7 +2478,7 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
        struct scsi_device *scsidev = cmd->device;
        struct Scsi_Host *shost = scsidev->host;
 
-       ap = (struct ata_port *) &shost->hostdata[0];
+       ap = ata_shost_to_port(shost);
 
        spin_unlock(shost->host_lock);
        spin_lock(&ap->host_set->lock);
This page took 0.028066 seconds and 5 git commands to generate.