aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/libata-core.c4
-rw-r--r--drivers/scsi/libata-eh.c4
-rw-r--r--drivers/scsi/libata-scsi.c8
-rw-r--r--drivers/scsi/sata_svw.c2
-rw-r--r--include/linux/libata.h6
5 files changed, 15 insertions, 9 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 3387fe35c54f..6420062f2c1e 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -4659,7 +4659,7 @@ static struct ata_port * ata_host_add(const struct ata_probe_ent *ent,
4659 4659
4660 host->transportt = &ata_scsi_transport_template; 4660 host->transportt = &ata_scsi_transport_template;
4661 4661
4662 ap = (struct ata_port *) &host->hostdata[0]; 4662 ap = ata_shost_to_port(host);
4663 4663
4664 ata_host_init(ap, host, host_set, ent, port_no); 4664 ata_host_init(ap, host, host_set, ent, port_no);
4665 4665
@@ -4872,7 +4872,7 @@ void ata_host_set_remove(struct ata_host_set *host_set)
4872 4872
4873int ata_scsi_release(struct Scsi_Host *host) 4873int ata_scsi_release(struct Scsi_Host *host)
4874{ 4874{
4875 struct ata_port *ap = (struct ata_port *) &host->hostdata[0]; 4875 struct ata_port *ap = ata_shost_to_port(host);
4876 int i; 4876 int i;
4877 4877
4878 DPRINTK("ENTER\n"); 4878 DPRINTK("ENTER\n");
diff --git a/drivers/scsi/libata-eh.c b/drivers/scsi/libata-eh.c
index b518654b9d60..c31b13fd5307 100644
--- a/drivers/scsi/libata-eh.c
+++ b/drivers/scsi/libata-eh.c
@@ -64,7 +64,7 @@
64enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd) 64enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd)
65{ 65{
66 struct Scsi_Host *host = cmd->device->host; 66 struct Scsi_Host *host = cmd->device->host;
67 struct ata_port *ap = (struct ata_port *) &host->hostdata[0]; 67 struct ata_port *ap = ata_shost_to_port(host);
68 unsigned long flags; 68 unsigned long flags;
69 struct ata_queued_cmd *qc; 69 struct ata_queued_cmd *qc;
70 enum scsi_eh_timer_return ret = EH_HANDLED; 70 enum scsi_eh_timer_return ret = EH_HANDLED;
@@ -99,7 +99,7 @@ enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd)
99 */ 99 */
100void ata_scsi_error(struct Scsi_Host *host) 100void ata_scsi_error(struct Scsi_Host *host)
101{ 101{
102 struct ata_port *ap = (struct ata_port *)&host->hostdata[0]; 102 struct ata_port *ap = ata_shost_to_port(host);
103 103
104 DPRINTK("ENTER\n"); 104 DPRINTK("ENTER\n");
105 105
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 5ae7613bc157..9871f8272df0 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -395,7 +395,7 @@ void ata_dump_status(unsigned id, struct ata_taskfile *tf)
395 395
396int ata_scsi_device_resume(struct scsi_device *sdev) 396int ata_scsi_device_resume(struct scsi_device *sdev)
397{ 397{
398 struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0]; 398 struct ata_port *ap = ata_shost_to_port(sdev->host);
399 struct ata_device *dev = &ap->device[sdev->id]; 399 struct ata_device *dev = &ap->device[sdev->id];
400 400
401 return ata_device_resume(ap, dev); 401 return ata_device_resume(ap, dev);
@@ -403,7 +403,7 @@ int ata_scsi_device_resume(struct scsi_device *sdev)
403 403
404int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t state) 404int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t state)
405{ 405{
406 struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0]; 406 struct ata_port *ap = ata_shost_to_port(sdev->host);
407 struct ata_device *dev = &ap->device[sdev->id]; 407 struct ata_device *dev = &ap->device[sdev->id];
408 408
409 return ata_device_suspend(ap, dev, state); 409 return ata_device_suspend(ap, dev, state);
@@ -704,7 +704,7 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
704 struct ata_port *ap; 704 struct ata_port *ap;
705 struct ata_device *dev; 705 struct ata_device *dev;
706 706
707 ap = (struct ata_port *) &sdev->host->hostdata[0]; 707 ap = ata_shost_to_port(sdev->host);
708 dev = &ap->device[sdev->id]; 708 dev = &ap->device[sdev->id];
709 709
710 ata_scsi_dev_config(sdev, dev); 710 ata_scsi_dev_config(sdev, dev);
@@ -2478,7 +2478,7 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
2478 struct scsi_device *scsidev = cmd->device; 2478 struct scsi_device *scsidev = cmd->device;
2479 struct Scsi_Host *shost = scsidev->host; 2479 struct Scsi_Host *shost = scsidev->host;
2480 2480
2481 ap = (struct ata_port *) &shost->hostdata[0]; 2481 ap = ata_shost_to_port(shost);
2482 2482
2483 spin_unlock(shost->host_lock); 2483 spin_unlock(shost->host_lock);
2484 spin_lock(&ap->host_set->lock); 2484 spin_lock(&ap->host_set->lock);
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c
index e15c693e0539..d5eb5375e265 100644
--- a/drivers/scsi/sata_svw.c
+++ b/drivers/scsi/sata_svw.c
@@ -257,7 +257,7 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
257 int len, index; 257 int len, index;
258 258
259 /* Find the ata_port */ 259 /* Find the ata_port */
260 ap = (struct ata_port *) &shost->hostdata[0]; 260 ap = ata_shost_to_port(shost);
261 if (ap == NULL) 261 if (ap == NULL)
262 return 0; 262 return 0;
263 263
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 2564bc514bca..fe0a1dcc76c2 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -33,6 +33,7 @@
33#include <asm/io.h> 33#include <asm/io.h>
34#include <linux/ata.h> 34#include <linux/ata.h>
35#include <linux/workqueue.h> 35#include <linux/workqueue.h>
36#include <scsi/scsi_host.h>
36 37
37/* 38/*
38 * compile-time options: to be removed as soon as all the drivers are 39 * compile-time options: to be removed as soon as all the drivers are
@@ -977,4 +978,9 @@ static inline void ata_pad_free(struct ata_port *ap, struct device *dev)
977 dma_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma); 978 dma_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma);
978} 979}
979 980
981static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host)
982{
983 return (struct ata_port *) &host->hostdata[0];
984}
985
980#endif /* __LINUX_LIBATA_H__ */ 986#endif /* __LINUX_LIBATA_H__ */