libata: Add helper ata_shost_to_port()
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 5ae7613..9871f82 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -395,7 +395,7 @@
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_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 @@
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 @@
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);