aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-08-24 03:19:22 -0400
committerJeff Garzik <jeff@garzik.org>2006-08-24 03:19:22 -0400
commitcca3974e48607c3775dc73b544a5700b2e37c21a (patch)
tree0777d6121ba199af0aad196eb5a693510ec8e62e /drivers
parent54a86bfc3d4601be9c36cd4e8a1bdc580c98fa6a (diff)
libata: Grand renaming.
The biggest change is that ata_host_set is renamed to ata_host. * ata_host_set => ata_host * ata_probe_ent->host_flags => ata_probe_ent->port_flags * ata_probe_ent->host_set_flags => ata_probe_ent->_host_flags * ata_host_stats => ata_port_stats * ata_port->host => ata_port->scsi_host * ata_port->host_set => ata_port->host * ata_port_info->host_flags => ata_port_info->flags * ata_(.*)host_set(.*)\(\) => ata_\1host\2() The leading underscore in ata_probe_ent->_host_flags is to avoid reusing ->host_flags for different purpose. Currently, the only user of the field is libata-bmdma.c and probe_ent itself is scheduled to be removed. ata_port->host is reused for different purpose but this field is used inside libata core proper and of different type. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/ahci.c98
-rw-r--r--drivers/ata/ata_piix.c56
-rw-r--r--drivers/ata/libata-bmdma.c34
-rw-r--r--drivers/ata/libata-core.c292
-rw-r--r--drivers/ata/libata-eh.c16
-rw-r--r--drivers/ata/libata-scsi.c78
-rw-r--r--drivers/ata/libata.h2
-rw-r--r--drivers/ata/pdc_adma.c46
-rw-r--r--drivers/ata/sata_mv.c98
-rw-r--r--drivers/ata/sata_nv.c58
-rw-r--r--drivers/ata/sata_promise.c54
-rw-r--r--drivers/ata/sata_qstor.c44
-rw-r--r--drivers/ata/sata_sil.c47
-rw-r--r--drivers/ata/sata_sil24.c59
-rw-r--r--drivers/ata/sata_sis.c18
-rw-r--r--drivers/ata/sata_svw.c10
-rw-r--r--drivers/ata/sata_sx4.c64
-rw-r--r--drivers/ata/sata_uli.c8
-rw-r--r--drivers/ata/sata_via.c4
-rw-r--r--drivers/ata/sata_vsc.c16
20 files changed, 549 insertions, 553 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 813031c01fba..3f1106fdaed1 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -277,7 +277,7 @@ static const struct ata_port_info ahci_port_info[] = {
277 /* board_ahci */ 277 /* board_ahci */
278 { 278 {
279 .sht = &ahci_sht, 279 .sht = &ahci_sht,
280 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 280 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
281 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | 281 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
282 ATA_FLAG_SKIP_D2H_BSY, 282 ATA_FLAG_SKIP_D2H_BSY,
283 .pio_mask = 0x1f, /* pio0-4 */ 283 .pio_mask = 0x1f, /* pio0-4 */
@@ -287,7 +287,7 @@ static const struct ata_port_info ahci_port_info[] = {
287 /* board_ahci_vt8251 */ 287 /* board_ahci_vt8251 */
288 { 288 {
289 .sht = &ahci_sht, 289 .sht = &ahci_sht,
290 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 290 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
291 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | 291 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
292 ATA_FLAG_SKIP_D2H_BSY | 292 ATA_FLAG_SKIP_D2H_BSY |
293 AHCI_FLAG_RESET_NEEDS_CLO | AHCI_FLAG_NO_NCQ, 293 AHCI_FLAG_RESET_NEEDS_CLO | AHCI_FLAG_NO_NCQ,
@@ -709,7 +709,7 @@ static void ahci_fill_cmd_slot(struct ahci_port_priv *pp, unsigned int tag,
709static int ahci_clo(struct ata_port *ap) 709static int ahci_clo(struct ata_port *ap)
710{ 710{
711 void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr; 711 void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr;
712 struct ahci_host_priv *hpriv = ap->host_set->private_data; 712 struct ahci_host_priv *hpriv = ap->host->private_data;
713 u32 tmp; 713 u32 tmp;
714 714
715 if (!(hpriv->cap & HOST_CAP_CLO)) 715 if (!(hpriv->cap & HOST_CAP_CLO))
@@ -741,7 +741,7 @@ static int ahci_prereset(struct ata_port *ap)
741static int ahci_softreset(struct ata_port *ap, unsigned int *class) 741static int ahci_softreset(struct ata_port *ap, unsigned int *class)
742{ 742{
743 struct ahci_port_priv *pp = ap->private_data; 743 struct ahci_port_priv *pp = ap->private_data;
744 void __iomem *mmio = ap->host_set->mmio_base; 744 void __iomem *mmio = ap->host->mmio_base;
745 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 745 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
746 const u32 cmd_fis_len = 5; /* five dwords */ 746 const u32 cmd_fis_len = 5; /* five dwords */
747 const char *reason = NULL; 747 const char *reason = NULL;
@@ -850,7 +850,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class)
850 struct ahci_port_priv *pp = ap->private_data; 850 struct ahci_port_priv *pp = ap->private_data;
851 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; 851 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
852 struct ata_taskfile tf; 852 struct ata_taskfile tf;
853 void __iomem *mmio = ap->host_set->mmio_base; 853 void __iomem *mmio = ap->host->mmio_base;
854 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 854 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
855 int rc; 855 int rc;
856 856
@@ -1039,7 +1039,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
1039 1039
1040static void ahci_host_intr(struct ata_port *ap) 1040static void ahci_host_intr(struct ata_port *ap)
1041{ 1041{
1042 void __iomem *mmio = ap->host_set->mmio_base; 1042 void __iomem *mmio = ap->host->mmio_base;
1043 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1043 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1044 struct ata_eh_info *ehi = &ap->eh_info; 1044 struct ata_eh_info *ehi = &ap->eh_info;
1045 u32 status, qc_active; 1045 u32 status, qc_active;
@@ -1091,7 +1091,7 @@ static void ahci_irq_clear(struct ata_port *ap)
1091 1091
1092static irqreturn_t ahci_interrupt(int irq, void *dev_instance, struct pt_regs *regs) 1092static irqreturn_t ahci_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
1093{ 1093{
1094 struct ata_host_set *host_set = dev_instance; 1094 struct ata_host *host = dev_instance;
1095 struct ahci_host_priv *hpriv; 1095 struct ahci_host_priv *hpriv;
1096 unsigned int i, handled = 0; 1096 unsigned int i, handled = 0;
1097 void __iomem *mmio; 1097 void __iomem *mmio;
@@ -1099,8 +1099,8 @@ static irqreturn_t ahci_interrupt(int irq, void *dev_instance, struct pt_regs *r
1099 1099
1100 VPRINTK("ENTER\n"); 1100 VPRINTK("ENTER\n");
1101 1101
1102 hpriv = host_set->private_data; 1102 hpriv = host->private_data;
1103 mmio = host_set->mmio_base; 1103 mmio = host->mmio_base;
1104 1104
1105 /* sigh. 0xffffffff is a valid return from h/w */ 1105 /* sigh. 0xffffffff is a valid return from h/w */
1106 irq_stat = readl(mmio + HOST_IRQ_STAT); 1106 irq_stat = readl(mmio + HOST_IRQ_STAT);
@@ -1108,22 +1108,22 @@ static irqreturn_t ahci_interrupt(int irq, void *dev_instance, struct pt_regs *r
1108 if (!irq_stat) 1108 if (!irq_stat)
1109 return IRQ_NONE; 1109 return IRQ_NONE;
1110 1110
1111 spin_lock(&host_set->lock); 1111 spin_lock(&host->lock);
1112 1112
1113 for (i = 0; i < host_set->n_ports; i++) { 1113 for (i = 0; i < host->n_ports; i++) {
1114 struct ata_port *ap; 1114 struct ata_port *ap;
1115 1115
1116 if (!(irq_stat & (1 << i))) 1116 if (!(irq_stat & (1 << i)))
1117 continue; 1117 continue;
1118 1118
1119 ap = host_set->ports[i]; 1119 ap = host->ports[i];
1120 if (ap) { 1120 if (ap) {
1121 ahci_host_intr(ap); 1121 ahci_host_intr(ap);
1122 VPRINTK("port %u\n", i); 1122 VPRINTK("port %u\n", i);
1123 } else { 1123 } else {
1124 VPRINTK("port %u (no irq)\n", i); 1124 VPRINTK("port %u (no irq)\n", i);
1125 if (ata_ratelimit()) 1125 if (ata_ratelimit())
1126 dev_printk(KERN_WARNING, host_set->dev, 1126 dev_printk(KERN_WARNING, host->dev,
1127 "interrupt on disabled port %u\n", i); 1127 "interrupt on disabled port %u\n", i);
1128 } 1128 }
1129 1129
@@ -1135,7 +1135,7 @@ static irqreturn_t ahci_interrupt(int irq, void *dev_instance, struct pt_regs *r
1135 handled = 1; 1135 handled = 1;
1136 } 1136 }
1137 1137
1138 spin_unlock(&host_set->lock); 1138 spin_unlock(&host->lock);
1139 1139
1140 VPRINTK("EXIT\n"); 1140 VPRINTK("EXIT\n");
1141 1141
@@ -1157,7 +1157,7 @@ static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc)
1157 1157
1158static void ahci_freeze(struct ata_port *ap) 1158static void ahci_freeze(struct ata_port *ap)
1159{ 1159{
1160 void __iomem *mmio = ap->host_set->mmio_base; 1160 void __iomem *mmio = ap->host->mmio_base;
1161 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1161 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1162 1162
1163 /* turn IRQ off */ 1163 /* turn IRQ off */
@@ -1166,7 +1166,7 @@ static void ahci_freeze(struct ata_port *ap)
1166 1166
1167static void ahci_thaw(struct ata_port *ap) 1167static void ahci_thaw(struct ata_port *ap)
1168{ 1168{
1169 void __iomem *mmio = ap->host_set->mmio_base; 1169 void __iomem *mmio = ap->host->mmio_base;
1170 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1170 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1171 u32 tmp; 1171 u32 tmp;
1172 1172
@@ -1181,7 +1181,7 @@ static void ahci_thaw(struct ata_port *ap)
1181 1181
1182static void ahci_error_handler(struct ata_port *ap) 1182static void ahci_error_handler(struct ata_port *ap)
1183{ 1183{
1184 void __iomem *mmio = ap->host_set->mmio_base; 1184 void __iomem *mmio = ap->host->mmio_base;
1185 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1185 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1186 1186
1187 if (!(ap->pflags & ATA_PFLAG_FROZEN)) { 1187 if (!(ap->pflags & ATA_PFLAG_FROZEN)) {
@@ -1198,7 +1198,7 @@ static void ahci_error_handler(struct ata_port *ap)
1198static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) 1198static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)
1199{ 1199{
1200 struct ata_port *ap = qc->ap; 1200 struct ata_port *ap = qc->ap;
1201 void __iomem *mmio = ap->host_set->mmio_base; 1201 void __iomem *mmio = ap->host->mmio_base;
1202 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1202 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1203 1203
1204 if (qc->flags & ATA_QCFLAG_FAILED) 1204 if (qc->flags & ATA_QCFLAG_FAILED)
@@ -1213,9 +1213,9 @@ static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)
1213 1213
1214static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg) 1214static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
1215{ 1215{
1216 struct ahci_host_priv *hpriv = ap->host_set->private_data; 1216 struct ahci_host_priv *hpriv = ap->host->private_data;
1217 struct ahci_port_priv *pp = ap->private_data; 1217 struct ahci_port_priv *pp = ap->private_data;
1218 void __iomem *mmio = ap->host_set->mmio_base; 1218 void __iomem *mmio = ap->host->mmio_base;
1219 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1219 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1220 const char *emsg = NULL; 1220 const char *emsg = NULL;
1221 int rc; 1221 int rc;
@@ -1233,8 +1233,8 @@ static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
1233static int ahci_port_resume(struct ata_port *ap) 1233static int ahci_port_resume(struct ata_port *ap)
1234{ 1234{
1235 struct ahci_port_priv *pp = ap->private_data; 1235 struct ahci_port_priv *pp = ap->private_data;
1236 struct ahci_host_priv *hpriv = ap->host_set->private_data; 1236 struct ahci_host_priv *hpriv = ap->host->private_data;
1237 void __iomem *mmio = ap->host_set->mmio_base; 1237 void __iomem *mmio = ap->host->mmio_base;
1238 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1238 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1239 1239
1240 ahci_init_port(port_mmio, hpriv->cap, pp->cmd_slot_dma, pp->rx_fis_dma); 1240 ahci_init_port(port_mmio, hpriv->cap, pp->cmd_slot_dma, pp->rx_fis_dma);
@@ -1244,8 +1244,8 @@ static int ahci_port_resume(struct ata_port *ap)
1244 1244
1245static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) 1245static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
1246{ 1246{
1247 struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); 1247 struct ata_host *host = dev_get_drvdata(&pdev->dev);
1248 void __iomem *mmio = host_set->mmio_base; 1248 void __iomem *mmio = host->mmio_base;
1249 u32 ctl; 1249 u32 ctl;
1250 1250
1251 if (mesg.event == PM_EVENT_SUSPEND) { 1251 if (mesg.event == PM_EVENT_SUSPEND) {
@@ -1264,9 +1264,9 @@ static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
1264 1264
1265static int ahci_pci_device_resume(struct pci_dev *pdev) 1265static int ahci_pci_device_resume(struct pci_dev *pdev)
1266{ 1266{
1267 struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); 1267 struct ata_host *host = dev_get_drvdata(&pdev->dev);
1268 struct ahci_host_priv *hpriv = host_set->private_data; 1268 struct ahci_host_priv *hpriv = host->private_data;
1269 void __iomem *mmio = host_set->mmio_base; 1269 void __iomem *mmio = host->mmio_base;
1270 int rc; 1270 int rc;
1271 1271
1272 ata_pci_device_do_resume(pdev); 1272 ata_pci_device_do_resume(pdev);
@@ -1276,20 +1276,20 @@ static int ahci_pci_device_resume(struct pci_dev *pdev)
1276 if (rc) 1276 if (rc)
1277 return rc; 1277 return rc;
1278 1278
1279 ahci_init_controller(mmio, pdev, host_set->n_ports, hpriv->cap); 1279 ahci_init_controller(mmio, pdev, host->n_ports, hpriv->cap);
1280 } 1280 }
1281 1281
1282 ata_host_set_resume(host_set); 1282 ata_host_resume(host);
1283 1283
1284 return 0; 1284 return 0;
1285} 1285}
1286 1286
1287static int ahci_port_start(struct ata_port *ap) 1287static int ahci_port_start(struct ata_port *ap)
1288{ 1288{
1289 struct device *dev = ap->host_set->dev; 1289 struct device *dev = ap->host->dev;
1290 struct ahci_host_priv *hpriv = ap->host_set->private_data; 1290 struct ahci_host_priv *hpriv = ap->host->private_data;
1291 struct ahci_port_priv *pp; 1291 struct ahci_port_priv *pp;
1292 void __iomem *mmio = ap->host_set->mmio_base; 1292 void __iomem *mmio = ap->host->mmio_base;
1293 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1293 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1294 void *mem; 1294 void *mem;
1295 dma_addr_t mem_dma; 1295 dma_addr_t mem_dma;
@@ -1350,10 +1350,10 @@ static int ahci_port_start(struct ata_port *ap)
1350 1350
1351static void ahci_port_stop(struct ata_port *ap) 1351static void ahci_port_stop(struct ata_port *ap)
1352{ 1352{
1353 struct device *dev = ap->host_set->dev; 1353 struct device *dev = ap->host->dev;
1354 struct ahci_host_priv *hpriv = ap->host_set->private_data; 1354 struct ahci_host_priv *hpriv = ap->host->private_data;
1355 struct ahci_port_priv *pp = ap->private_data; 1355 struct ahci_port_priv *pp = ap->private_data;
1356 void __iomem *mmio = ap->host_set->mmio_base; 1356 void __iomem *mmio = ap->host->mmio_base;
1357 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1357 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1358 const char *emsg = NULL; 1358 const char *emsg = NULL;
1359 int rc; 1359 int rc;
@@ -1581,7 +1581,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1581 memset(hpriv, 0, sizeof(*hpriv)); 1581 memset(hpriv, 0, sizeof(*hpriv));
1582 1582
1583 probe_ent->sht = ahci_port_info[board_idx].sht; 1583 probe_ent->sht = ahci_port_info[board_idx].sht;
1584 probe_ent->host_flags = ahci_port_info[board_idx].host_flags; 1584 probe_ent->port_flags = ahci_port_info[board_idx].flags;
1585 probe_ent->pio_mask = ahci_port_info[board_idx].pio_mask; 1585 probe_ent->pio_mask = ahci_port_info[board_idx].pio_mask;
1586 probe_ent->udma_mask = ahci_port_info[board_idx].udma_mask; 1586 probe_ent->udma_mask = ahci_port_info[board_idx].udma_mask;
1587 probe_ent->port_ops = ahci_port_info[board_idx].port_ops; 1587 probe_ent->port_ops = ahci_port_info[board_idx].port_ops;
@@ -1599,9 +1599,9 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1599 if (rc) 1599 if (rc)
1600 goto err_out_hpriv; 1600 goto err_out_hpriv;
1601 1601
1602 if (!(probe_ent->host_flags & AHCI_FLAG_NO_NCQ) && 1602 if (!(probe_ent->port_flags & AHCI_FLAG_NO_NCQ) &&
1603 (hpriv->cap & HOST_CAP_NCQ)) 1603 (hpriv->cap & HOST_CAP_NCQ))
1604 probe_ent->host_flags |= ATA_FLAG_NCQ; 1604 probe_ent->port_flags |= ATA_FLAG_NCQ;
1605 1605
1606 ahci_print_info(probe_ent); 1606 ahci_print_info(probe_ent);
1607 1607
@@ -1632,27 +1632,27 @@ err_out:
1632static void ahci_remove_one (struct pci_dev *pdev) 1632static void ahci_remove_one (struct pci_dev *pdev)
1633{ 1633{
1634 struct device *dev = pci_dev_to_dev(pdev); 1634 struct device *dev = pci_dev_to_dev(pdev);
1635 struct ata_host_set *host_set = dev_get_drvdata(dev); 1635 struct ata_host *host = dev_get_drvdata(dev);
1636 struct ahci_host_priv *hpriv = host_set->private_data; 1636 struct ahci_host_priv *hpriv = host->private_data;
1637 unsigned int i; 1637 unsigned int i;
1638 int have_msi; 1638 int have_msi;
1639 1639
1640 for (i = 0; i < host_set->n_ports; i++) 1640 for (i = 0; i < host->n_ports; i++)
1641 ata_port_detach(host_set->ports[i]); 1641 ata_port_detach(host->ports[i]);
1642 1642
1643 have_msi = hpriv->flags & AHCI_FLAG_MSI; 1643 have_msi = hpriv->flags & AHCI_FLAG_MSI;
1644 free_irq(host_set->irq, host_set); 1644 free_irq(host->irq, host);
1645 1645
1646 for (i = 0; i < host_set->n_ports; i++) { 1646 for (i = 0; i < host->n_ports; i++) {
1647 struct ata_port *ap = host_set->ports[i]; 1647 struct ata_port *ap = host->ports[i];
1648 1648
1649 ata_scsi_release(ap->host); 1649 ata_scsi_release(ap->scsi_host);
1650 scsi_host_put(ap->host); 1650 scsi_host_put(ap->scsi_host);
1651 } 1651 }
1652 1652
1653 kfree(hpriv); 1653 kfree(hpriv);
1654 pci_iounmap(pdev, host_set->mmio_base); 1654 pci_iounmap(pdev, host->mmio_base);
1655 kfree(host_set); 1655 kfree(host);
1656 1656
1657 if (have_msi) 1657 if (have_msi)
1658 pci_disable_msi(pdev); 1658 pci_disable_msi(pdev);
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 0ca4c3b78dc5..22b2dba90b9a 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -151,7 +151,7 @@ struct piix_host_priv {
151 151
152static int piix_init_one (struct pci_dev *pdev, 152static int piix_init_one (struct pci_dev *pdev,
153 const struct pci_device_id *ent); 153 const struct pci_device_id *ent);
154static void piix_host_stop(struct ata_host_set *host_set); 154static void piix_host_stop(struct ata_host *host);
155static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev); 155static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev);
156static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev); 156static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev);
157static void piix_pata_error_handler(struct ata_port *ap); 157static void piix_pata_error_handler(struct ata_port *ap);
@@ -362,7 +362,7 @@ static struct ata_port_info piix_port_info[] = {
362 /* piix4_pata */ 362 /* piix4_pata */
363 { 363 {
364 .sht = &piix_sht, 364 .sht = &piix_sht,
365 .host_flags = ATA_FLAG_SLAVE_POSS, 365 .flags = ATA_FLAG_SLAVE_POSS,
366 .pio_mask = 0x1f, /* pio0-4 */ 366 .pio_mask = 0x1f, /* pio0-4 */
367#if 0 367#if 0
368 .mwdma_mask = 0x06, /* mwdma1-2 */ 368 .mwdma_mask = 0x06, /* mwdma1-2 */
@@ -376,7 +376,7 @@ static struct ata_port_info piix_port_info[] = {
376 /* ich5_pata */ 376 /* ich5_pata */
377 { 377 {
378 .sht = &piix_sht, 378 .sht = &piix_sht,
379 .host_flags = ATA_FLAG_SLAVE_POSS | PIIX_FLAG_CHECKINTR, 379 .flags = ATA_FLAG_SLAVE_POSS | PIIX_FLAG_CHECKINTR,
380 .pio_mask = 0x1f, /* pio0-4 */ 380 .pio_mask = 0x1f, /* pio0-4 */
381#if 0 381#if 0
382 .mwdma_mask = 0x06, /* mwdma1-2 */ 382 .mwdma_mask = 0x06, /* mwdma1-2 */
@@ -390,7 +390,7 @@ static struct ata_port_info piix_port_info[] = {
390 /* ich5_sata */ 390 /* ich5_sata */
391 { 391 {
392 .sht = &piix_sht, 392 .sht = &piix_sht,
393 .host_flags = ATA_FLAG_SATA | PIIX_FLAG_CHECKINTR | 393 .flags = ATA_FLAG_SATA | PIIX_FLAG_CHECKINTR |
394 PIIX_FLAG_IGNORE_PCS, 394 PIIX_FLAG_IGNORE_PCS,
395 .pio_mask = 0x1f, /* pio0-4 */ 395 .pio_mask = 0x1f, /* pio0-4 */
396 .mwdma_mask = 0x07, /* mwdma0-2 */ 396 .mwdma_mask = 0x07, /* mwdma0-2 */
@@ -401,7 +401,7 @@ static struct ata_port_info piix_port_info[] = {
401 /* i6300esb_sata */ 401 /* i6300esb_sata */
402 { 402 {
403 .sht = &piix_sht, 403 .sht = &piix_sht,
404 .host_flags = ATA_FLAG_SATA | 404 .flags = ATA_FLAG_SATA |
405 PIIX_FLAG_CHECKINTR | PIIX_FLAG_IGNORE_PCS, 405 PIIX_FLAG_CHECKINTR | PIIX_FLAG_IGNORE_PCS,
406 .pio_mask = 0x1f, /* pio0-4 */ 406 .pio_mask = 0x1f, /* pio0-4 */
407 .mwdma_mask = 0x07, /* mwdma0-2 */ 407 .mwdma_mask = 0x07, /* mwdma0-2 */
@@ -412,7 +412,7 @@ static struct ata_port_info piix_port_info[] = {
412 /* ich6_sata */ 412 /* ich6_sata */
413 { 413 {
414 .sht = &piix_sht, 414 .sht = &piix_sht,
415 .host_flags = ATA_FLAG_SATA | 415 .flags = ATA_FLAG_SATA |
416 PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR, 416 PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR,
417 .pio_mask = 0x1f, /* pio0-4 */ 417 .pio_mask = 0x1f, /* pio0-4 */
418 .mwdma_mask = 0x07, /* mwdma0-2 */ 418 .mwdma_mask = 0x07, /* mwdma0-2 */
@@ -423,7 +423,7 @@ static struct ata_port_info piix_port_info[] = {
423 /* ich6_sata_ahci */ 423 /* ich6_sata_ahci */
424 { 424 {
425 .sht = &piix_sht, 425 .sht = &piix_sht,
426 .host_flags = ATA_FLAG_SATA | 426 .flags = ATA_FLAG_SATA |
427 PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR | 427 PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR |
428 PIIX_FLAG_AHCI, 428 PIIX_FLAG_AHCI,
429 .pio_mask = 0x1f, /* pio0-4 */ 429 .pio_mask = 0x1f, /* pio0-4 */
@@ -435,7 +435,7 @@ static struct ata_port_info piix_port_info[] = {
435 /* ich6m_sata_ahci */ 435 /* ich6m_sata_ahci */
436 { 436 {
437 .sht = &piix_sht, 437 .sht = &piix_sht,
438 .host_flags = ATA_FLAG_SATA | 438 .flags = ATA_FLAG_SATA |
439 PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR | 439 PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR |
440 PIIX_FLAG_AHCI, 440 PIIX_FLAG_AHCI,
441 .pio_mask = 0x1f, /* pio0-4 */ 441 .pio_mask = 0x1f, /* pio0-4 */
@@ -447,7 +447,7 @@ static struct ata_port_info piix_port_info[] = {
447 /* ich8_sata_ahci */ 447 /* ich8_sata_ahci */
448 { 448 {
449 .sht = &piix_sht, 449 .sht = &piix_sht,
450 .host_flags = ATA_FLAG_SATA | 450 .flags = ATA_FLAG_SATA |
451 PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR | 451 PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR |
452 PIIX_FLAG_AHCI, 452 PIIX_FLAG_AHCI,
453 .pio_mask = 0x1f, /* pio0-4 */ 453 .pio_mask = 0x1f, /* pio0-4 */
@@ -485,7 +485,7 @@ MODULE_PARM_DESC(force_pcs, "force honoring or ignoring PCS to work around "
485 */ 485 */
486static void piix_pata_cbl_detect(struct ata_port *ap) 486static void piix_pata_cbl_detect(struct ata_port *ap)
487{ 487{
488 struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); 488 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
489 u8 tmp, mask; 489 u8 tmp, mask;
490 490
491 /* no 80c support in host controller? */ 491 /* no 80c support in host controller? */
@@ -517,7 +517,7 @@ cbl40:
517 */ 517 */
518static int piix_pata_prereset(struct ata_port *ap) 518static int piix_pata_prereset(struct ata_port *ap)
519{ 519{
520 struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); 520 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
521 521
522 if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no])) { 522 if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->port_no])) {
523 ata_port_printk(ap, KERN_INFO, "port disabled. ignoring.\n"); 523 ata_port_printk(ap, KERN_INFO, "port disabled. ignoring.\n");
@@ -551,8 +551,8 @@ static void piix_pata_error_handler(struct ata_port *ap)
551 */ 551 */
552static unsigned int piix_sata_present_mask(struct ata_port *ap) 552static unsigned int piix_sata_present_mask(struct ata_port *ap)
553{ 553{
554 struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); 554 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
555 struct piix_host_priv *hpriv = ap->host_set->private_data; 555 struct piix_host_priv *hpriv = ap->host->private_data;
556 const unsigned int *map = hpriv->map; 556 const unsigned int *map = hpriv->map;
557 int base = 2 * ap->port_no; 557 int base = 2 * ap->port_no;
558 unsigned int present_mask = 0; 558 unsigned int present_mask = 0;
@@ -631,7 +631,7 @@ static void piix_sata_error_handler(struct ata_port *ap)
631static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev) 631static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev)
632{ 632{
633 unsigned int pio = adev->pio_mode - XFER_PIO_0; 633 unsigned int pio = adev->pio_mode - XFER_PIO_0;
634 struct pci_dev *dev = to_pci_dev(ap->host_set->dev); 634 struct pci_dev *dev = to_pci_dev(ap->host->dev);
635 unsigned int is_slave = (adev->devno != 0); 635 unsigned int is_slave = (adev->devno != 0);
636 unsigned int master_port= ap->port_no ? 0x42 : 0x40; 636 unsigned int master_port= ap->port_no ? 0x42 : 0x40;
637 unsigned int slave_port = 0x44; 637 unsigned int slave_port = 0x44;
@@ -683,7 +683,7 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev)
683static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev) 683static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev)
684{ 684{
685 unsigned int udma = adev->dma_mode; /* FIXME: MWDMA too */ 685 unsigned int udma = adev->dma_mode; /* FIXME: MWDMA too */
686 struct pci_dev *dev = to_pci_dev(ap->host_set->dev); 686 struct pci_dev *dev = to_pci_dev(ap->host->dev);
687 u8 maslave = ap->port_no ? 0x42 : 0x40; 687 u8 maslave = ap->port_no ? 0x42 : 0x40;
688 u8 speed = udma; 688 u8 speed = udma;
689 unsigned int drive_dn = (ap->port_no ? 2 : 0) + adev->devno; 689 unsigned int drive_dn = (ap->port_no ? 2 : 0) + adev->devno;
@@ -835,13 +835,13 @@ static void __devinit piix_init_pcs(struct pci_dev *pdev,
835 if (force_pcs == 1) { 835 if (force_pcs == 1) {
836 dev_printk(KERN_INFO, &pdev->dev, 836 dev_printk(KERN_INFO, &pdev->dev,
837 "force ignoring PCS (0x%x)\n", new_pcs); 837 "force ignoring PCS (0x%x)\n", new_pcs);
838 pinfo[0].host_flags |= PIIX_FLAG_IGNORE_PCS; 838 pinfo[0].flags |= PIIX_FLAG_IGNORE_PCS;
839 pinfo[1].host_flags |= PIIX_FLAG_IGNORE_PCS; 839 pinfo[1].flags |= PIIX_FLAG_IGNORE_PCS;
840 } else if (force_pcs == 2) { 840 } else if (force_pcs == 2) {
841 dev_printk(KERN_INFO, &pdev->dev, 841 dev_printk(KERN_INFO, &pdev->dev,
842 "force honoring PCS (0x%x)\n", new_pcs); 842 "force honoring PCS (0x%x)\n", new_pcs);
843 pinfo[0].host_flags &= ~PIIX_FLAG_IGNORE_PCS; 843 pinfo[0].flags &= ~PIIX_FLAG_IGNORE_PCS;
844 pinfo[1].host_flags &= ~PIIX_FLAG_IGNORE_PCS; 844 pinfo[1].flags &= ~PIIX_FLAG_IGNORE_PCS;
845 } 845 }
846} 846}
847 847
@@ -881,7 +881,7 @@ static void __devinit piix_init_sata_map(struct pci_dev *pdev,
881 default: 881 default:
882 printk(" P%d", map[i]); 882 printk(" P%d", map[i]);
883 if (i & 1) 883 if (i & 1)
884 pinfo[i / 2].host_flags |= ATA_FLAG_SLAVE_POSS; 884 pinfo[i / 2].flags |= ATA_FLAG_SLAVE_POSS;
885 break; 885 break;
886 } 886 }
887 } 887 }
@@ -916,7 +916,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
916 struct ata_port_info port_info[2]; 916 struct ata_port_info port_info[2];
917 struct ata_port_info *ppinfo[2] = { &port_info[0], &port_info[1] }; 917 struct ata_port_info *ppinfo[2] = { &port_info[0], &port_info[1] };
918 struct piix_host_priv *hpriv; 918 struct piix_host_priv *hpriv;
919 unsigned long host_flags; 919 unsigned long port_flags;
920 920
921 if (!printed_version++) 921 if (!printed_version++)
922 dev_printk(KERN_DEBUG, &pdev->dev, 922 dev_printk(KERN_DEBUG, &pdev->dev,
@@ -935,9 +935,9 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
935 port_info[0].private_data = hpriv; 935 port_info[0].private_data = hpriv;
936 port_info[1].private_data = hpriv; 936 port_info[1].private_data = hpriv;
937 937
938 host_flags = port_info[0].host_flags; 938 port_flags = port_info[0].flags;
939 939
940 if (host_flags & PIIX_FLAG_AHCI) { 940 if (port_flags & PIIX_FLAG_AHCI) {
941 u8 tmp; 941 u8 tmp;
942 pci_read_config_byte(pdev, PIIX_SCC, &tmp); 942 pci_read_config_byte(pdev, PIIX_SCC, &tmp);
943 if (tmp == PIIX_AHCI_DEVICE) { 943 if (tmp == PIIX_AHCI_DEVICE) {
@@ -948,7 +948,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
948 } 948 }
949 949
950 /* Initialize SATA map */ 950 /* Initialize SATA map */
951 if (host_flags & ATA_FLAG_SATA) { 951 if (port_flags & ATA_FLAG_SATA) {
952 piix_init_sata_map(pdev, port_info, 952 piix_init_sata_map(pdev, port_info,
953 piix_map_db_table[ent->driver_data]); 953 piix_map_db_table[ent->driver_data]);
954 piix_init_pcs(pdev, port_info, 954 piix_init_pcs(pdev, port_info,
@@ -961,7 +961,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
961 * MSI is disabled (and it is disabled, as we don't use 961 * MSI is disabled (and it is disabled, as we don't use
962 * message-signalled interrupts currently). 962 * message-signalled interrupts currently).
963 */ 963 */
964 if (host_flags & PIIX_FLAG_CHECKINTR) 964 if (port_flags & PIIX_FLAG_CHECKINTR)
965 pci_intx(pdev, 1); 965 pci_intx(pdev, 1);
966 966
967 if (piix_check_450nx_errata(pdev)) { 967 if (piix_check_450nx_errata(pdev)) {
@@ -976,11 +976,11 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
976 return ata_pci_init_one(pdev, ppinfo, 2); 976 return ata_pci_init_one(pdev, ppinfo, 2);
977} 977}
978 978
979static void piix_host_stop(struct ata_host_set *host_set) 979static void piix_host_stop(struct ata_host *host)
980{ 980{
981 struct piix_host_priv *hpriv = host_set->private_data; 981 struct piix_host_priv *hpriv = host->private_data;
982 982
983 ata_host_stop(host_set); 983 ata_host_stop(host);
984 984
985 kfree(hpriv); 985 kfree(hpriv);
986} 986}
diff --git a/drivers/ata/libata-bmdma.c b/drivers/ata/libata-bmdma.c
index 158f62dbf21b..760502859821 100644
--- a/drivers/ata/libata-bmdma.c
+++ b/drivers/ata/libata-bmdma.c
@@ -193,7 +193,7 @@ void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
193 * synchronization with interrupt handler / other threads. 193 * synchronization with interrupt handler / other threads.
194 * 194 *
195 * LOCKING: 195 * LOCKING:
196 * spin_lock_irqsave(host_set lock) 196 * spin_lock_irqsave(host lock)
197 */ 197 */
198 198
199static void ata_exec_command_pio(struct ata_port *ap, const struct ata_taskfile *tf) 199static void ata_exec_command_pio(struct ata_port *ap, const struct ata_taskfile *tf)
@@ -216,7 +216,7 @@ static void ata_exec_command_pio(struct ata_port *ap, const struct ata_taskfile
216 * FIXME: missing write posting for 400nS delay enforcement 216 * FIXME: missing write posting for 400nS delay enforcement
217 * 217 *
218 * LOCKING: 218 * LOCKING:
219 * spin_lock_irqsave(host_set lock) 219 * spin_lock_irqsave(host lock)
220 */ 220 */
221 221
222static void ata_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) 222static void ata_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
@@ -237,7 +237,7 @@ static void ata_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile
237 * synchronization with interrupt handler / other threads. 237 * synchronization with interrupt handler / other threads.
238 * 238 *
239 * LOCKING: 239 * LOCKING:
240 * spin_lock_irqsave(host_set lock) 240 * spin_lock_irqsave(host lock)
241 */ 241 */
242void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf) 242void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf)
243{ 243{
@@ -422,7 +422,7 @@ u8 ata_altstatus(struct ata_port *ap)
422 * @qc: Info associated with this ATA transaction. 422 * @qc: Info associated with this ATA transaction.
423 * 423 *
424 * LOCKING: 424 * LOCKING:
425 * spin_lock_irqsave(host_set lock) 425 * spin_lock_irqsave(host lock)
426 */ 426 */
427 427
428static void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc) 428static void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc)
@@ -452,7 +452,7 @@ static void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc)
452 * @qc: Info associated with this ATA transaction. 452 * @qc: Info associated with this ATA transaction.
453 * 453 *
454 * LOCKING: 454 * LOCKING:
455 * spin_lock_irqsave(host_set lock) 455 * spin_lock_irqsave(host lock)
456 */ 456 */
457 457
458static void ata_bmdma_start_mmio (struct ata_queued_cmd *qc) 458static void ata_bmdma_start_mmio (struct ata_queued_cmd *qc)
@@ -483,7 +483,7 @@ static void ata_bmdma_start_mmio (struct ata_queued_cmd *qc)
483 * @qc: Info associated with this ATA transaction. 483 * @qc: Info associated with this ATA transaction.
484 * 484 *
485 * LOCKING: 485 * LOCKING:
486 * spin_lock_irqsave(host_set lock) 486 * spin_lock_irqsave(host lock)
487 */ 487 */
488 488
489static void ata_bmdma_setup_pio (struct ata_queued_cmd *qc) 489static void ata_bmdma_setup_pio (struct ata_queued_cmd *qc)
@@ -511,7 +511,7 @@ static void ata_bmdma_setup_pio (struct ata_queued_cmd *qc)
511 * @qc: Info associated with this ATA transaction. 511 * @qc: Info associated with this ATA transaction.
512 * 512 *
513 * LOCKING: 513 * LOCKING:
514 * spin_lock_irqsave(host_set lock) 514 * spin_lock_irqsave(host lock)
515 */ 515 */
516 516
517static void ata_bmdma_start_pio (struct ata_queued_cmd *qc) 517static void ata_bmdma_start_pio (struct ata_queued_cmd *qc)
@@ -535,7 +535,7 @@ static void ata_bmdma_start_pio (struct ata_queued_cmd *qc)
535 * May be used as the bmdma_start() entry in ata_port_operations. 535 * May be used as the bmdma_start() entry in ata_port_operations.
536 * 536 *
537 * LOCKING: 537 * LOCKING:
538 * spin_lock_irqsave(host_set lock) 538 * spin_lock_irqsave(host lock)
539 */ 539 */
540void ata_bmdma_start(struct ata_queued_cmd *qc) 540void ata_bmdma_start(struct ata_queued_cmd *qc)
541{ 541{
@@ -557,7 +557,7 @@ void ata_bmdma_start(struct ata_queued_cmd *qc)
557 * May be used as the bmdma_setup() entry in ata_port_operations. 557 * May be used as the bmdma_setup() entry in ata_port_operations.
558 * 558 *
559 * LOCKING: 559 * LOCKING:
560 * spin_lock_irqsave(host_set lock) 560 * spin_lock_irqsave(host lock)
561 */ 561 */
562void ata_bmdma_setup(struct ata_queued_cmd *qc) 562void ata_bmdma_setup(struct ata_queued_cmd *qc)
563{ 563{
@@ -577,7 +577,7 @@ void ata_bmdma_setup(struct ata_queued_cmd *qc)
577 * May be used as the irq_clear() entry in ata_port_operations. 577 * May be used as the irq_clear() entry in ata_port_operations.
578 * 578 *
579 * LOCKING: 579 * LOCKING:
580 * spin_lock_irqsave(host_set lock) 580 * spin_lock_irqsave(host lock)
581 */ 581 */
582 582
583void ata_bmdma_irq_clear(struct ata_port *ap) 583void ata_bmdma_irq_clear(struct ata_port *ap)
@@ -605,7 +605,7 @@ void ata_bmdma_irq_clear(struct ata_port *ap)
605 * May be used as the bmdma_status() entry in ata_port_operations. 605 * May be used as the bmdma_status() entry in ata_port_operations.
606 * 606 *
607 * LOCKING: 607 * LOCKING:
608 * spin_lock_irqsave(host_set lock) 608 * spin_lock_irqsave(host lock)
609 */ 609 */
610 610
611u8 ata_bmdma_status(struct ata_port *ap) 611u8 ata_bmdma_status(struct ata_port *ap)
@@ -629,7 +629,7 @@ u8 ata_bmdma_status(struct ata_port *ap)
629 * May be used as the bmdma_stop() entry in ata_port_operations. 629 * May be used as the bmdma_stop() entry in ata_port_operations.
630 * 630 *
631 * LOCKING: 631 * LOCKING:
632 * spin_lock_irqsave(host_set lock) 632 * spin_lock_irqsave(host lock)
633 */ 633 */
634 634
635void ata_bmdma_stop(struct ata_queued_cmd *qc) 635void ata_bmdma_stop(struct ata_queued_cmd *qc)
@@ -838,7 +838,7 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int
838 bmdma = pci_resource_start(pdev, 4); 838 bmdma = pci_resource_start(pdev, 4);
839 if (bmdma) { 839 if (bmdma) {
840 if (inb(bmdma + 2) & 0x80) 840 if (inb(bmdma + 2) & 0x80)
841 probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; 841 probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
842 probe_ent->port[p].bmdma_addr = bmdma; 842 probe_ent->port[p].bmdma_addr = bmdma;
843 } 843 }
844 ata_std_ports(&probe_ent->port[p]); 844 ata_std_ports(&probe_ent->port[p]);
@@ -854,7 +854,7 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int
854 if (bmdma) { 854 if (bmdma) {
855 bmdma += 8; 855 bmdma += 8;
856 if(inb(bmdma + 2) & 0x80) 856 if(inb(bmdma + 2) & 0x80)
857 probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; 857 probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
858 probe_ent->port[p].bmdma_addr = bmdma; 858 probe_ent->port[p].bmdma_addr = bmdma;
859 } 859 }
860 ata_std_ports(&probe_ent->port[p]); 860 ata_std_ports(&probe_ent->port[p]);
@@ -887,7 +887,7 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev,
887 if (bmdma) { 887 if (bmdma) {
888 probe_ent->port[0].bmdma_addr = bmdma; 888 probe_ent->port[0].bmdma_addr = bmdma;
889 if (inb(bmdma + 2) & 0x80) 889 if (inb(bmdma + 2) & 0x80)
890 probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; 890 probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
891 } 891 }
892 ata_std_ports(&probe_ent->port[0]); 892 ata_std_ports(&probe_ent->port[0]);
893 } else 893 } else
@@ -904,7 +904,7 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev,
904 if (bmdma) { 904 if (bmdma) {
905 probe_ent->port[1].bmdma_addr = bmdma + 8; 905 probe_ent->port[1].bmdma_addr = bmdma + 8;
906 if (inb(bmdma + 10) & 0x80) 906 if (inb(bmdma + 10) & 0x80)
907 probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; 907 probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
908 } 908 }
909 ata_std_ports(&probe_ent->port[1]); 909 ata_std_ports(&probe_ent->port[1]);
910 } else 910 } else
@@ -957,7 +957,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
957 else 957 else
958 port[1] = port[0]; 958 port[1] = port[0];
959 959
960 if ((port[0]->host_flags & ATA_FLAG_NO_LEGACY) == 0 960 if ((port[0]->flags & ATA_FLAG_NO_LEGACY) == 0
961 && (pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) { 961 && (pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
962 /* TODO: What if one channel is in native mode ... */ 962 /* TODO: What if one channel is in native mode ... */
963 pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8); 963 pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8);
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 9092416a6301..1c9315401f7a 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1335,7 +1335,7 @@ static void ata_dev_config_ncq(struct ata_device *dev,
1335 } 1335 }
1336 1336
1337 if (ap->flags & ATA_FLAG_NCQ) { 1337 if (ap->flags & ATA_FLAG_NCQ) {
1338 hdepth = min(ap->host->can_queue, ATA_MAX_QUEUE - 1); 1338 hdepth = min(ap->scsi_host->can_queue, ATA_MAX_QUEUE - 1);
1339 dev->flags |= ATA_DFLAG_NCQ; 1339 dev->flags |= ATA_DFLAG_NCQ;
1340 } 1340 }
1341 1341
@@ -1349,12 +1349,13 @@ static void ata_set_port_max_cmd_len(struct ata_port *ap)
1349{ 1349{
1350 int i; 1350 int i;
1351 1351
1352 if (ap->host) { 1352 if (ap->scsi_host) {
1353 ap->host->max_cmd_len = 0; 1353 unsigned int len = 0;
1354
1354 for (i = 0; i < ATA_MAX_DEVICES; i++) 1355 for (i = 0; i < ATA_MAX_DEVICES; i++)
1355 ap->host->max_cmd_len = max_t(unsigned int, 1356 len = max(len, ap->device[i].cdb_len);
1356 ap->host->max_cmd_len, 1357
1357 ap->device[i].cdb_len); 1358 ap->scsi_host->max_cmd_len = len;
1358 } 1359 }
1359} 1360}
1360 1361
@@ -1662,7 +1663,7 @@ int ata_bus_probe(struct ata_port *ap)
1662 * Modify @ap data structure such that the system 1663 * Modify @ap data structure such that the system
1663 * thinks that the entire port is enabled. 1664 * thinks that the entire port is enabled.
1664 * 1665 *
1665 * LOCKING: host_set lock, or some other form of 1666 * LOCKING: host lock, or some other form of
1666 * serialization. 1667 * serialization.
1667 */ 1668 */
1668 1669
@@ -1800,7 +1801,7 @@ struct ata_device *ata_dev_pair(struct ata_device *adev)
1800 * never attempt to probe or communicate with devices 1801 * never attempt to probe or communicate with devices
1801 * on this port. 1802 * on this port.
1802 * 1803 *
1803 * LOCKING: host_set lock, or some other form of 1804 * LOCKING: host lock, or some other form of
1804 * serialization. 1805 * serialization.
1805 */ 1806 */
1806 1807
@@ -2258,8 +2259,8 @@ int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
2258 /* Record simplex status. If we selected DMA then the other 2259 /* Record simplex status. If we selected DMA then the other
2259 * host channels are not permitted to do so. 2260 * host channels are not permitted to do so.
2260 */ 2261 */
2261 if (used_dma && (ap->host_set->flags & ATA_HOST_SIMPLEX)) 2262 if (used_dma && (ap->host->flags & ATA_HOST_SIMPLEX))
2262 ap->host_set->simplex_claimed = 1; 2263 ap->host->simplex_claimed = 1;
2263 2264
2264 /* step5: chip specific finalisation */ 2265 /* step5: chip specific finalisation */
2265 if (ap->ops->post_set_mode) 2266 if (ap->ops->post_set_mode)
@@ -2281,7 +2282,7 @@ int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
2281 * other threads. 2282 * other threads.
2282 * 2283 *
2283 * LOCKING: 2284 * LOCKING:
2284 * spin_lock_irqsave(host_set lock) 2285 * spin_lock_irqsave(host lock)
2285 */ 2286 */
2286 2287
2287static inline void ata_tf_to_host(struct ata_port *ap, 2288static inline void ata_tf_to_host(struct ata_port *ap,
@@ -2445,7 +2446,7 @@ static unsigned int ata_bus_softreset(struct ata_port *ap,
2445 * 2446 *
2446 * LOCKING: 2447 * LOCKING:
2447 * PCI/etc. bus probe sem. 2448 * PCI/etc. bus probe sem.
2448 * Obtains host_set lock. 2449 * Obtains host lock.
2449 * 2450 *
2450 * SIDE EFFECTS: 2451 * SIDE EFFECTS:
2451 * Sets ATA_FLAG_DISABLED if bus reset fails. 2452 * Sets ATA_FLAG_DISABLED if bus reset fails.
@@ -3080,7 +3081,7 @@ static int ata_dma_blacklisted(const struct ata_device *dev)
3080static void ata_dev_xfermask(struct ata_device *dev) 3081static void ata_dev_xfermask(struct ata_device *dev)
3081{ 3082{
3082 struct ata_port *ap = dev->ap; 3083 struct ata_port *ap = dev->ap;
3083 struct ata_host_set *hs = ap->host_set; 3084 struct ata_host *host = ap->host;
3084 unsigned long xfer_mask; 3085 unsigned long xfer_mask;
3085 3086
3086 /* controller modes available */ 3087 /* controller modes available */
@@ -3114,7 +3115,7 @@ static void ata_dev_xfermask(struct ata_device *dev)
3114 "device is on DMA blacklist, disabling DMA\n"); 3115 "device is on DMA blacklist, disabling DMA\n");
3115 } 3116 }
3116 3117
3117 if ((hs->flags & ATA_HOST_SIMPLEX) && hs->simplex_claimed) { 3118 if ((host->flags & ATA_HOST_SIMPLEX) && host->simplex_claimed) {
3118 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); 3119 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
3119 ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by " 3120 ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by "
3120 "other device, disabling DMA\n"); 3121 "other device, disabling DMA\n");
@@ -3207,7 +3208,7 @@ static unsigned int ata_dev_init_params(struct ata_device *dev,
3207 * Unmap all mapped DMA memory associated with this command. 3208 * Unmap all mapped DMA memory associated with this command.
3208 * 3209 *
3209 * LOCKING: 3210 * LOCKING:
3210 * spin_lock_irqsave(host_set lock) 3211 * spin_lock_irqsave(host lock)
3211 */ 3212 */
3212 3213
3213static void ata_sg_clean(struct ata_queued_cmd *qc) 3214static void ata_sg_clean(struct ata_queued_cmd *qc)
@@ -3267,7 +3268,7 @@ static void ata_sg_clean(struct ata_queued_cmd *qc)
3267 * associated with the current disk command. 3268 * associated with the current disk command.
3268 * 3269 *
3269 * LOCKING: 3270 * LOCKING:
3270 * spin_lock_irqsave(host_set lock) 3271 * spin_lock_irqsave(host lock)
3271 * 3272 *
3272 */ 3273 */
3273static void ata_fill_sg(struct ata_queued_cmd *qc) 3274static void ata_fill_sg(struct ata_queued_cmd *qc)
@@ -3319,7 +3320,7 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
3319 * supplied PACKET command. 3320 * supplied PACKET command.
3320 * 3321 *
3321 * LOCKING: 3322 * LOCKING:
3322 * spin_lock_irqsave(host_set lock) 3323 * spin_lock_irqsave(host lock)
3323 * 3324 *
3324 * RETURNS: 0 when ATAPI DMA can be used 3325 * RETURNS: 0 when ATAPI DMA can be used
3325 * nonzero otherwise 3326 * nonzero otherwise
@@ -3341,7 +3342,7 @@ int ata_check_atapi_dma(struct ata_queued_cmd *qc)
3341 * Prepare ATA taskfile for submission. 3342 * Prepare ATA taskfile for submission.
3342 * 3343 *
3343 * LOCKING: 3344 * LOCKING:
3344 * spin_lock_irqsave(host_set lock) 3345 * spin_lock_irqsave(host lock)
3345 */ 3346 */
3346void ata_qc_prep(struct ata_queued_cmd *qc) 3347void ata_qc_prep(struct ata_queued_cmd *qc)
3347{ 3348{
@@ -3363,7 +3364,7 @@ void ata_noop_qc_prep(struct ata_queued_cmd *qc) { }
3363 * to point to a single memory buffer, @buf of byte length @buflen. 3364 * to point to a single memory buffer, @buf of byte length @buflen.
3364 * 3365 *
3365 * LOCKING: 3366 * LOCKING:
3366 * spin_lock_irqsave(host_set lock) 3367 * spin_lock_irqsave(host lock)
3367 */ 3368 */
3368 3369
3369void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen) 3370void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen)
@@ -3394,7 +3395,7 @@ void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen)
3394 * elements. 3395 * elements.
3395 * 3396 *
3396 * LOCKING: 3397 * LOCKING:
3397 * spin_lock_irqsave(host_set lock) 3398 * spin_lock_irqsave(host lock)
3398 */ 3399 */
3399 3400
3400void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 3401void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
@@ -3413,7 +3414,7 @@ void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
3413 * DMA-map the memory buffer associated with queued_cmd @qc. 3414 * DMA-map the memory buffer associated with queued_cmd @qc.
3414 * 3415 *
3415 * LOCKING: 3416 * LOCKING:
3416 * spin_lock_irqsave(host_set lock) 3417 * spin_lock_irqsave(host lock)
3417 * 3418 *
3418 * RETURNS: 3419 * RETURNS:
3419 * Zero on success, negative on error. 3420 * Zero on success, negative on error.
@@ -3482,7 +3483,7 @@ skip_map:
3482 * DMA-map the scatter-gather table associated with queued_cmd @qc. 3483 * DMA-map the scatter-gather table associated with queued_cmd @qc.
3483 * 3484 *
3484 * LOCKING: 3485 * LOCKING:
3485 * spin_lock_irqsave(host_set lock) 3486 * spin_lock_irqsave(host lock)
3486 * 3487 *
3487 * RETURNS: 3488 * RETURNS:
3488 * Zero on success, negative on error. 3489 * Zero on success, negative on error.
@@ -3991,7 +3992,7 @@ static inline int ata_hsm_ok_in_wq(struct ata_port *ap, struct ata_queued_cmd *q
3991 * Finish @qc which is running on standard HSM. 3992 * Finish @qc which is running on standard HSM.
3992 * 3993 *
3993 * LOCKING: 3994 * LOCKING:
3994 * If @in_wq is zero, spin_lock_irqsave(host_set lock). 3995 * If @in_wq is zero, spin_lock_irqsave(host lock).
3995 * Otherwise, none on entry and grabs host lock. 3996 * Otherwise, none on entry and grabs host lock.
3996 */ 3997 */
3997static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq) 3998static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq)
@@ -4003,8 +4004,8 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq)
4003 if (in_wq) { 4004 if (in_wq) {
4004 spin_lock_irqsave(ap->lock, flags); 4005 spin_lock_irqsave(ap->lock, flags);
4005 4006
4006 /* EH might have kicked in while host_set lock 4007 /* EH might have kicked in while host lock is
4007 * is released. 4008 * released.
4008 */ 4009 */
4009 qc = ata_qc_from_tag(ap, qc->tag); 4010 qc = ata_qc_from_tag(ap, qc->tag);
4010 if (qc) { 4011 if (qc) {
@@ -4369,7 +4370,7 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev)
4369 * in case something prevents using it. 4370 * in case something prevents using it.
4370 * 4371 *
4371 * LOCKING: 4372 * LOCKING:
4372 * spin_lock_irqsave(host_set lock) 4373 * spin_lock_irqsave(host lock)
4373 */ 4374 */
4374void ata_qc_free(struct ata_queued_cmd *qc) 4375void ata_qc_free(struct ata_queued_cmd *qc)
4375{ 4376{
@@ -4422,7 +4423,7 @@ void __ata_qc_complete(struct ata_queued_cmd *qc)
4422 * command has completed, with either an ok or not-ok status. 4423 * command has completed, with either an ok or not-ok status.
4423 * 4424 *
4424 * LOCKING: 4425 * LOCKING:
4425 * spin_lock_irqsave(host_set lock) 4426 * spin_lock_irqsave(host lock)
4426 */ 4427 */
4427void ata_qc_complete(struct ata_queued_cmd *qc) 4428void ata_qc_complete(struct ata_queued_cmd *qc)
4428{ 4429{
@@ -4485,7 +4486,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
4485 * and commands are completed accordingly. 4486 * and commands are completed accordingly.
4486 * 4487 *
4487 * LOCKING: 4488 * LOCKING:
4488 * spin_lock_irqsave(host_set lock) 4489 * spin_lock_irqsave(host lock)
4489 * 4490 *
4490 * RETURNS: 4491 * RETURNS:
4491 * Number of completed commands on success, -errno otherwise. 4492 * Number of completed commands on success, -errno otherwise.
@@ -4556,7 +4557,7 @@ static inline int ata_should_dma_map(struct ata_queued_cmd *qc)
4556 * writing the taskfile to hardware, starting the command. 4557 * writing the taskfile to hardware, starting the command.
4557 * 4558 *
4558 * LOCKING: 4559 * LOCKING:
4559 * spin_lock_irqsave(host_set lock) 4560 * spin_lock_irqsave(host lock)
4560 */ 4561 */
4561void ata_qc_issue(struct ata_queued_cmd *qc) 4562void ata_qc_issue(struct ata_queued_cmd *qc)
4562{ 4563{
@@ -4617,7 +4618,7 @@ err:
4617 * May be used as the qc_issue() entry in ata_port_operations. 4618 * May be used as the qc_issue() entry in ata_port_operations.
4618 * 4619 *
4619 * LOCKING: 4620 * LOCKING:
4620 * spin_lock_irqsave(host_set lock) 4621 * spin_lock_irqsave(host lock)
4621 * 4622 *
4622 * RETURNS: 4623 * RETURNS:
4623 * Zero on success, AC_ERR_* mask on failure 4624 * Zero on success, AC_ERR_* mask on failure
@@ -4746,7 +4747,7 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc)
4746 * handled via polling with interrupts disabled (nIEN bit). 4747 * handled via polling with interrupts disabled (nIEN bit).
4747 * 4748 *
4748 * LOCKING: 4749 * LOCKING:
4749 * spin_lock_irqsave(host_set lock) 4750 * spin_lock_irqsave(host lock)
4750 * 4751 *
4751 * RETURNS: 4752 * RETURNS:
4752 * One if interrupt was handled, zero if not (shared irq). 4753 * One if interrupt was handled, zero if not (shared irq).
@@ -4833,14 +4834,14 @@ idle_irq:
4833/** 4834/**
4834 * ata_interrupt - Default ATA host interrupt handler 4835 * ata_interrupt - Default ATA host interrupt handler
4835 * @irq: irq line (unused) 4836 * @irq: irq line (unused)
4836 * @dev_instance: pointer to our ata_host_set information structure 4837 * @dev_instance: pointer to our ata_host information structure
4837 * @regs: unused 4838 * @regs: unused
4838 * 4839 *
4839 * Default interrupt handler for PCI IDE devices. Calls 4840 * Default interrupt handler for PCI IDE devices. Calls
4840 * ata_host_intr() for each port that is not disabled. 4841 * ata_host_intr() for each port that is not disabled.
4841 * 4842 *
4842 * LOCKING: 4843 * LOCKING:
4843 * Obtains host_set lock during operation. 4844 * Obtains host lock during operation.
4844 * 4845 *
4845 * RETURNS: 4846 * RETURNS:
4846 * IRQ_NONE or IRQ_HANDLED. 4847 * IRQ_NONE or IRQ_HANDLED.
@@ -4848,18 +4849,18 @@ idle_irq:
4848 4849
4849irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs) 4850irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
4850{ 4851{
4851 struct ata_host_set *host_set = dev_instance; 4852 struct ata_host *host = dev_instance;
4852 unsigned int i; 4853 unsigned int i;
4853 unsigned int handled = 0; 4854 unsigned int handled = 0;
4854 unsigned long flags; 4855 unsigned long flags;
4855 4856
4856 /* TODO: make _irqsave conditional on x86 PCI IDE legacy mode */ 4857 /* TODO: make _irqsave conditional on x86 PCI IDE legacy mode */
4857 spin_lock_irqsave(&host_set->lock, flags); 4858 spin_lock_irqsave(&host->lock, flags);
4858 4859
4859 for (i = 0; i < host_set->n_ports; i++) { 4860 for (i = 0; i < host->n_ports; i++) {
4860 struct ata_port *ap; 4861 struct ata_port *ap;
4861 4862
4862 ap = host_set->ports[i]; 4863 ap = host->ports[i];
4863 if (ap && 4864 if (ap &&
4864 !(ap->flags & ATA_FLAG_DISABLED)) { 4865 !(ap->flags & ATA_FLAG_DISABLED)) {
4865 struct ata_queued_cmd *qc; 4866 struct ata_queued_cmd *qc;
@@ -4871,7 +4872,7 @@ irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
4871 } 4872 }
4872 } 4873 }
4873 4874
4874 spin_unlock_irqrestore(&host_set->lock, flags); 4875 spin_unlock_irqrestore(&host->lock, flags);
4875 4876
4876 return IRQ_RETVAL(handled); 4877 return IRQ_RETVAL(handled);
4877} 4878}
@@ -5036,15 +5037,15 @@ int ata_flush_cache(struct ata_device *dev)
5036 return 0; 5037 return 0;
5037} 5038}
5038 5039
5039static int ata_host_set_request_pm(struct ata_host_set *host_set, 5040static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg,
5040 pm_message_t mesg, unsigned int action, 5041 unsigned int action, unsigned int ehi_flags,
5041 unsigned int ehi_flags, int wait) 5042 int wait)
5042{ 5043{
5043 unsigned long flags; 5044 unsigned long flags;
5044 int i, rc; 5045 int i, rc;
5045 5046
5046 for (i = 0; i < host_set->n_ports; i++) { 5047 for (i = 0; i < host->n_ports; i++) {
5047 struct ata_port *ap = host_set->ports[i]; 5048 struct ata_port *ap = host->ports[i];
5048 5049
5049 /* Previous resume operation might still be in 5050 /* Previous resume operation might still be in
5050 * progress. Wait for PM_PENDING to clear. 5051 * progress. Wait for PM_PENDING to clear.
@@ -5084,11 +5085,11 @@ static int ata_host_set_request_pm(struct ata_host_set *host_set,
5084} 5085}
5085 5086
5086/** 5087/**
5087 * ata_host_set_suspend - suspend host_set 5088 * ata_host_suspend - suspend host
5088 * @host_set: host_set to suspend 5089 * @host: host to suspend
5089 * @mesg: PM message 5090 * @mesg: PM message
5090 * 5091 *
5091 * Suspend @host_set. Actual operation is performed by EH. This 5092 * Suspend @host. Actual operation is performed by EH. This
5092 * function requests EH to perform PM operations and waits for EH 5093 * function requests EH to perform PM operations and waits for EH
5093 * to finish. 5094 * to finish.
5094 * 5095 *
@@ -5098,11 +5099,11 @@ static int ata_host_set_request_pm(struct ata_host_set *host_set,
5098 * RETURNS: 5099 * RETURNS:
5099 * 0 on success, -errno on failure. 5100 * 0 on success, -errno on failure.
5100 */ 5101 */
5101int ata_host_set_suspend(struct ata_host_set *host_set, pm_message_t mesg) 5102int ata_host_suspend(struct ata_host *host, pm_message_t mesg)
5102{ 5103{
5103 int i, j, rc; 5104 int i, j, rc;
5104 5105
5105 rc = ata_host_set_request_pm(host_set, mesg, 0, ATA_EHI_QUIET, 1); 5106 rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1);
5106 if (rc) 5107 if (rc)
5107 goto fail; 5108 goto fail;
5108 5109
@@ -5110,8 +5111,8 @@ int ata_host_set_suspend(struct ata_host_set *host_set, pm_message_t mesg)
5110 * This happens if hotplug occurs between completion of device 5111 * This happens if hotplug occurs between completion of device
5111 * suspension and here. 5112 * suspension and here.
5112 */ 5113 */
5113 for (i = 0; i < host_set->n_ports; i++) { 5114 for (i = 0; i < host->n_ports; i++) {
5114 struct ata_port *ap = host_set->ports[i]; 5115 struct ata_port *ap = host->ports[i];
5115 5116
5116 for (j = 0; j < ATA_MAX_DEVICES; j++) { 5117 for (j = 0; j < ATA_MAX_DEVICES; j++) {
5117 struct ata_device *dev = &ap->device[j]; 5118 struct ata_device *dev = &ap->device[j];
@@ -5126,30 +5127,30 @@ int ata_host_set_suspend(struct ata_host_set *host_set, pm_message_t mesg)
5126 } 5127 }
5127 } 5128 }
5128 5129
5129 host_set->dev->power.power_state = mesg; 5130 host->dev->power.power_state = mesg;
5130 return 0; 5131 return 0;
5131 5132
5132 fail: 5133 fail:
5133 ata_host_set_resume(host_set); 5134 ata_host_resume(host);
5134 return rc; 5135 return rc;
5135} 5136}
5136 5137
5137/** 5138/**
5138 * ata_host_set_resume - resume host_set 5139 * ata_host_resume - resume host
5139 * @host_set: host_set to resume 5140 * @host: host to resume
5140 * 5141 *
5141 * Resume @host_set. Actual operation is performed by EH. This 5142 * Resume @host. Actual operation is performed by EH. This
5142 * function requests EH to perform PM operations and returns. 5143 * function requests EH to perform PM operations and returns.
5143 * Note that all resume operations are performed parallely. 5144 * Note that all resume operations are performed parallely.
5144 * 5145 *
5145 * LOCKING: 5146 * LOCKING:
5146 * Kernel thread context (may sleep). 5147 * Kernel thread context (may sleep).
5147 */ 5148 */
5148void ata_host_set_resume(struct ata_host_set *host_set) 5149void ata_host_resume(struct ata_host *host)
5149{ 5150{
5150 ata_host_set_request_pm(host_set, PMSG_ON, ATA_EH_SOFTRESET, 5151 ata_host_request_pm(host, PMSG_ON, ATA_EH_SOFTRESET,
5151 ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0); 5152 ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, 0);
5152 host_set->dev->power.power_state = PMSG_ON; 5153 host->dev->power.power_state = PMSG_ON;
5153} 5154}
5154 5155
5155/** 5156/**
@@ -5206,10 +5207,10 @@ void ata_port_stop (struct ata_port *ap)
5206 ata_pad_free(ap, dev); 5207 ata_pad_free(ap, dev);
5207} 5208}
5208 5209
5209void ata_host_stop (struct ata_host_set *host_set) 5210void ata_host_stop (struct ata_host *host)
5210{ 5211{
5211 if (host_set->mmio_base) 5212 if (host->mmio_base)
5212 iounmap(host_set->mmio_base); 5213 iounmap(host->mmio_base);
5213} 5214}
5214 5215
5215/** 5216/**
@@ -5231,7 +5232,7 @@ void ata_dev_init(struct ata_device *dev)
5231 5232
5232 /* High bits of dev->flags are used to record warm plug 5233 /* High bits of dev->flags are used to record warm plug
5233 * requests which occur asynchronously. Synchronize using 5234 * requests which occur asynchronously. Synchronize using
5234 * host_set lock. 5235 * host lock.
5235 */ 5236 */
5236 spin_lock_irqsave(ap->lock, flags); 5237 spin_lock_irqsave(ap->lock, flags);
5237 dev->flags &= ~ATA_DFLAG_INIT_MASK; 5238 dev->flags &= ~ATA_DFLAG_INIT_MASK;
@@ -5247,7 +5248,7 @@ void ata_dev_init(struct ata_device *dev)
5247/** 5248/**
5248 * ata_port_init - Initialize an ata_port structure 5249 * ata_port_init - Initialize an ata_port structure
5249 * @ap: Structure to initialize 5250 * @ap: Structure to initialize
5250 * @host_set: Collection of hosts to which @ap belongs 5251 * @host: Collection of hosts to which @ap belongs
5251 * @ent: Probe information provided by low-level driver 5252 * @ent: Probe information provided by low-level driver
5252 * @port_no: Port number associated with this ata_port 5253 * @port_no: Port number associated with this ata_port
5253 * 5254 *
@@ -5256,22 +5257,22 @@ void ata_dev_init(struct ata_device *dev)
5256 * LOCKING: 5257 * LOCKING:
5257 * Inherited from caller. 5258 * Inherited from caller.
5258 */ 5259 */
5259void ata_port_init(struct ata_port *ap, struct ata_host_set *host_set, 5260void ata_port_init(struct ata_port *ap, struct ata_host *host,
5260 const struct ata_probe_ent *ent, unsigned int port_no) 5261 const struct ata_probe_ent *ent, unsigned int port_no)
5261{ 5262{
5262 unsigned int i; 5263 unsigned int i;
5263 5264
5264 ap->lock = &host_set->lock; 5265 ap->lock = &host->lock;
5265 ap->flags = ATA_FLAG_DISABLED; 5266 ap->flags = ATA_FLAG_DISABLED;
5266 ap->id = ata_unique_id++; 5267 ap->id = ata_unique_id++;
5267 ap->ctl = ATA_DEVCTL_OBS; 5268 ap->ctl = ATA_DEVCTL_OBS;
5268 ap->host_set = host_set; 5269 ap->host = host;
5269 ap->dev = ent->dev; 5270 ap->dev = ent->dev;
5270 ap->port_no = port_no; 5271 ap->port_no = port_no;
5271 ap->pio_mask = ent->pio_mask; 5272 ap->pio_mask = ent->pio_mask;
5272 ap->mwdma_mask = ent->mwdma_mask; 5273 ap->mwdma_mask = ent->mwdma_mask;
5273 ap->udma_mask = ent->udma_mask; 5274 ap->udma_mask = ent->udma_mask;
5274 ap->flags |= ent->host_flags; 5275 ap->flags |= ent->port_flags;
5275 ap->ops = ent->port_ops; 5276 ap->ops = ent->port_ops;
5276 ap->hw_sata_spd_limit = UINT_MAX; 5277 ap->hw_sata_spd_limit = UINT_MAX;
5277 ap->active_tag = ATA_TAG_POISON; 5278 ap->active_tag = ATA_TAG_POISON;
@@ -5324,7 +5325,7 @@ void ata_port_init(struct ata_port *ap, struct ata_host_set *host_set,
5324 */ 5325 */
5325static void ata_port_init_shost(struct ata_port *ap, struct Scsi_Host *shost) 5326static void ata_port_init_shost(struct ata_port *ap, struct Scsi_Host *shost)
5326{ 5327{
5327 ap->host = shost; 5328 ap->scsi_host = shost;
5328 5329
5329 shost->unique_id = ap->id; 5330 shost->unique_id = ap->id;
5330 shost->max_id = 16; 5331 shost->max_id = 16;
@@ -5336,7 +5337,7 @@ static void ata_port_init_shost(struct ata_port *ap, struct Scsi_Host *shost)
5336/** 5337/**
5337 * ata_port_add - Attach low-level ATA driver to system 5338 * ata_port_add - Attach low-level ATA driver to system
5338 * @ent: Information provided by low-level driver 5339 * @ent: Information provided by low-level driver
5339 * @host_set: Collections of ports to which we add 5340 * @host: Collections of ports to which we add
5340 * @port_no: Port number associated with this host 5341 * @port_no: Port number associated with this host
5341 * 5342 *
5342 * Attach low-level ATA driver to system. 5343 * Attach low-level ATA driver to system.
@@ -5348,7 +5349,7 @@ static void ata_port_init_shost(struct ata_port *ap, struct Scsi_Host *shost)
5348 * New ata_port on success, for NULL on error. 5349 * New ata_port on success, for NULL on error.
5349 */ 5350 */
5350static struct ata_port * ata_port_add(const struct ata_probe_ent *ent, 5351static struct ata_port * ata_port_add(const struct ata_probe_ent *ent,
5351 struct ata_host_set *host_set, 5352 struct ata_host *host,
5352 unsigned int port_no) 5353 unsigned int port_no)
5353{ 5354{
5354 struct Scsi_Host *shost; 5355 struct Scsi_Host *shost;
@@ -5357,7 +5358,7 @@ static struct ata_port * ata_port_add(const struct ata_probe_ent *ent,
5357 DPRINTK("ENTER\n"); 5358 DPRINTK("ENTER\n");
5358 5359
5359 if (!ent->port_ops->error_handler && 5360 if (!ent->port_ops->error_handler &&
5360 !(ent->host_flags & (ATA_FLAG_SATA_RESET | ATA_FLAG_SRST))) { 5361 !(ent->port_flags & (ATA_FLAG_SATA_RESET | ATA_FLAG_SRST))) {
5361 printk(KERN_ERR "ata%u: no reset mechanism available\n", 5362 printk(KERN_ERR "ata%u: no reset mechanism available\n",
5362 port_no); 5363 port_no);
5363 return NULL; 5364 return NULL;
@@ -5371,32 +5372,31 @@ static struct ata_port * ata_port_add(const struct ata_probe_ent *ent,
5371 5372
5372 ap = ata_shost_to_port(shost); 5373 ap = ata_shost_to_port(shost);
5373 5374
5374 ata_port_init(ap, host_set, ent, port_no); 5375 ata_port_init(ap, host, ent, port_no);
5375 ata_port_init_shost(ap, shost); 5376 ata_port_init_shost(ap, shost);
5376 5377
5377 return ap; 5378 return ap;
5378} 5379}
5379 5380
5380/** 5381/**
5381 * ata_sas_host_init - Initialize a host_set struct 5382 * ata_sas_host_init - Initialize a host struct
5382 * @host_set: host_set to initialize 5383 * @host: host to initialize
5383 * @dev: device host_set is attached to 5384 * @dev: device host is attached to
5384 * @flags: host_set flags 5385 * @flags: host flags
5385 * @ops: port_ops 5386 * @ops: port_ops
5386 * 5387 *
5387 * LOCKING: 5388 * LOCKING:
5388 * PCI/etc. bus probe sem. 5389 * PCI/etc. bus probe sem.
5389 * 5390 *
5390 */ 5391 */
5391 5392
5392void ata_host_set_init(struct ata_host_set *host_set, 5393void ata_host_init(struct ata_host *host, struct device *dev,
5393 struct device *dev, unsigned long flags, 5394 unsigned long flags, const struct ata_port_operations *ops)
5394 const struct ata_port_operations *ops)
5395{ 5395{
5396 spin_lock_init(&host_set->lock); 5396 spin_lock_init(&host->lock);
5397 host_set->dev = dev; 5397 host->dev = dev;
5398 host_set->flags = flags; 5398 host->flags = flags;
5399 host_set->ops = ops; 5399 host->ops = ops;
5400} 5400}
5401 5401
5402/** 5402/**
@@ -5421,34 +5421,34 @@ int ata_device_add(const struct ata_probe_ent *ent)
5421{ 5421{
5422 unsigned int i; 5422 unsigned int i;
5423 struct device *dev = ent->dev; 5423 struct device *dev = ent->dev;
5424 struct ata_host_set *host_set; 5424 struct ata_host *host;
5425 int rc; 5425 int rc;
5426 5426
5427 DPRINTK("ENTER\n"); 5427 DPRINTK("ENTER\n");
5428 /* alloc a container for our list of ATA ports (buses) */ 5428 /* alloc a container for our list of ATA ports (buses) */
5429 host_set = kzalloc(sizeof(struct ata_host_set) + 5429 host = kzalloc(sizeof(struct ata_host) +
5430 (ent->n_ports * sizeof(void *)), GFP_KERNEL); 5430 (ent->n_ports * sizeof(void *)), GFP_KERNEL);
5431 if (!host_set) 5431 if (!host)
5432 return 0; 5432 return 0;
5433 5433
5434 ata_host_set_init(host_set, dev, ent->host_set_flags, ent->port_ops); 5434 ata_host_init(host, dev, ent->_host_flags, ent->port_ops);
5435 host_set->n_ports = ent->n_ports; 5435 host->n_ports = ent->n_ports;
5436 host_set->irq = ent->irq; 5436 host->irq = ent->irq;
5437 host_set->irq2 = ent->irq2; 5437 host->irq2 = ent->irq2;
5438 host_set->mmio_base = ent->mmio_base; 5438 host->mmio_base = ent->mmio_base;
5439 host_set->private_data = ent->private_data; 5439 host->private_data = ent->private_data;
5440 5440
5441 /* register each port bound to this device */ 5441 /* register each port bound to this device */
5442 for (i = 0; i < host_set->n_ports; i++) { 5442 for (i = 0; i < host->n_ports; i++) {
5443 struct ata_port *ap; 5443 struct ata_port *ap;
5444 unsigned long xfer_mode_mask; 5444 unsigned long xfer_mode_mask;
5445 int irq_line = ent->irq; 5445 int irq_line = ent->irq;
5446 5446
5447 ap = ata_port_add(ent, host_set, i); 5447 ap = ata_port_add(ent, host, i);
5448 if (!ap) 5448 if (!ap)
5449 goto err_out; 5449 goto err_out;
5450 5450
5451 host_set->ports[i] = ap; 5451 host->ports[i] = ap;
5452 5452
5453 /* dummy? */ 5453 /* dummy? */
5454 if (ent->dummy_port_mask & (1 << i)) { 5454 if (ent->dummy_port_mask & (1 << i)) {
@@ -5460,8 +5460,8 @@ int ata_device_add(const struct ata_probe_ent *ent)
5460 /* start port */ 5460 /* start port */
5461 rc = ap->ops->port_start(ap); 5461 rc = ap->ops->port_start(ap);
5462 if (rc) { 5462 if (rc) {
5463 host_set->ports[i] = NULL; 5463 host->ports[i] = NULL;
5464 scsi_host_put(ap->host); 5464 scsi_host_put(ap->scsi_host);
5465 goto err_out; 5465 goto err_out;
5466 } 5466 }
5467 5467
@@ -5484,13 +5484,13 @@ int ata_device_add(const struct ata_probe_ent *ent)
5484 irq_line); 5484 irq_line);
5485 5485
5486 ata_chk_status(ap); 5486 ata_chk_status(ap);
5487 host_set->ops->irq_clear(ap); 5487 host->ops->irq_clear(ap);
5488 ata_eh_freeze_port(ap); /* freeze port before requesting IRQ */ 5488 ata_eh_freeze_port(ap); /* freeze port before requesting IRQ */
5489 } 5489 }
5490 5490
5491 /* obtain irq, that may be shared between channels */ 5491 /* obtain irq, that may be shared between channels */
5492 rc = request_irq(ent->irq, ent->port_ops->irq_handler, ent->irq_flags, 5492 rc = request_irq(ent->irq, ent->port_ops->irq_handler, ent->irq_flags,
5493 DRV_NAME, host_set); 5493 DRV_NAME, host);
5494 if (rc) { 5494 if (rc) {
5495 dev_printk(KERN_ERR, dev, "irq %lu request failed: %d\n", 5495 dev_printk(KERN_ERR, dev, "irq %lu request failed: %d\n",
5496 ent->irq, rc); 5496 ent->irq, rc);
@@ -5504,7 +5504,7 @@ int ata_device_add(const struct ata_probe_ent *ent)
5504 BUG_ON(ent->irq == ent->irq2); 5504 BUG_ON(ent->irq == ent->irq2);
5505 5505
5506 rc = request_irq(ent->irq2, ent->port_ops->irq_handler, ent->irq_flags, 5506 rc = request_irq(ent->irq2, ent->port_ops->irq_handler, ent->irq_flags,
5507 DRV_NAME, host_set); 5507 DRV_NAME, host);
5508 if (rc) { 5508 if (rc) {
5509 dev_printk(KERN_ERR, dev, "irq %lu request failed: %d\n", 5509 dev_printk(KERN_ERR, dev, "irq %lu request failed: %d\n",
5510 ent->irq2, rc); 5510 ent->irq2, rc);
@@ -5514,8 +5514,8 @@ int ata_device_add(const struct ata_probe_ent *ent)
5514 5514
5515 /* perform each probe synchronously */ 5515 /* perform each probe synchronously */
5516 DPRINTK("probe begin\n"); 5516 DPRINTK("probe begin\n");
5517 for (i = 0; i < host_set->n_ports; i++) { 5517 for (i = 0; i < host->n_ports; i++) {
5518 struct ata_port *ap = host_set->ports[i]; 5518 struct ata_port *ap = host->ports[i];
5519 u32 scontrol; 5519 u32 scontrol;
5520 int rc; 5520 int rc;
5521 5521
@@ -5526,7 +5526,7 @@ int ata_device_add(const struct ata_probe_ent *ent)
5526 } 5526 }
5527 ap->sata_spd_limit = ap->hw_sata_spd_limit; 5527 ap->sata_spd_limit = ap->hw_sata_spd_limit;
5528 5528
5529 rc = scsi_add_host(ap->host, dev); 5529 rc = scsi_add_host(ap->scsi_host, dev);
5530 if (rc) { 5530 if (rc) {
5531 ata_port_printk(ap, KERN_ERR, "scsi_add_host failed\n"); 5531 ata_port_printk(ap, KERN_ERR, "scsi_add_host failed\n");
5532 /* FIXME: do something useful here */ 5532 /* FIXME: do something useful here */
@@ -5574,29 +5574,29 @@ int ata_device_add(const struct ata_probe_ent *ent)
5574 5574
5575 /* probes are done, now scan each port's disk(s) */ 5575 /* probes are done, now scan each port's disk(s) */
5576 DPRINTK("host probe begin\n"); 5576 DPRINTK("host probe begin\n");
5577 for (i = 0; i < host_set->n_ports; i++) { 5577 for (i = 0; i < host->n_ports; i++) {
5578 struct ata_port *ap = host_set->ports[i]; 5578 struct ata_port *ap = host->ports[i];
5579 5579
5580 ata_scsi_scan_host(ap); 5580 ata_scsi_scan_host(ap);
5581 } 5581 }
5582 5582
5583 dev_set_drvdata(dev, host_set); 5583 dev_set_drvdata(dev, host);
5584 5584
5585 VPRINTK("EXIT, returning %u\n", ent->n_ports); 5585 VPRINTK("EXIT, returning %u\n", ent->n_ports);
5586 return ent->n_ports; /* success */ 5586 return ent->n_ports; /* success */
5587 5587
5588err_out_free_irq: 5588err_out_free_irq:
5589 free_irq(ent->irq, host_set); 5589 free_irq(ent->irq, host);
5590err_out: 5590err_out:
5591 for (i = 0; i < host_set->n_ports; i++) { 5591 for (i = 0; i < host->n_ports; i++) {
5592 struct ata_port *ap = host_set->ports[i]; 5592 struct ata_port *ap = host->ports[i];
5593 if (ap) { 5593 if (ap) {
5594 ap->ops->port_stop(ap); 5594 ap->ops->port_stop(ap);
5595 scsi_host_put(ap->host); 5595 scsi_host_put(ap->scsi_host);
5596 } 5596 }
5597 } 5597 }
5598 5598
5599 kfree(host_set); 5599 kfree(host);
5600 VPRINTK("EXIT, returning 0\n"); 5600 VPRINTK("EXIT, returning 0\n");
5601 return 0; 5601 return 0;
5602} 5602}
@@ -5656,12 +5656,12 @@ void ata_port_detach(struct ata_port *ap)
5656 5656
5657 skip_eh: 5657 skip_eh:
5658 /* remove the associated SCSI host */ 5658 /* remove the associated SCSI host */
5659 scsi_remove_host(ap->host); 5659 scsi_remove_host(ap->scsi_host);
5660} 5660}
5661 5661
5662/** 5662/**
5663 * ata_host_set_remove - PCI layer callback for device removal 5663 * ata_host_remove - PCI layer callback for device removal
5664 * @host_set: ATA host set that was removed 5664 * @host: ATA host set that was removed
5665 * 5665 *
5666 * Unregister all objects associated with this host set. Free those 5666 * Unregister all objects associated with this host set. Free those
5667 * objects. 5667 * objects.
@@ -5670,21 +5670,21 @@ void ata_port_detach(struct ata_port *ap)
5670 * Inherited from calling layer (may sleep). 5670 * Inherited from calling layer (may sleep).
5671 */ 5671 */
5672 5672
5673void ata_host_set_remove(struct ata_host_set *host_set) 5673void ata_host_remove(struct ata_host *host)
5674{ 5674{
5675 unsigned int i; 5675 unsigned int i;
5676 5676
5677 for (i = 0; i < host_set->n_ports; i++) 5677 for (i = 0; i < host->n_ports; i++)
5678 ata_port_detach(host_set->ports[i]); 5678 ata_port_detach(host->ports[i]);
5679 5679
5680 free_irq(host_set->irq, host_set); 5680 free_irq(host->irq, host);
5681 if (host_set->irq2) 5681 if (host->irq2)
5682 free_irq(host_set->irq2, host_set); 5682 free_irq(host->irq2, host);
5683 5683
5684 for (i = 0; i < host_set->n_ports; i++) { 5684 for (i = 0; i < host->n_ports; i++) {
5685 struct ata_port *ap = host_set->ports[i]; 5685 struct ata_port *ap = host->ports[i];
5686 5686
5687 ata_scsi_release(ap->host); 5687 ata_scsi_release(ap->scsi_host);
5688 5688
5689 if ((ap->flags & ATA_FLAG_NO_LEGACY) == 0) { 5689 if ((ap->flags & ATA_FLAG_NO_LEGACY) == 0) {
5690 struct ata_ioports *ioaddr = &ap->ioaddr; 5690 struct ata_ioports *ioaddr = &ap->ioaddr;
@@ -5696,13 +5696,13 @@ void ata_host_set_remove(struct ata_host_set *host_set)
5696 release_region(ATA_SECONDARY_CMD, 8); 5696 release_region(ATA_SECONDARY_CMD, 8);
5697 } 5697 }
5698 5698
5699 scsi_host_put(ap->host); 5699 scsi_host_put(ap->scsi_host);
5700 } 5700 }
5701 5701
5702 if (host_set->ops->host_stop) 5702 if (host->ops->host_stop)
5703 host_set->ops->host_stop(host_set); 5703 host->ops->host_stop(host);
5704 5704
5705 kfree(host_set); 5705 kfree(host);
5706} 5706}
5707 5707
5708/** 5708/**
@@ -5719,9 +5719,9 @@ void ata_host_set_remove(struct ata_host_set *host_set)
5719 * One. 5719 * One.
5720 */ 5720 */
5721 5721
5722int ata_scsi_release(struct Scsi_Host *host) 5722int ata_scsi_release(struct Scsi_Host *shost)
5723{ 5723{
5724 struct ata_port *ap = ata_shost_to_port(host); 5724 struct ata_port *ap = ata_shost_to_port(shost);
5725 5725
5726 DPRINTK("ENTER\n"); 5726 DPRINTK("ENTER\n");
5727 5727
@@ -5748,7 +5748,7 @@ ata_probe_ent_alloc(struct device *dev, const struct ata_port_info *port)
5748 probe_ent->dev = dev; 5748 probe_ent->dev = dev;
5749 5749
5750 probe_ent->sht = port->sht; 5750 probe_ent->sht = port->sht;
5751 probe_ent->host_flags = port->host_flags; 5751 probe_ent->port_flags = port->flags;
5752 probe_ent->pio_mask = port->pio_mask; 5752 probe_ent->pio_mask = port->pio_mask;
5753 probe_ent->mwdma_mask = port->mwdma_mask; 5753 probe_ent->mwdma_mask = port->mwdma_mask;
5754 probe_ent->udma_mask = port->udma_mask; 5754 probe_ent->udma_mask = port->udma_mask;
@@ -5786,11 +5786,11 @@ void ata_std_ports(struct ata_ioports *ioaddr)
5786 5786
5787#ifdef CONFIG_PCI 5787#ifdef CONFIG_PCI
5788 5788
5789void ata_pci_host_stop (struct ata_host_set *host_set) 5789void ata_pci_host_stop (struct ata_host *host)
5790{ 5790{
5791 struct pci_dev *pdev = to_pci_dev(host_set->dev); 5791 struct pci_dev *pdev = to_pci_dev(host->dev);
5792 5792
5793 pci_iounmap(pdev, host_set->mmio_base); 5793 pci_iounmap(pdev, host->mmio_base);
5794} 5794}
5795 5795
5796/** 5796/**
@@ -5810,9 +5810,9 @@ void ata_pci_host_stop (struct ata_host_set *host_set)
5810void ata_pci_remove_one (struct pci_dev *pdev) 5810void ata_pci_remove_one (struct pci_dev *pdev)
5811{ 5811{
5812 struct device *dev = pci_dev_to_dev(pdev); 5812 struct device *dev = pci_dev_to_dev(pdev);
5813 struct ata_host_set *host_set = dev_get_drvdata(dev); 5813 struct ata_host *host = dev_get_drvdata(dev);
5814 5814
5815 ata_host_set_remove(host_set); 5815 ata_host_remove(host);
5816 5816
5817 pci_release_regions(pdev); 5817 pci_release_regions(pdev);
5818 pci_disable_device(pdev); 5818 pci_disable_device(pdev);
@@ -5873,10 +5873,10 @@ void ata_pci_device_do_resume(struct pci_dev *pdev)
5873 5873
5874int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) 5874int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
5875{ 5875{
5876 struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); 5876 struct ata_host *host = dev_get_drvdata(&pdev->dev);
5877 int rc = 0; 5877 int rc = 0;
5878 5878
5879 rc = ata_host_set_suspend(host_set, mesg); 5879 rc = ata_host_suspend(host, mesg);
5880 if (rc) 5880 if (rc)
5881 return rc; 5881 return rc;
5882 5882
@@ -5887,10 +5887,10 @@ int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
5887 5887
5888int ata_pci_device_resume(struct pci_dev *pdev) 5888int ata_pci_device_resume(struct pci_dev *pdev)
5889{ 5889{
5890 struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); 5890 struct ata_host *host = dev_get_drvdata(&pdev->dev);
5891 5891
5892 ata_pci_device_do_resume(pdev); 5892 ata_pci_device_do_resume(pdev);
5893 ata_host_set_resume(host_set); 5893 ata_host_resume(host);
5894 return 0; 5894 return 0;
5895} 5895}
5896#endif /* CONFIG_PCI */ 5896#endif /* CONFIG_PCI */
@@ -6035,10 +6035,10 @@ EXPORT_SYMBOL_GPL(sata_deb_timing_long);
6035EXPORT_SYMBOL_GPL(ata_dummy_port_ops); 6035EXPORT_SYMBOL_GPL(ata_dummy_port_ops);
6036EXPORT_SYMBOL_GPL(ata_std_bios_param); 6036EXPORT_SYMBOL_GPL(ata_std_bios_param);
6037EXPORT_SYMBOL_GPL(ata_std_ports); 6037EXPORT_SYMBOL_GPL(ata_std_ports);
6038EXPORT_SYMBOL_GPL(ata_host_set_init); 6038EXPORT_SYMBOL_GPL(ata_host_init);
6039EXPORT_SYMBOL_GPL(ata_device_add); 6039EXPORT_SYMBOL_GPL(ata_device_add);
6040EXPORT_SYMBOL_GPL(ata_port_detach); 6040EXPORT_SYMBOL_GPL(ata_port_detach);
6041EXPORT_SYMBOL_GPL(ata_host_set_remove); 6041EXPORT_SYMBOL_GPL(ata_host_remove);
6042EXPORT_SYMBOL_GPL(ata_sg_init); 6042EXPORT_SYMBOL_GPL(ata_sg_init);
6043EXPORT_SYMBOL_GPL(ata_sg_init_one); 6043EXPORT_SYMBOL_GPL(ata_sg_init_one);
6044EXPORT_SYMBOL_GPL(ata_hsm_move); 6044EXPORT_SYMBOL_GPL(ata_hsm_move);
@@ -6105,8 +6105,8 @@ EXPORT_SYMBOL_GPL(sata_scr_write);
6105EXPORT_SYMBOL_GPL(sata_scr_write_flush); 6105EXPORT_SYMBOL_GPL(sata_scr_write_flush);
6106EXPORT_SYMBOL_GPL(ata_port_online); 6106EXPORT_SYMBOL_GPL(ata_port_online);
6107EXPORT_SYMBOL_GPL(ata_port_offline); 6107EXPORT_SYMBOL_GPL(ata_port_offline);
6108EXPORT_SYMBOL_GPL(ata_host_set_suspend); 6108EXPORT_SYMBOL_GPL(ata_host_suspend);
6109EXPORT_SYMBOL_GPL(ata_host_set_resume); 6109EXPORT_SYMBOL_GPL(ata_host_resume);
6110EXPORT_SYMBOL_GPL(ata_id_string); 6110EXPORT_SYMBOL_GPL(ata_id_string);
6111EXPORT_SYMBOL_GPL(ata_id_c_string); 6111EXPORT_SYMBOL_GPL(ata_id_c_string);
6112EXPORT_SYMBOL_GPL(ata_scsi_simulate); 6112EXPORT_SYMBOL_GPL(ata_scsi_simulate);
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 2c476eee463f..b1b510493c2d 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -200,7 +200,7 @@ void ata_scsi_error(struct Scsi_Host *host)
200 /* synchronize with port task */ 200 /* synchronize with port task */
201 ata_port_flush_task(ap); 201 ata_port_flush_task(ap);
202 202
203 /* synchronize with host_set lock and sort out timeouts */ 203 /* synchronize with host lock and sort out timeouts */
204 204
205 /* For new EH, all qcs are finished in one of three ways - 205 /* For new EH, all qcs are finished in one of three ways -
206 * normal completion, error completion, and SCSI timeout. 206 * normal completion, error completion, and SCSI timeout.
@@ -377,7 +377,7 @@ void ata_port_wait_eh(struct ata_port *ap)
377 spin_unlock_irqrestore(ap->lock, flags); 377 spin_unlock_irqrestore(ap->lock, flags);
378 378
379 /* make sure SCSI EH is complete */ 379 /* make sure SCSI EH is complete */
380 if (scsi_host_in_recovery(ap->host)) { 380 if (scsi_host_in_recovery(ap->scsi_host)) {
381 msleep(10); 381 msleep(10);
382 goto retry; 382 goto retry;
383 } 383 }
@@ -486,7 +486,7 @@ void ata_eng_timeout(struct ata_port *ap)
486 * other commands are drained. 486 * other commands are drained.
487 * 487 *
488 * LOCKING: 488 * LOCKING:
489 * spin_lock_irqsave(host_set lock) 489 * spin_lock_irqsave(host lock)
490 */ 490 */
491void ata_qc_schedule_eh(struct ata_queued_cmd *qc) 491void ata_qc_schedule_eh(struct ata_queued_cmd *qc)
492{ 492{
@@ -513,14 +513,14 @@ void ata_qc_schedule_eh(struct ata_queued_cmd *qc)
513 * all commands are drained. 513 * all commands are drained.
514 * 514 *
515 * LOCKING: 515 * LOCKING:
516 * spin_lock_irqsave(host_set lock) 516 * spin_lock_irqsave(host lock)
517 */ 517 */
518void ata_port_schedule_eh(struct ata_port *ap) 518void ata_port_schedule_eh(struct ata_port *ap)
519{ 519{
520 WARN_ON(!ap->ops->error_handler); 520 WARN_ON(!ap->ops->error_handler);
521 521
522 ap->pflags |= ATA_PFLAG_EH_PENDING; 522 ap->pflags |= ATA_PFLAG_EH_PENDING;
523 scsi_schedule_eh(ap->host); 523 scsi_schedule_eh(ap->scsi_host);
524 524
525 DPRINTK("port EH scheduled\n"); 525 DPRINTK("port EH scheduled\n");
526} 526}
@@ -532,7 +532,7 @@ void ata_port_schedule_eh(struct ata_port *ap)
532 * Abort all active qc's of @ap and schedule EH. 532 * Abort all active qc's of @ap and schedule EH.
533 * 533 *
534 * LOCKING: 534 * LOCKING:
535 * spin_lock_irqsave(host_set lock) 535 * spin_lock_irqsave(host lock)
536 * 536 *
537 * RETURNS: 537 * RETURNS:
538 * Number of aborted qc's. 538 * Number of aborted qc's.
@@ -575,7 +575,7 @@ int ata_port_abort(struct ata_port *ap)
575 * is frozen. 575 * is frozen.
576 * 576 *
577 * LOCKING: 577 * LOCKING:
578 * spin_lock_irqsave(host_set lock) 578 * spin_lock_irqsave(host lock)
579 */ 579 */
580static void __ata_port_freeze(struct ata_port *ap) 580static void __ata_port_freeze(struct ata_port *ap)
581{ 581{
@@ -596,7 +596,7 @@ static void __ata_port_freeze(struct ata_port *ap)
596 * Abort and freeze @ap. 596 * Abort and freeze @ap.
597 * 597 *
598 * LOCKING: 598 * LOCKING:
599 * spin_lock_irqsave(host_set lock) 599 * spin_lock_irqsave(host lock)
600 * 600 *
601 * RETURNS: 601 * RETURNS:
602 * Number of aborted commands. 602 * Number of aborted commands.
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index d168e3413661..3986ec8741b4 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -321,7 +321,7 @@ int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg)
321 * current command. 321 * current command.
322 * 322 *
323 * LOCKING: 323 * LOCKING:
324 * spin_lock_irqsave(host_set lock) 324 * spin_lock_irqsave(host lock)
325 * 325 *
326 * RETURNS: 326 * RETURNS:
327 * Command allocated, or %NULL if none available. 327 * Command allocated, or %NULL if none available.
@@ -537,7 +537,7 @@ int ata_scsi_device_resume(struct scsi_device *sdev)
537 * format sense blocks. 537 * format sense blocks.
538 * 538 *
539 * LOCKING: 539 * LOCKING:
540 * spin_lock_irqsave(host_set lock) 540 * spin_lock_irqsave(host lock)
541 */ 541 */
542void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, u8 *asc, 542void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, u8 *asc,
543 u8 *ascq, int verbose) 543 u8 *ascq, int verbose)
@@ -649,7 +649,7 @@ void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, u8 *asc,
649 * block. Clear sense key, ASC & ASCQ if there is no error. 649 * block. Clear sense key, ASC & ASCQ if there is no error.
650 * 650 *
651 * LOCKING: 651 * LOCKING:
652 * spin_lock_irqsave(host_set lock) 652 * spin_lock_irqsave(host lock)
653 */ 653 */
654void ata_gen_ata_desc_sense(struct ata_queued_cmd *qc) 654void ata_gen_ata_desc_sense(struct ata_queued_cmd *qc)
655{ 655{
@@ -918,7 +918,7 @@ int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth)
918 * [See SAT revision 5 at www.t10.org] 918 * [See SAT revision 5 at www.t10.org]
919 * 919 *
920 * LOCKING: 920 * LOCKING:
921 * spin_lock_irqsave(host_set lock) 921 * spin_lock_irqsave(host lock)
922 * 922 *
923 * RETURNS: 923 * RETURNS:
924 * Zero on success, non-zero on error. 924 * Zero on success, non-zero on error.
@@ -986,7 +986,7 @@ invalid_fld:
986 * FLUSH CACHE EXT. 986 * FLUSH CACHE EXT.
987 * 987 *
988 * LOCKING: 988 * LOCKING:
989 * spin_lock_irqsave(host_set lock) 989 * spin_lock_irqsave(host lock)
990 * 990 *
991 * RETURNS: 991 * RETURNS:
992 * Zero on success, non-zero on error. 992 * Zero on success, non-zero on error.
@@ -1109,7 +1109,7 @@ static void scsi_16_lba_len(const u8 *scsicmd, u64 *plba, u32 *plen)
1109 * Converts SCSI VERIFY command to an ATA READ VERIFY command. 1109 * Converts SCSI VERIFY command to an ATA READ VERIFY command.
1110 * 1110 *
1111 * LOCKING: 1111 * LOCKING:
1112 * spin_lock_irqsave(host_set lock) 1112 * spin_lock_irqsave(host lock)
1113 * 1113 *
1114 * RETURNS: 1114 * RETURNS:
1115 * Zero on success, non-zero on error. 1115 * Zero on success, non-zero on error.
@@ -1233,7 +1233,7 @@ nothing_to_do:
1233 * %WRITE_16 are currently supported. 1233 * %WRITE_16 are currently supported.
1234 * 1234 *
1235 * LOCKING: 1235 * LOCKING:
1236 * spin_lock_irqsave(host_set lock) 1236 * spin_lock_irqsave(host lock)
1237 * 1237 *
1238 * RETURNS: 1238 * RETURNS:
1239 * Zero on success, non-zero on error. 1239 * Zero on success, non-zero on error.
@@ -1467,7 +1467,7 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1467 * issued to @dev. 1467 * issued to @dev.
1468 * 1468 *
1469 * LOCKING: 1469 * LOCKING:
1470 * spin_lock_irqsave(host_set lock) 1470 * spin_lock_irqsave(host lock)
1471 * 1471 *
1472 * RETURNS: 1472 * RETURNS:
1473 * 1 if deferring is needed, 0 otherwise. 1473 * 1 if deferring is needed, 0 otherwise.
@@ -1510,7 +1510,7 @@ static int ata_scmd_need_defer(struct ata_device *dev, int is_io)
1510 * termination. 1510 * termination.
1511 * 1511 *
1512 * LOCKING: 1512 * LOCKING:
1513 * spin_lock_irqsave(host_set lock) 1513 * spin_lock_irqsave(host lock)
1514 * 1514 *
1515 * RETURNS: 1515 * RETURNS:
1516 * 0 on success, SCSI_ML_QUEUE_DEVICE_BUSY if the command 1516 * 0 on success, SCSI_ML_QUEUE_DEVICE_BUSY if the command
@@ -1589,7 +1589,7 @@ defer:
1589 * Maps buffer contained within SCSI command @cmd. 1589 * Maps buffer contained within SCSI command @cmd.
1590 * 1590 *
1591 * LOCKING: 1591 * LOCKING:
1592 * spin_lock_irqsave(host_set lock) 1592 * spin_lock_irqsave(host lock)
1593 * 1593 *
1594 * RETURNS: 1594 * RETURNS:
1595 * Length of response buffer. 1595 * Length of response buffer.
@@ -1623,7 +1623,7 @@ static unsigned int ata_scsi_rbuf_get(struct scsi_cmnd *cmd, u8 **buf_out)
1623 * Unmaps response buffer contained within @cmd. 1623 * Unmaps response buffer contained within @cmd.
1624 * 1624 *
1625 * LOCKING: 1625 * LOCKING:
1626 * spin_lock_irqsave(host_set lock) 1626 * spin_lock_irqsave(host lock)
1627 */ 1627 */
1628 1628
1629static inline void ata_scsi_rbuf_put(struct scsi_cmnd *cmd, u8 *buf) 1629static inline void ata_scsi_rbuf_put(struct scsi_cmnd *cmd, u8 *buf)
@@ -1649,7 +1649,7 @@ static inline void ata_scsi_rbuf_put(struct scsi_cmnd *cmd, u8 *buf)
1649 * and sense buffer are assumed to be set). 1649 * and sense buffer are assumed to be set).
1650 * 1650 *
1651 * LOCKING: 1651 * LOCKING:
1652 * spin_lock_irqsave(host_set lock) 1652 * spin_lock_irqsave(host lock)
1653 */ 1653 */
1654 1654
1655void ata_scsi_rbuf_fill(struct ata_scsi_args *args, 1655void ata_scsi_rbuf_fill(struct ata_scsi_args *args,
@@ -1680,7 +1680,7 @@ void ata_scsi_rbuf_fill(struct ata_scsi_args *args,
1680 * with non-VPD INQUIRY command output. 1680 * with non-VPD INQUIRY command output.
1681 * 1681 *
1682 * LOCKING: 1682 * LOCKING:
1683 * spin_lock_irqsave(host_set lock) 1683 * spin_lock_irqsave(host lock)
1684 */ 1684 */
1685 1685
1686unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf, 1686unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf,
@@ -1736,7 +1736,7 @@ unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf,
1736 * Returns list of inquiry VPD pages available. 1736 * Returns list of inquiry VPD pages available.
1737 * 1737 *
1738 * LOCKING: 1738 * LOCKING:
1739 * spin_lock_irqsave(host_set lock) 1739 * spin_lock_irqsave(host lock)
1740 */ 1740 */
1741 1741
1742unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf, 1742unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf,
@@ -1764,7 +1764,7 @@ unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf,
1764 * Returns ATA device serial number. 1764 * Returns ATA device serial number.
1765 * 1765 *
1766 * LOCKING: 1766 * LOCKING:
1767 * spin_lock_irqsave(host_set lock) 1767 * spin_lock_irqsave(host lock)
1768 */ 1768 */
1769 1769
1770unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf, 1770unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf,
@@ -1797,7 +1797,7 @@ unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf,
1797 * name ("ATA "), model and serial numbers. 1797 * name ("ATA "), model and serial numbers.
1798 * 1798 *
1799 * LOCKING: 1799 * LOCKING:
1800 * spin_lock_irqsave(host_set lock) 1800 * spin_lock_irqsave(host lock)
1801 */ 1801 */
1802 1802
1803unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf, 1803unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf,
@@ -1849,7 +1849,7 @@ unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf,
1849 * that the caller should successfully complete this SCSI command. 1849 * that the caller should successfully complete this SCSI command.
1850 * 1850 *
1851 * LOCKING: 1851 * LOCKING:
1852 * spin_lock_irqsave(host_set lock) 1852 * spin_lock_irqsave(host lock)
1853 */ 1853 */
1854 1854
1855unsigned int ata_scsiop_noop(struct ata_scsi_args *args, u8 *rbuf, 1855unsigned int ata_scsiop_noop(struct ata_scsi_args *args, u8 *rbuf,
@@ -1990,7 +1990,7 @@ static int ata_dev_supports_fua(u16 *id)
1990 * descriptor for other device types. 1990 * descriptor for other device types.
1991 * 1991 *
1992 * LOCKING: 1992 * LOCKING:
1993 * spin_lock_irqsave(host_set lock) 1993 * spin_lock_irqsave(host lock)
1994 */ 1994 */
1995 1995
1996unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, 1996unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf,
@@ -2129,7 +2129,7 @@ saving_not_supp:
2129 * Simulate READ CAPACITY commands. 2129 * Simulate READ CAPACITY commands.
2130 * 2130 *
2131 * LOCKING: 2131 * LOCKING:
2132 * spin_lock_irqsave(host_set lock) 2132 * spin_lock_irqsave(host lock)
2133 */ 2133 */
2134 2134
2135unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf, 2135unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf,
@@ -2204,7 +2204,7 @@ unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf,
2204 * Simulate REPORT LUNS command. 2204 * Simulate REPORT LUNS command.
2205 * 2205 *
2206 * LOCKING: 2206 * LOCKING:
2207 * spin_lock_irqsave(host_set lock) 2207 * spin_lock_irqsave(host lock)
2208 */ 2208 */
2209 2209
2210unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf, 2210unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf,
@@ -2256,7 +2256,7 @@ void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq)
2256 * and the specified additional sense codes. 2256 * and the specified additional sense codes.
2257 * 2257 *
2258 * LOCKING: 2258 * LOCKING:
2259 * spin_lock_irqsave(host_set lock) 2259 * spin_lock_irqsave(host lock)
2260 */ 2260 */
2261 2261
2262void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8 asc, u8 ascq) 2262void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8 asc, u8 ascq)
@@ -2421,7 +2421,7 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc)
2421 * @scsicmd: SCSI CDB associated with this PACKET command 2421 * @scsicmd: SCSI CDB associated with this PACKET command
2422 * 2422 *
2423 * LOCKING: 2423 * LOCKING:
2424 * spin_lock_irqsave(host_set lock) 2424 * spin_lock_irqsave(host lock)
2425 * 2425 *
2426 * RETURNS: 2426 * RETURNS:
2427 * Zero on success, non-zero on failure. 2427 * Zero on success, non-zero on failure.
@@ -2500,7 +2500,7 @@ static struct ata_device * __ata_scsi_find_dev(struct ata_port *ap,
2500 * Determine if commands should be sent to the specified device. 2500 * Determine if commands should be sent to the specified device.
2501 * 2501 *
2502 * LOCKING: 2502 * LOCKING:
2503 * spin_lock_irqsave(host_set lock) 2503 * spin_lock_irqsave(host lock)
2504 * 2504 *
2505 * RETURNS: 2505 * RETURNS:
2506 * 0 if commands are not allowed / 1 if commands are allowed 2506 * 0 if commands are not allowed / 1 if commands are allowed
@@ -2534,7 +2534,7 @@ static int ata_scsi_dev_enabled(struct ata_device *dev)
2534 * SCSI command to be sent. 2534 * SCSI command to be sent.
2535 * 2535 *
2536 * LOCKING: 2536 * LOCKING:
2537 * spin_lock_irqsave(host_set lock) 2537 * spin_lock_irqsave(host lock)
2538 * 2538 *
2539 * RETURNS: 2539 * RETURNS:
2540 * Associated ATA device, or %NULL if not found. 2540 * Associated ATA device, or %NULL if not found.
@@ -2808,7 +2808,7 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *cmd,
2808 * ATA and ATAPI devices appearing as SCSI devices. 2808 * ATA and ATAPI devices appearing as SCSI devices.
2809 * 2809 *
2810 * LOCKING: 2810 * LOCKING:
2811 * Releases scsi-layer-held lock, and obtains host_set lock. 2811 * Releases scsi-layer-held lock, and obtains host lock.
2812 * 2812 *
2813 * RETURNS: 2813 * RETURNS:
2814 * Return value from __ata_scsi_queuecmd() if @cmd can be queued, 2814 * Return value from __ata_scsi_queuecmd() if @cmd can be queued,
@@ -2852,7 +2852,7 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
2852 * that can be handled internally. 2852 * that can be handled internally.
2853 * 2853 *
2854 * LOCKING: 2854 * LOCKING:
2855 * spin_lock_irqsave(host_set lock) 2855 * spin_lock_irqsave(host lock)
2856 */ 2856 */
2857 2857
2858void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, 2858void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
@@ -2944,7 +2944,7 @@ void ata_scsi_scan_host(struct ata_port *ap)
2944 if (!ata_dev_enabled(dev) || dev->sdev) 2944 if (!ata_dev_enabled(dev) || dev->sdev)
2945 continue; 2945 continue;
2946 2946
2947 sdev = __scsi_add_device(ap->host, 0, i, 0, NULL); 2947 sdev = __scsi_add_device(ap->scsi_host, 0, i, 0, NULL);
2948 if (!IS_ERR(sdev)) { 2948 if (!IS_ERR(sdev)) {
2949 dev->sdev = sdev; 2949 dev->sdev = sdev;
2950 scsi_device_put(sdev); 2950 scsi_device_put(sdev);
@@ -2958,11 +2958,11 @@ void ata_scsi_scan_host(struct ata_port *ap)
2958 * 2958 *
2959 * This function is called from ata_eh_hotplug() and responsible 2959 * This function is called from ata_eh_hotplug() and responsible
2960 * for taking the SCSI device attached to @dev offline. This 2960 * for taking the SCSI device attached to @dev offline. This
2961 * function is called with host_set lock which protects dev->sdev 2961 * function is called with host lock which protects dev->sdev
2962 * against clearing. 2962 * against clearing.
2963 * 2963 *
2964 * LOCKING: 2964 * LOCKING:
2965 * spin_lock_irqsave(host_set lock) 2965 * spin_lock_irqsave(host lock)
2966 * 2966 *
2967 * RETURNS: 2967 * RETURNS:
2968 * 1 if attached SCSI device exists, 0 otherwise. 2968 * 1 if attached SCSI device exists, 0 otherwise.
@@ -2998,16 +2998,16 @@ static void ata_scsi_remove_dev(struct ata_device *dev)
2998 * be removed if there is __scsi_device_get() interface which 2998 * be removed if there is __scsi_device_get() interface which
2999 * increments reference counts regardless of device state. 2999 * increments reference counts regardless of device state.
3000 */ 3000 */
3001 mutex_lock(&ap->host->scan_mutex); 3001 mutex_lock(&ap->scsi_host->scan_mutex);
3002 spin_lock_irqsave(ap->lock, flags); 3002 spin_lock_irqsave(ap->lock, flags);
3003 3003
3004 /* clearing dev->sdev is protected by host_set lock */ 3004 /* clearing dev->sdev is protected by host lock */
3005 sdev = dev->sdev; 3005 sdev = dev->sdev;
3006 dev->sdev = NULL; 3006 dev->sdev = NULL;
3007 3007
3008 if (sdev) { 3008 if (sdev) {
3009 /* If user initiated unplug races with us, sdev can go 3009 /* If user initiated unplug races with us, sdev can go
3010 * away underneath us after the host_set lock and 3010 * away underneath us after the host lock and
3011 * scan_mutex are released. Hold onto it. 3011 * scan_mutex are released. Hold onto it.
3012 */ 3012 */
3013 if (scsi_device_get(sdev) == 0) { 3013 if (scsi_device_get(sdev) == 0) {
@@ -3024,7 +3024,7 @@ static void ata_scsi_remove_dev(struct ata_device *dev)
3024 } 3024 }
3025 3025
3026 spin_unlock_irqrestore(ap->lock, flags); 3026 spin_unlock_irqrestore(ap->lock, flags);
3027 mutex_unlock(&ap->host->scan_mutex); 3027 mutex_unlock(&ap->scsi_host->scan_mutex);
3028 3028
3029 if (sdev) { 3029 if (sdev) {
3030 ata_dev_printk(dev, KERN_INFO, "detaching (SCSI %s)\n", 3030 ata_dev_printk(dev, KERN_INFO, "detaching (SCSI %s)\n",
@@ -3176,7 +3176,7 @@ void ata_scsi_dev_rescan(void *data)
3176 * ata_sas_port_alloc - Allocate port for a SAS attached SATA device 3176 * ata_sas_port_alloc - Allocate port for a SAS attached SATA device
3177 * @pdev: PCI device that the scsi device is attached to 3177 * @pdev: PCI device that the scsi device is attached to
3178 * @port_info: Information from low-level host driver 3178 * @port_info: Information from low-level host driver
3179 * @host: SCSI host that the scsi device is attached to 3179 * @shost: SCSI host that the scsi device is attached to
3180 * 3180 *
3181 * LOCKING: 3181 * LOCKING:
3182 * PCI/etc. bus probe sem. 3182 * PCI/etc. bus probe sem.
@@ -3185,9 +3185,9 @@ void ata_scsi_dev_rescan(void *data)
3185 * ata_port pointer on success / NULL on failure. 3185 * ata_port pointer on success / NULL on failure.
3186 */ 3186 */
3187 3187
3188struct ata_port *ata_sas_port_alloc(struct ata_host_set *host_set, 3188struct ata_port *ata_sas_port_alloc(struct ata_host *host,
3189 struct ata_port_info *port_info, 3189 struct ata_port_info *port_info,
3190 struct Scsi_Host *host) 3190 struct Scsi_Host *shost)
3191{ 3191{
3192 struct ata_port *ap = kzalloc(sizeof(*ap), GFP_KERNEL); 3192 struct ata_port *ap = kzalloc(sizeof(*ap), GFP_KERNEL);
3193 struct ata_probe_ent *ent; 3193 struct ata_probe_ent *ent;
@@ -3195,14 +3195,14 @@ struct ata_port *ata_sas_port_alloc(struct ata_host_set *host_set,
3195 if (!ap) 3195 if (!ap)
3196 return NULL; 3196 return NULL;
3197 3197
3198 ent = ata_probe_ent_alloc(host_set->dev, port_info); 3198 ent = ata_probe_ent_alloc(host->dev, port_info);
3199 if (!ent) { 3199 if (!ent) {
3200 kfree(ap); 3200 kfree(ap);
3201 return NULL; 3201 return NULL;
3202 } 3202 }
3203 3203
3204 ata_port_init(ap, host_set, ent, 0); 3204 ata_port_init(ap, host, ent, 0);
3205 ap->lock = host->host_lock; 3205 ap->lock = shost->host_lock;
3206 kfree(ent); 3206 kfree(ent);
3207 return ap; 3207 return ap;
3208} 3208}
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index d4a4f82360ec..a5ecb71390a9 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -69,7 +69,7 @@ extern int ata_flush_cache(struct ata_device *dev);
69extern void ata_dev_init(struct ata_device *dev); 69extern void ata_dev_init(struct ata_device *dev);
70extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg); 70extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg);
71extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); 71extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg);
72extern void ata_port_init(struct ata_port *ap, struct ata_host_set *host_set, 72extern void ata_port_init(struct ata_port *ap, struct ata_host *host,
73 const struct ata_probe_ent *ent, unsigned int port_no); 73 const struct ata_probe_ent *ent, unsigned int port_no);
74extern struct ata_probe_ent *ata_probe_ent_alloc(struct device *dev, 74extern struct ata_probe_ent *ata_probe_ent_alloc(struct device *dev,
75 const struct ata_port_info *port); 75 const struct ata_port_info *port);
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c
index 61d2aa697b4d..912211ada816 100644
--- a/drivers/ata/pdc_adma.c
+++ b/drivers/ata/pdc_adma.c
@@ -127,7 +127,7 @@ static int adma_ata_init_one (struct pci_dev *pdev,
127static irqreturn_t adma_intr (int irq, void *dev_instance, 127static irqreturn_t adma_intr (int irq, void *dev_instance,
128 struct pt_regs *regs); 128 struct pt_regs *regs);
129static int adma_port_start(struct ata_port *ap); 129static int adma_port_start(struct ata_port *ap);
130static void adma_host_stop(struct ata_host_set *host_set); 130static void adma_host_stop(struct ata_host *host);
131static void adma_port_stop(struct ata_port *ap); 131static void adma_port_stop(struct ata_port *ap);
132static void adma_phy_reset(struct ata_port *ap); 132static void adma_phy_reset(struct ata_port *ap);
133static void adma_qc_prep(struct ata_queued_cmd *qc); 133static void adma_qc_prep(struct ata_queued_cmd *qc);
@@ -182,7 +182,7 @@ static struct ata_port_info adma_port_info[] = {
182 /* board_1841_idx */ 182 /* board_1841_idx */
183 { 183 {
184 .sht = &adma_ata_sht, 184 .sht = &adma_ata_sht,
185 .host_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | 185 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST |
186 ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO | 186 ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO |
187 ATA_FLAG_PIO_POLLING, 187 ATA_FLAG_PIO_POLLING,
188 .pio_mask = 0x10, /* pio4 */ 188 .pio_mask = 0x10, /* pio4 */
@@ -237,7 +237,7 @@ static void adma_reset_engine(void __iomem *chan)
237static void adma_reinit_engine(struct ata_port *ap) 237static void adma_reinit_engine(struct ata_port *ap)
238{ 238{
239 struct adma_port_priv *pp = ap->private_data; 239 struct adma_port_priv *pp = ap->private_data;
240 void __iomem *mmio_base = ap->host_set->mmio_base; 240 void __iomem *mmio_base = ap->host->mmio_base;
241 void __iomem *chan = ADMA_REGS(mmio_base, ap->port_no); 241 void __iomem *chan = ADMA_REGS(mmio_base, ap->port_no);
242 242
243 /* mask/clear ATA interrupts */ 243 /* mask/clear ATA interrupts */
@@ -265,7 +265,7 @@ static void adma_reinit_engine(struct ata_port *ap)
265 265
266static inline void adma_enter_reg_mode(struct ata_port *ap) 266static inline void adma_enter_reg_mode(struct ata_port *ap)
267{ 267{
268 void __iomem *chan = ADMA_REGS(ap->host_set->mmio_base, ap->port_no); 268 void __iomem *chan = ADMA_REGS(ap->host->mmio_base, ap->port_no);
269 269
270 writew(aPIOMD4, chan + ADMA_CONTROL); 270 writew(aPIOMD4, chan + ADMA_CONTROL);
271 readb(chan + ADMA_STATUS); /* flush */ 271 readb(chan + ADMA_STATUS); /* flush */
@@ -412,7 +412,7 @@ static void adma_qc_prep(struct ata_queued_cmd *qc)
412static inline void adma_packet_start(struct ata_queued_cmd *qc) 412static inline void adma_packet_start(struct ata_queued_cmd *qc)
413{ 413{
414 struct ata_port *ap = qc->ap; 414 struct ata_port *ap = qc->ap;
415 void __iomem *chan = ADMA_REGS(ap->host_set->mmio_base, ap->port_no); 415 void __iomem *chan = ADMA_REGS(ap->host->mmio_base, ap->port_no);
416 416
417 VPRINTK("ENTER, ap %p\n", ap); 417 VPRINTK("ENTER, ap %p\n", ap);
418 418
@@ -442,13 +442,13 @@ static unsigned int adma_qc_issue(struct ata_queued_cmd *qc)
442 return ata_qc_issue_prot(qc); 442 return ata_qc_issue_prot(qc);
443} 443}
444 444
445static inline unsigned int adma_intr_pkt(struct ata_host_set *host_set) 445static inline unsigned int adma_intr_pkt(struct ata_host *host)
446{ 446{
447 unsigned int handled = 0, port_no; 447 unsigned int handled = 0, port_no;
448 u8 __iomem *mmio_base = host_set->mmio_base; 448 u8 __iomem *mmio_base = host->mmio_base;
449 449
450 for (port_no = 0; port_no < host_set->n_ports; ++port_no) { 450 for (port_no = 0; port_no < host->n_ports; ++port_no) {
451 struct ata_port *ap = host_set->ports[port_no]; 451 struct ata_port *ap = host->ports[port_no];
452 struct adma_port_priv *pp; 452 struct adma_port_priv *pp;
453 struct ata_queued_cmd *qc; 453 struct ata_queued_cmd *qc;
454 void __iomem *chan = ADMA_REGS(mmio_base, port_no); 454 void __iomem *chan = ADMA_REGS(mmio_base, port_no);
@@ -476,13 +476,13 @@ static inline unsigned int adma_intr_pkt(struct ata_host_set *host_set)
476 return handled; 476 return handled;
477} 477}
478 478
479static inline unsigned int adma_intr_mmio(struct ata_host_set *host_set) 479static inline unsigned int adma_intr_mmio(struct ata_host *host)
480{ 480{
481 unsigned int handled = 0, port_no; 481 unsigned int handled = 0, port_no;
482 482
483 for (port_no = 0; port_no < host_set->n_ports; ++port_no) { 483 for (port_no = 0; port_no < host->n_ports; ++port_no) {
484 struct ata_port *ap; 484 struct ata_port *ap;
485 ap = host_set->ports[port_no]; 485 ap = host->ports[port_no];
486 if (ap && (!(ap->flags & ATA_FLAG_DISABLED))) { 486 if (ap && (!(ap->flags & ATA_FLAG_DISABLED))) {
487 struct ata_queued_cmd *qc; 487 struct ata_queued_cmd *qc;
488 struct adma_port_priv *pp = ap->private_data; 488 struct adma_port_priv *pp = ap->private_data;
@@ -511,14 +511,14 @@ static inline unsigned int adma_intr_mmio(struct ata_host_set *host_set)
511 511
512static irqreturn_t adma_intr(int irq, void *dev_instance, struct pt_regs *regs) 512static irqreturn_t adma_intr(int irq, void *dev_instance, struct pt_regs *regs)
513{ 513{
514 struct ata_host_set *host_set = dev_instance; 514 struct ata_host *host = dev_instance;
515 unsigned int handled = 0; 515 unsigned int handled = 0;
516 516
517 VPRINTK("ENTER\n"); 517 VPRINTK("ENTER\n");
518 518
519 spin_lock(&host_set->lock); 519 spin_lock(&host->lock);
520 handled = adma_intr_pkt(host_set) | adma_intr_mmio(host_set); 520 handled = adma_intr_pkt(host) | adma_intr_mmio(host);
521 spin_unlock(&host_set->lock); 521 spin_unlock(&host->lock);
522 522
523 VPRINTK("EXIT\n"); 523 VPRINTK("EXIT\n");
524 524
@@ -544,7 +544,7 @@ static void adma_ata_setup_port(struct ata_ioports *port, unsigned long base)
544 544
545static int adma_port_start(struct ata_port *ap) 545static int adma_port_start(struct ata_port *ap)
546{ 546{
547 struct device *dev = ap->host_set->dev; 547 struct device *dev = ap->host->dev;
548 struct adma_port_priv *pp; 548 struct adma_port_priv *pp;
549 int rc; 549 int rc;
550 550
@@ -582,10 +582,10 @@ err_out:
582 582
583static void adma_port_stop(struct ata_port *ap) 583static void adma_port_stop(struct ata_port *ap)
584{ 584{
585 struct device *dev = ap->host_set->dev; 585 struct device *dev = ap->host->dev;
586 struct adma_port_priv *pp = ap->private_data; 586 struct adma_port_priv *pp = ap->private_data;
587 587
588 adma_reset_engine(ADMA_REGS(ap->host_set->mmio_base, ap->port_no)); 588 adma_reset_engine(ADMA_REGS(ap->host->mmio_base, ap->port_no));
589 if (pp != NULL) { 589 if (pp != NULL) {
590 ap->private_data = NULL; 590 ap->private_data = NULL;
591 if (pp->pkt != NULL) 591 if (pp->pkt != NULL)
@@ -596,14 +596,14 @@ static void adma_port_stop(struct ata_port *ap)
596 ata_port_stop(ap); 596 ata_port_stop(ap);
597} 597}
598 598
599static void adma_host_stop(struct ata_host_set *host_set) 599static void adma_host_stop(struct ata_host *host)
600{ 600{
601 unsigned int port_no; 601 unsigned int port_no;
602 602
603 for (port_no = 0; port_no < ADMA_PORTS; ++port_no) 603 for (port_no = 0; port_no < ADMA_PORTS; ++port_no)
604 adma_reset_engine(ADMA_REGS(host_set->mmio_base, port_no)); 604 adma_reset_engine(ADMA_REGS(host->mmio_base, port_no));
605 605
606 ata_pci_host_stop(host_set); 606 ata_pci_host_stop(host);
607} 607}
608 608
609static void adma_host_init(unsigned int chip_id, 609static void adma_host_init(unsigned int chip_id,
@@ -684,7 +684,7 @@ static int adma_ata_init_one(struct pci_dev *pdev,
684 INIT_LIST_HEAD(&probe_ent->node); 684 INIT_LIST_HEAD(&probe_ent->node);
685 685
686 probe_ent->sht = adma_port_info[board_idx].sht; 686 probe_ent->sht = adma_port_info[board_idx].sht;
687 probe_ent->host_flags = adma_port_info[board_idx].host_flags; 687 probe_ent->port_flags = adma_port_info[board_idx].flags;
688 probe_ent->pio_mask = adma_port_info[board_idx].pio_mask; 688 probe_ent->pio_mask = adma_port_info[board_idx].pio_mask;
689 probe_ent->mwdma_mask = adma_port_info[board_idx].mwdma_mask; 689 probe_ent->mwdma_mask = adma_port_info[board_idx].mwdma_mask;
690 probe_ent->udma_mask = adma_port_info[board_idx].udma_mask; 690 probe_ent->udma_mask = adma_port_info[board_idx].udma_mask;
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index a2915a56accd..34f1939b44c9 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -342,7 +342,7 @@ static u32 mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in);
342static void mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); 342static void mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val);
343static void mv_phy_reset(struct ata_port *ap); 343static void mv_phy_reset(struct ata_port *ap);
344static void __mv_phy_reset(struct ata_port *ap, int can_sleep); 344static void __mv_phy_reset(struct ata_port *ap, int can_sleep);
345static void mv_host_stop(struct ata_host_set *host_set); 345static void mv_host_stop(struct ata_host *host);
346static int mv_port_start(struct ata_port *ap); 346static int mv_port_start(struct ata_port *ap);
347static void mv_port_stop(struct ata_port *ap); 347static void mv_port_stop(struct ata_port *ap);
348static void mv_qc_prep(struct ata_queued_cmd *qc); 348static void mv_qc_prep(struct ata_queued_cmd *qc);
@@ -480,35 +480,35 @@ static const struct ata_port_operations mv_iie_ops = {
480static const struct ata_port_info mv_port_info[] = { 480static const struct ata_port_info mv_port_info[] = {
481 { /* chip_504x */ 481 { /* chip_504x */
482 .sht = &mv_sht, 482 .sht = &mv_sht,
483 .host_flags = MV_COMMON_FLAGS, 483 .flags = MV_COMMON_FLAGS,
484 .pio_mask = 0x1f, /* pio0-4 */ 484 .pio_mask = 0x1f, /* pio0-4 */
485 .udma_mask = 0x7f, /* udma0-6 */ 485 .udma_mask = 0x7f, /* udma0-6 */
486 .port_ops = &mv5_ops, 486 .port_ops = &mv5_ops,
487 }, 487 },
488 { /* chip_508x */ 488 { /* chip_508x */
489 .sht = &mv_sht, 489 .sht = &mv_sht,
490 .host_flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC), 490 .flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC),
491 .pio_mask = 0x1f, /* pio0-4 */ 491 .pio_mask = 0x1f, /* pio0-4 */
492 .udma_mask = 0x7f, /* udma0-6 */ 492 .udma_mask = 0x7f, /* udma0-6 */
493 .port_ops = &mv5_ops, 493 .port_ops = &mv5_ops,
494 }, 494 },
495 { /* chip_5080 */ 495 { /* chip_5080 */
496 .sht = &mv_sht, 496 .sht = &mv_sht,
497 .host_flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC), 497 .flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC),
498 .pio_mask = 0x1f, /* pio0-4 */ 498 .pio_mask = 0x1f, /* pio0-4 */
499 .udma_mask = 0x7f, /* udma0-6 */ 499 .udma_mask = 0x7f, /* udma0-6 */
500 .port_ops = &mv5_ops, 500 .port_ops = &mv5_ops,
501 }, 501 },
502 { /* chip_604x */ 502 { /* chip_604x */
503 .sht = &mv_sht, 503 .sht = &mv_sht,
504 .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS), 504 .flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS),
505 .pio_mask = 0x1f, /* pio0-4 */ 505 .pio_mask = 0x1f, /* pio0-4 */
506 .udma_mask = 0x7f, /* udma0-6 */ 506 .udma_mask = 0x7f, /* udma0-6 */
507 .port_ops = &mv6_ops, 507 .port_ops = &mv6_ops,
508 }, 508 },
509 { /* chip_608x */ 509 { /* chip_608x */
510 .sht = &mv_sht, 510 .sht = &mv_sht,
511 .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS | 511 .flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS |
512 MV_FLAG_DUAL_HC), 512 MV_FLAG_DUAL_HC),
513 .pio_mask = 0x1f, /* pio0-4 */ 513 .pio_mask = 0x1f, /* pio0-4 */
514 .udma_mask = 0x7f, /* udma0-6 */ 514 .udma_mask = 0x7f, /* udma0-6 */
@@ -516,14 +516,14 @@ static const struct ata_port_info mv_port_info[] = {
516 }, 516 },
517 { /* chip_6042 */ 517 { /* chip_6042 */
518 .sht = &mv_sht, 518 .sht = &mv_sht,
519 .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS), 519 .flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS),
520 .pio_mask = 0x1f, /* pio0-4 */ 520 .pio_mask = 0x1f, /* pio0-4 */
521 .udma_mask = 0x7f, /* udma0-6 */ 521 .udma_mask = 0x7f, /* udma0-6 */
522 .port_ops = &mv_iie_ops, 522 .port_ops = &mv_iie_ops,
523 }, 523 },
524 { /* chip_7042 */ 524 { /* chip_7042 */
525 .sht = &mv_sht, 525 .sht = &mv_sht,
526 .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS | 526 .flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS |
527 MV_FLAG_DUAL_HC), 527 MV_FLAG_DUAL_HC),
528 .pio_mask = 0x1f, /* pio0-4 */ 528 .pio_mask = 0x1f, /* pio0-4 */
529 .udma_mask = 0x7f, /* udma0-6 */ 529 .udma_mask = 0x7f, /* udma0-6 */
@@ -618,12 +618,12 @@ static inline void __iomem *mv_port_base(void __iomem *base, unsigned int port)
618 618
619static inline void __iomem *mv_ap_base(struct ata_port *ap) 619static inline void __iomem *mv_ap_base(struct ata_port *ap)
620{ 620{
621 return mv_port_base(ap->host_set->mmio_base, ap->port_no); 621 return mv_port_base(ap->host->mmio_base, ap->port_no);
622} 622}
623 623
624static inline int mv_get_hc_count(unsigned long host_flags) 624static inline int mv_get_hc_count(unsigned long port_flags)
625{ 625{
626 return ((host_flags & MV_FLAG_DUAL_HC) ? 2 : 1); 626 return ((port_flags & MV_FLAG_DUAL_HC) ? 2 : 1);
627} 627}
628 628
629static void mv_irq_clear(struct ata_port *ap) 629static void mv_irq_clear(struct ata_port *ap)
@@ -809,7 +809,7 @@ static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val)
809 809
810/** 810/**
811 * mv_host_stop - Host specific cleanup/stop routine. 811 * mv_host_stop - Host specific cleanup/stop routine.
812 * @host_set: host data structure 812 * @host: host data structure
813 * 813 *
814 * Disable ints, cleanup host memory, call general purpose 814 * Disable ints, cleanup host memory, call general purpose
815 * host_stop. 815 * host_stop.
@@ -817,10 +817,10 @@ static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val)
817 * LOCKING: 817 * LOCKING:
818 * Inherited from caller. 818 * Inherited from caller.
819 */ 819 */
820static void mv_host_stop(struct ata_host_set *host_set) 820static void mv_host_stop(struct ata_host *host)
821{ 821{
822 struct mv_host_priv *hpriv = host_set->private_data; 822 struct mv_host_priv *hpriv = host->private_data;
823 struct pci_dev *pdev = to_pci_dev(host_set->dev); 823 struct pci_dev *pdev = to_pci_dev(host->dev);
824 824
825 if (hpriv->hp_flags & MV_HP_FLAG_MSI) { 825 if (hpriv->hp_flags & MV_HP_FLAG_MSI) {
826 pci_disable_msi(pdev); 826 pci_disable_msi(pdev);
@@ -828,7 +828,7 @@ static void mv_host_stop(struct ata_host_set *host_set)
828 pci_intx(pdev, 0); 828 pci_intx(pdev, 0);
829 } 829 }
830 kfree(hpriv); 830 kfree(hpriv);
831 ata_host_stop(host_set); 831 ata_host_stop(host);
832} 832}
833 833
834static inline void mv_priv_free(struct mv_port_priv *pp, struct device *dev) 834static inline void mv_priv_free(struct mv_port_priv *pp, struct device *dev)
@@ -875,8 +875,8 @@ static void mv_edma_cfg(struct mv_host_priv *hpriv, void __iomem *port_mmio)
875 */ 875 */
876static int mv_port_start(struct ata_port *ap) 876static int mv_port_start(struct ata_port *ap)
877{ 877{
878 struct device *dev = ap->host_set->dev; 878 struct device *dev = ap->host->dev;
879 struct mv_host_priv *hpriv = ap->host_set->private_data; 879 struct mv_host_priv *hpriv = ap->host->private_data;
880 struct mv_port_priv *pp; 880 struct mv_port_priv *pp;
881 void __iomem *port_mmio = mv_ap_base(ap); 881 void __iomem *port_mmio = mv_ap_base(ap);
882 void *mem; 882 void *mem;
@@ -965,17 +965,17 @@ err_out:
965 * Stop DMA, cleanup port memory. 965 * Stop DMA, cleanup port memory.
966 * 966 *
967 * LOCKING: 967 * LOCKING:
968 * This routine uses the host_set lock to protect the DMA stop. 968 * This routine uses the host lock to protect the DMA stop.
969 */ 969 */
970static void mv_port_stop(struct ata_port *ap) 970static void mv_port_stop(struct ata_port *ap)
971{ 971{
972 struct device *dev = ap->host_set->dev; 972 struct device *dev = ap->host->dev;
973 struct mv_port_priv *pp = ap->private_data; 973 struct mv_port_priv *pp = ap->private_data;
974 unsigned long flags; 974 unsigned long flags;
975 975
976 spin_lock_irqsave(&ap->host_set->lock, flags); 976 spin_lock_irqsave(&ap->host->lock, flags);
977 mv_stop_dma(ap); 977 mv_stop_dma(ap);
978 spin_unlock_irqrestore(&ap->host_set->lock, flags); 978 spin_unlock_irqrestore(&ap->host->lock, flags);
979 979
980 ap->private_data = NULL; 980 ap->private_data = NULL;
981 ata_pad_free(ap, dev); 981 ata_pad_free(ap, dev);
@@ -1330,7 +1330,7 @@ static void mv_err_intr(struct ata_port *ap, int reset_allowed)
1330 1330
1331/** 1331/**
1332 * mv_host_intr - Handle all interrupts on the given host controller 1332 * mv_host_intr - Handle all interrupts on the given host controller
1333 * @host_set: host specific structure 1333 * @host: host specific structure
1334 * @relevant: port error bits relevant to this host controller 1334 * @relevant: port error bits relevant to this host controller
1335 * @hc: which host controller we're to look at 1335 * @hc: which host controller we're to look at
1336 * 1336 *
@@ -1344,10 +1344,9 @@ static void mv_err_intr(struct ata_port *ap, int reset_allowed)
1344 * LOCKING: 1344 * LOCKING:
1345 * Inherited from caller. 1345 * Inherited from caller.
1346 */ 1346 */
1347static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, 1347static void mv_host_intr(struct ata_host *host, u32 relevant, unsigned int hc)
1348 unsigned int hc)
1349{ 1348{
1350 void __iomem *mmio = host_set->mmio_base; 1349 void __iomem *mmio = host->mmio_base;
1351 void __iomem *hc_mmio = mv_hc_base(mmio, hc); 1350 void __iomem *hc_mmio = mv_hc_base(mmio, hc);
1352 struct ata_queued_cmd *qc; 1351 struct ata_queued_cmd *qc;
1353 u32 hc_irq_cause; 1352 u32 hc_irq_cause;
@@ -1371,7 +1370,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant,
1371 1370
1372 for (port = port0; port < port0 + MV_PORTS_PER_HC; port++) { 1371 for (port = port0; port < port0 + MV_PORTS_PER_HC; port++) {
1373 u8 ata_status = 0; 1372 u8 ata_status = 0;
1374 struct ata_port *ap = host_set->ports[port]; 1373 struct ata_port *ap = host->ports[port];
1375 struct mv_port_priv *pp = ap->private_data; 1374 struct mv_port_priv *pp = ap->private_data;
1376 1375
1377 hard_port = mv_hardport_from_port(port); /* range 0..3 */ 1376 hard_port = mv_hardport_from_port(port); /* range 0..3 */
@@ -1444,15 +1443,15 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant,
1444 * reported here. 1443 * reported here.
1445 * 1444 *
1446 * LOCKING: 1445 * LOCKING:
1447 * This routine holds the host_set lock while processing pending 1446 * This routine holds the host lock while processing pending
1448 * interrupts. 1447 * interrupts.
1449 */ 1448 */
1450static irqreturn_t mv_interrupt(int irq, void *dev_instance, 1449static irqreturn_t mv_interrupt(int irq, void *dev_instance,
1451 struct pt_regs *regs) 1450 struct pt_regs *regs)
1452{ 1451{
1453 struct ata_host_set *host_set = dev_instance; 1452 struct ata_host *host = dev_instance;
1454 unsigned int hc, handled = 0, n_hcs; 1453 unsigned int hc, handled = 0, n_hcs;
1455 void __iomem *mmio = host_set->mmio_base; 1454 void __iomem *mmio = host->mmio_base;
1456 struct mv_host_priv *hpriv; 1455 struct mv_host_priv *hpriv;
1457 u32 irq_stat; 1456 u32 irq_stat;
1458 1457
@@ -1465,18 +1464,18 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance,
1465 return IRQ_NONE; 1464 return IRQ_NONE;
1466 } 1465 }
1467 1466
1468 n_hcs = mv_get_hc_count(host_set->ports[0]->flags); 1467 n_hcs = mv_get_hc_count(host->ports[0]->flags);
1469 spin_lock(&host_set->lock); 1468 spin_lock(&host->lock);
1470 1469
1471 for (hc = 0; hc < n_hcs; hc++) { 1470 for (hc = 0; hc < n_hcs; hc++) {
1472 u32 relevant = irq_stat & (HC0_IRQ_PEND << (hc * HC_SHIFT)); 1471 u32 relevant = irq_stat & (HC0_IRQ_PEND << (hc * HC_SHIFT));
1473 if (relevant) { 1472 if (relevant) {
1474 mv_host_intr(host_set, relevant, hc); 1473 mv_host_intr(host, relevant, hc);
1475 handled++; 1474 handled++;
1476 } 1475 }
1477 } 1476 }
1478 1477
1479 hpriv = host_set->private_data; 1478 hpriv = host->private_data;
1480 if (IS_60XX(hpriv)) { 1479 if (IS_60XX(hpriv)) {
1481 /* deal with the interrupt coalescing bits */ 1480 /* deal with the interrupt coalescing bits */
1482 if (irq_stat & (TRAN_LO_DONE | TRAN_HI_DONE | PORTS_0_7_COAL_DONE)) { 1481 if (irq_stat & (TRAN_LO_DONE | TRAN_HI_DONE | PORTS_0_7_COAL_DONE)) {
@@ -1491,12 +1490,12 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance,
1491 readl(mmio + PCI_IRQ_CAUSE_OFS)); 1490 readl(mmio + PCI_IRQ_CAUSE_OFS));
1492 1491
1493 DPRINTK("All regs @ PCI error\n"); 1492 DPRINTK("All regs @ PCI error\n");
1494 mv_dump_all_regs(mmio, -1, to_pci_dev(host_set->dev)); 1493 mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev));
1495 1494
1496 writelfl(0, mmio + PCI_IRQ_CAUSE_OFS); 1495 writelfl(0, mmio + PCI_IRQ_CAUSE_OFS);
1497 handled++; 1496 handled++;
1498 } 1497 }
1499 spin_unlock(&host_set->lock); 1498 spin_unlock(&host->lock);
1500 1499
1501 return IRQ_RETVAL(handled); 1500 return IRQ_RETVAL(handled);
1502} 1501}
@@ -1528,7 +1527,7 @@ static unsigned int mv5_scr_offset(unsigned int sc_reg_in)
1528 1527
1529static u32 mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in) 1528static u32 mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in)
1530{ 1529{
1531 void __iomem *mmio = mv5_phy_base(ap->host_set->mmio_base, ap->port_no); 1530 void __iomem *mmio = mv5_phy_base(ap->host->mmio_base, ap->port_no);
1532 unsigned int ofs = mv5_scr_offset(sc_reg_in); 1531 unsigned int ofs = mv5_scr_offset(sc_reg_in);
1533 1532
1534 if (ofs != 0xffffffffU) 1533 if (ofs != 0xffffffffU)
@@ -1539,7 +1538,7 @@ static u32 mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in)
1539 1538
1540static void mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val) 1539static void mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val)
1541{ 1540{
1542 void __iomem *mmio = mv5_phy_base(ap->host_set->mmio_base, ap->port_no); 1541 void __iomem *mmio = mv5_phy_base(ap->host->mmio_base, ap->port_no);
1543 unsigned int ofs = mv5_scr_offset(sc_reg_in); 1542 unsigned int ofs = mv5_scr_offset(sc_reg_in);
1544 1543
1545 if (ofs != 0xffffffffU) 1544 if (ofs != 0xffffffffU)
@@ -1904,8 +1903,8 @@ static void mv_channel_reset(struct mv_host_priv *hpriv, void __iomem *mmio,
1904 1903
1905static void mv_stop_and_reset(struct ata_port *ap) 1904static void mv_stop_and_reset(struct ata_port *ap)
1906{ 1905{
1907 struct mv_host_priv *hpriv = ap->host_set->private_data; 1906 struct mv_host_priv *hpriv = ap->host->private_data;
1908 void __iomem *mmio = ap->host_set->mmio_base; 1907 void __iomem *mmio = ap->host->mmio_base;
1909 1908
1910 mv_stop_dma(ap); 1909 mv_stop_dma(ap);
1911 1910
@@ -1936,7 +1935,7 @@ static inline void __msleep(unsigned int msec, int can_sleep)
1936static void __mv_phy_reset(struct ata_port *ap, int can_sleep) 1935static void __mv_phy_reset(struct ata_port *ap, int can_sleep)
1937{ 1936{
1938 struct mv_port_priv *pp = ap->private_data; 1937 struct mv_port_priv *pp = ap->private_data;
1939 struct mv_host_priv *hpriv = ap->host_set->private_data; 1938 struct mv_host_priv *hpriv = ap->host->private_data;
1940 void __iomem *port_mmio = mv_ap_base(ap); 1939 void __iomem *port_mmio = mv_ap_base(ap);
1941 struct ata_taskfile tf; 1940 struct ata_taskfile tf;
1942 struct ata_device *dev = &ap->device[0]; 1941 struct ata_device *dev = &ap->device[0];
@@ -2035,7 +2034,7 @@ static void mv_phy_reset(struct ata_port *ap)
2035 * chip/bus, fail the command, and move on. 2034 * chip/bus, fail the command, and move on.
2036 * 2035 *
2037 * LOCKING: 2036 * LOCKING:
2038 * This routine holds the host_set lock while failing the command. 2037 * This routine holds the host lock while failing the command.
2039 */ 2038 */
2040static void mv_eng_timeout(struct ata_port *ap) 2039static void mv_eng_timeout(struct ata_port *ap)
2041{ 2040{
@@ -2044,18 +2043,17 @@ static void mv_eng_timeout(struct ata_port *ap)
2044 2043
2045 ata_port_printk(ap, KERN_ERR, "Entering mv_eng_timeout\n"); 2044 ata_port_printk(ap, KERN_ERR, "Entering mv_eng_timeout\n");
2046 DPRINTK("All regs @ start of eng_timeout\n"); 2045 DPRINTK("All regs @ start of eng_timeout\n");
2047 mv_dump_all_regs(ap->host_set->mmio_base, ap->port_no, 2046 mv_dump_all_regs(ap->host->mmio_base, ap->port_no,
2048 to_pci_dev(ap->host_set->dev)); 2047 to_pci_dev(ap->host->dev));
2049 2048
2050 qc = ata_qc_from_tag(ap, ap->active_tag); 2049 qc = ata_qc_from_tag(ap, ap->active_tag);
2051 printk(KERN_ERR "mmio_base %p ap %p qc %p scsi_cmnd %p &cmnd %p\n", 2050 printk(KERN_ERR "mmio_base %p ap %p qc %p scsi_cmnd %p &cmnd %p\n",
2052 ap->host_set->mmio_base, ap, qc, qc->scsicmd, 2051 ap->host->mmio_base, ap, qc, qc->scsicmd, &qc->scsicmd->cmnd);
2053 &qc->scsicmd->cmnd);
2054 2052
2055 spin_lock_irqsave(&ap->host_set->lock, flags); 2053 spin_lock_irqsave(&ap->host->lock, flags);
2056 mv_err_intr(ap, 0); 2054 mv_err_intr(ap, 0);
2057 mv_stop_and_reset(ap); 2055 mv_stop_and_reset(ap);
2058 spin_unlock_irqrestore(&ap->host_set->lock, flags); 2056 spin_unlock_irqrestore(&ap->host->lock, flags);
2059 2057
2060 WARN_ON(!(qc->flags & ATA_QCFLAG_ACTIVE)); 2058 WARN_ON(!(qc->flags & ATA_QCFLAG_ACTIVE));
2061 if (qc->flags & ATA_QCFLAG_ACTIVE) { 2059 if (qc->flags & ATA_QCFLAG_ACTIVE) {
@@ -2236,7 +2234,7 @@ static int mv_init_host(struct pci_dev *pdev, struct ata_probe_ent *probe_ent,
2236 if (rc) 2234 if (rc)
2237 goto done; 2235 goto done;
2238 2236
2239 n_hc = mv_get_hc_count(probe_ent->host_flags); 2237 n_hc = mv_get_hc_count(probe_ent->port_flags);
2240 probe_ent->n_ports = MV_PORTS_PER_HC * n_hc; 2238 probe_ent->n_ports = MV_PORTS_PER_HC * n_hc;
2241 2239
2242 for (port = 0; port < probe_ent->n_ports; port++) 2240 for (port = 0; port < probe_ent->n_ports; port++)
@@ -2389,7 +2387,7 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2389 memset(hpriv, 0, sizeof(*hpriv)); 2387 memset(hpriv, 0, sizeof(*hpriv));
2390 2388
2391 probe_ent->sht = mv_port_info[board_idx].sht; 2389 probe_ent->sht = mv_port_info[board_idx].sht;
2392 probe_ent->host_flags = mv_port_info[board_idx].host_flags; 2390 probe_ent->port_flags = mv_port_info[board_idx].flags;
2393 probe_ent->pio_mask = mv_port_info[board_idx].pio_mask; 2391 probe_ent->pio_mask = mv_port_info[board_idx].pio_mask;
2394 probe_ent->udma_mask = mv_port_info[board_idx].udma_mask; 2392 probe_ent->udma_mask = mv_port_info[board_idx].udma_mask;
2395 probe_ent->port_ops = mv_port_info[board_idx].port_ops; 2393 probe_ent->port_ops = mv_port_info[board_idx].port_ops;
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index be46df75ab5a..27c22feebf30 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -81,7 +81,7 @@ enum {
81}; 81};
82 82
83static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 83static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
84static void nv_ck804_host_stop(struct ata_host_set *host_set); 84static void nv_ck804_host_stop(struct ata_host *host);
85static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance, 85static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance,
86 struct pt_regs *regs); 86 struct pt_regs *regs);
87static irqreturn_t nv_nf2_interrupt(int irq, void *dev_instance, 87static irqreturn_t nv_nf2_interrupt(int irq, void *dev_instance,
@@ -257,7 +257,7 @@ static struct ata_port_info nv_port_info[] = {
257 /* generic */ 257 /* generic */
258 { 258 {
259 .sht = &nv_sht, 259 .sht = &nv_sht,
260 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, 260 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
261 .pio_mask = NV_PIO_MASK, 261 .pio_mask = NV_PIO_MASK,
262 .mwdma_mask = NV_MWDMA_MASK, 262 .mwdma_mask = NV_MWDMA_MASK,
263 .udma_mask = NV_UDMA_MASK, 263 .udma_mask = NV_UDMA_MASK,
@@ -266,7 +266,7 @@ static struct ata_port_info nv_port_info[] = {
266 /* nforce2/3 */ 266 /* nforce2/3 */
267 { 267 {
268 .sht = &nv_sht, 268 .sht = &nv_sht,
269 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, 269 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
270 .pio_mask = NV_PIO_MASK, 270 .pio_mask = NV_PIO_MASK,
271 .mwdma_mask = NV_MWDMA_MASK, 271 .mwdma_mask = NV_MWDMA_MASK,
272 .udma_mask = NV_UDMA_MASK, 272 .udma_mask = NV_UDMA_MASK,
@@ -275,7 +275,7 @@ static struct ata_port_info nv_port_info[] = {
275 /* ck804 */ 275 /* ck804 */
276 { 276 {
277 .sht = &nv_sht, 277 .sht = &nv_sht,
278 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, 278 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
279 .pio_mask = NV_PIO_MASK, 279 .pio_mask = NV_PIO_MASK,
280 .mwdma_mask = NV_MWDMA_MASK, 280 .mwdma_mask = NV_MWDMA_MASK,
281 .udma_mask = NV_UDMA_MASK, 281 .udma_mask = NV_UDMA_MASK,
@@ -292,17 +292,17 @@ MODULE_VERSION(DRV_VERSION);
292static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance, 292static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance,
293 struct pt_regs *regs) 293 struct pt_regs *regs)
294{ 294{
295 struct ata_host_set *host_set = dev_instance; 295 struct ata_host *host = dev_instance;
296 unsigned int i; 296 unsigned int i;
297 unsigned int handled = 0; 297 unsigned int handled = 0;
298 unsigned long flags; 298 unsigned long flags;
299 299
300 spin_lock_irqsave(&host_set->lock, flags); 300 spin_lock_irqsave(&host->lock, flags);
301 301
302 for (i = 0; i < host_set->n_ports; i++) { 302 for (i = 0; i < host->n_ports; i++) {
303 struct ata_port *ap; 303 struct ata_port *ap;
304 304
305 ap = host_set->ports[i]; 305 ap = host->ports[i];
306 if (ap && 306 if (ap &&
307 !(ap->flags & ATA_FLAG_DISABLED)) { 307 !(ap->flags & ATA_FLAG_DISABLED)) {
308 struct ata_queued_cmd *qc; 308 struct ata_queued_cmd *qc;
@@ -318,7 +318,7 @@ static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance,
318 318
319 } 319 }
320 320
321 spin_unlock_irqrestore(&host_set->lock, flags); 321 spin_unlock_irqrestore(&host->lock, flags);
322 322
323 return IRQ_RETVAL(handled); 323 return IRQ_RETVAL(handled);
324} 324}
@@ -354,12 +354,12 @@ static int nv_host_intr(struct ata_port *ap, u8 irq_stat)
354 return 1; 354 return 1;
355} 355}
356 356
357static irqreturn_t nv_do_interrupt(struct ata_host_set *host_set, u8 irq_stat) 357static irqreturn_t nv_do_interrupt(struct ata_host *host, u8 irq_stat)
358{ 358{
359 int i, handled = 0; 359 int i, handled = 0;
360 360
361 for (i = 0; i < host_set->n_ports; i++) { 361 for (i = 0; i < host->n_ports; i++) {
362 struct ata_port *ap = host_set->ports[i]; 362 struct ata_port *ap = host->ports[i];
363 363
364 if (ap && !(ap->flags & ATA_FLAG_DISABLED)) 364 if (ap && !(ap->flags & ATA_FLAG_DISABLED))
365 handled += nv_host_intr(ap, irq_stat); 365 handled += nv_host_intr(ap, irq_stat);
@@ -373,14 +373,14 @@ static irqreturn_t nv_do_interrupt(struct ata_host_set *host_set, u8 irq_stat)
373static irqreturn_t nv_nf2_interrupt(int irq, void *dev_instance, 373static irqreturn_t nv_nf2_interrupt(int irq, void *dev_instance,
374 struct pt_regs *regs) 374 struct pt_regs *regs)
375{ 375{
376 struct ata_host_set *host_set = dev_instance; 376 struct ata_host *host = dev_instance;
377 u8 irq_stat; 377 u8 irq_stat;
378 irqreturn_t ret; 378 irqreturn_t ret;
379 379
380 spin_lock(&host_set->lock); 380 spin_lock(&host->lock);
381 irq_stat = inb(host_set->ports[0]->ioaddr.scr_addr + NV_INT_STATUS); 381 irq_stat = inb(host->ports[0]->ioaddr.scr_addr + NV_INT_STATUS);
382 ret = nv_do_interrupt(host_set, irq_stat); 382 ret = nv_do_interrupt(host, irq_stat);
383 spin_unlock(&host_set->lock); 383 spin_unlock(&host->lock);
384 384
385 return ret; 385 return ret;
386} 386}
@@ -388,14 +388,14 @@ static irqreturn_t nv_nf2_interrupt(int irq, void *dev_instance,
388static irqreturn_t nv_ck804_interrupt(int irq, void *dev_instance, 388static irqreturn_t nv_ck804_interrupt(int irq, void *dev_instance,
389 struct pt_regs *regs) 389 struct pt_regs *regs)
390{ 390{
391 struct ata_host_set *host_set = dev_instance; 391 struct ata_host *host = dev_instance;
392 u8 irq_stat; 392 u8 irq_stat;
393 irqreturn_t ret; 393 irqreturn_t ret;
394 394
395 spin_lock(&host_set->lock); 395 spin_lock(&host->lock);
396 irq_stat = readb(host_set->mmio_base + NV_INT_STATUS_CK804); 396 irq_stat = readb(host->mmio_base + NV_INT_STATUS_CK804);
397 ret = nv_do_interrupt(host_set, irq_stat); 397 ret = nv_do_interrupt(host, irq_stat);
398 spin_unlock(&host_set->lock); 398 spin_unlock(&host->lock);
399 399
400 return ret; 400 return ret;
401} 401}
@@ -418,7 +418,7 @@ static void nv_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
418 418
419static void nv_nf2_freeze(struct ata_port *ap) 419static void nv_nf2_freeze(struct ata_port *ap)
420{ 420{
421 unsigned long scr_addr = ap->host_set->ports[0]->ioaddr.scr_addr; 421 unsigned long scr_addr = ap->host->ports[0]->ioaddr.scr_addr;
422 int shift = ap->port_no * NV_INT_PORT_SHIFT; 422 int shift = ap->port_no * NV_INT_PORT_SHIFT;
423 u8 mask; 423 u8 mask;
424 424
@@ -429,7 +429,7 @@ static void nv_nf2_freeze(struct ata_port *ap)
429 429
430static void nv_nf2_thaw(struct ata_port *ap) 430static void nv_nf2_thaw(struct ata_port *ap)
431{ 431{
432 unsigned long scr_addr = ap->host_set->ports[0]->ioaddr.scr_addr; 432 unsigned long scr_addr = ap->host->ports[0]->ioaddr.scr_addr;
433 int shift = ap->port_no * NV_INT_PORT_SHIFT; 433 int shift = ap->port_no * NV_INT_PORT_SHIFT;
434 u8 mask; 434 u8 mask;
435 435
@@ -442,7 +442,7 @@ static void nv_nf2_thaw(struct ata_port *ap)
442 442
443static void nv_ck804_freeze(struct ata_port *ap) 443static void nv_ck804_freeze(struct ata_port *ap)
444{ 444{
445 void __iomem *mmio_base = ap->host_set->mmio_base; 445 void __iomem *mmio_base = ap->host->mmio_base;
446 int shift = ap->port_no * NV_INT_PORT_SHIFT; 446 int shift = ap->port_no * NV_INT_PORT_SHIFT;
447 u8 mask; 447 u8 mask;
448 448
@@ -453,7 +453,7 @@ static void nv_ck804_freeze(struct ata_port *ap)
453 453
454static void nv_ck804_thaw(struct ata_port *ap) 454static void nv_ck804_thaw(struct ata_port *ap)
455{ 455{
456 void __iomem *mmio_base = ap->host_set->mmio_base; 456 void __iomem *mmio_base = ap->host->mmio_base;
457 int shift = ap->port_no * NV_INT_PORT_SHIFT; 457 int shift = ap->port_no * NV_INT_PORT_SHIFT;
458 u8 mask; 458 u8 mask;
459 459
@@ -568,9 +568,9 @@ err_out:
568 return rc; 568 return rc;
569} 569}
570 570
571static void nv_ck804_host_stop(struct ata_host_set *host_set) 571static void nv_ck804_host_stop(struct ata_host *host)
572{ 572{
573 struct pci_dev *pdev = to_pci_dev(host_set->dev); 573 struct pci_dev *pdev = to_pci_dev(host->dev);
574 u8 regval; 574 u8 regval;
575 575
576 /* disable SATA space for CK804 */ 576 /* disable SATA space for CK804 */
@@ -578,7 +578,7 @@ static void nv_ck804_host_stop(struct ata_host_set *host_set)
578 regval &= ~NV_MCP_SATA_CFG_20_SATA_SPACE_EN; 578 regval &= ~NV_MCP_SATA_CFG_20_SATA_SPACE_EN;
579 pci_write_config_byte(pdev, NV_MCP_SATA_CFG_20, regval); 579 pci_write_config_byte(pdev, NV_MCP_SATA_CFG_20, regval);
580 580
581 ata_pci_host_stop(host_set); 581 ata_pci_host_stop(host);
582} 582}
583 583
584static int __init nv_init(void) 584static int __init nv_init(void)
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index a5b3a7db7a9f..d627812ea73d 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -104,7 +104,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
104static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); 104static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
105static void pdc_irq_clear(struct ata_port *ap); 105static void pdc_irq_clear(struct ata_port *ap);
106static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc); 106static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc);
107static void pdc_host_stop(struct ata_host_set *host_set); 107static void pdc_host_stop(struct ata_host *host);
108 108
109 109
110static struct scsi_host_template pdc_ata_sht = { 110static struct scsi_host_template pdc_ata_sht = {
@@ -175,7 +175,7 @@ static const struct ata_port_info pdc_port_info[] = {
175 /* board_2037x */ 175 /* board_2037x */
176 { 176 {
177 .sht = &pdc_ata_sht, 177 .sht = &pdc_ata_sht,
178 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA, 178 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
179 .pio_mask = 0x1f, /* pio0-4 */ 179 .pio_mask = 0x1f, /* pio0-4 */
180 .mwdma_mask = 0x07, /* mwdma0-2 */ 180 .mwdma_mask = 0x07, /* mwdma0-2 */
181 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 181 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
@@ -185,7 +185,7 @@ static const struct ata_port_info pdc_port_info[] = {
185 /* board_20319 */ 185 /* board_20319 */
186 { 186 {
187 .sht = &pdc_ata_sht, 187 .sht = &pdc_ata_sht,
188 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA, 188 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
189 .pio_mask = 0x1f, /* pio0-4 */ 189 .pio_mask = 0x1f, /* pio0-4 */
190 .mwdma_mask = 0x07, /* mwdma0-2 */ 190 .mwdma_mask = 0x07, /* mwdma0-2 */
191 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 191 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
@@ -195,7 +195,7 @@ static const struct ata_port_info pdc_port_info[] = {
195 /* board_20619 */ 195 /* board_20619 */
196 { 196 {
197 .sht = &pdc_ata_sht, 197 .sht = &pdc_ata_sht,
198 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS, 198 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS,
199 .pio_mask = 0x1f, /* pio0-4 */ 199 .pio_mask = 0x1f, /* pio0-4 */
200 .mwdma_mask = 0x07, /* mwdma0-2 */ 200 .mwdma_mask = 0x07, /* mwdma0-2 */
201 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 201 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
@@ -205,7 +205,7 @@ static const struct ata_port_info pdc_port_info[] = {
205 /* board_20771 */ 205 /* board_20771 */
206 { 206 {
207 .sht = &pdc_ata_sht, 207 .sht = &pdc_ata_sht,
208 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA, 208 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
209 .pio_mask = 0x1f, /* pio0-4 */ 209 .pio_mask = 0x1f, /* pio0-4 */
210 .mwdma_mask = 0x07, /* mwdma0-2 */ 210 .mwdma_mask = 0x07, /* mwdma0-2 */
211 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 211 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
@@ -215,7 +215,7 @@ static const struct ata_port_info pdc_port_info[] = {
215 /* board_2057x */ 215 /* board_2057x */
216 { 216 {
217 .sht = &pdc_ata_sht, 217 .sht = &pdc_ata_sht,
218 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA, 218 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
219 .pio_mask = 0x1f, /* pio0-4 */ 219 .pio_mask = 0x1f, /* pio0-4 */
220 .mwdma_mask = 0x07, /* mwdma0-2 */ 220 .mwdma_mask = 0x07, /* mwdma0-2 */
221 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 221 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
@@ -225,7 +225,7 @@ static const struct ata_port_info pdc_port_info[] = {
225 /* board_40518 */ 225 /* board_40518 */
226 { 226 {
227 .sht = &pdc_ata_sht, 227 .sht = &pdc_ata_sht,
228 .host_flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA, 228 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
229 .pio_mask = 0x1f, /* pio0-4 */ 229 .pio_mask = 0x1f, /* pio0-4 */
230 .mwdma_mask = 0x07, /* mwdma0-2 */ 230 .mwdma_mask = 0x07, /* mwdma0-2 */
231 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 231 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
@@ -292,7 +292,7 @@ static struct pci_driver pdc_ata_pci_driver = {
292 292
293static int pdc_port_start(struct ata_port *ap) 293static int pdc_port_start(struct ata_port *ap)
294{ 294{
295 struct device *dev = ap->host_set->dev; 295 struct device *dev = ap->host->dev;
296 struct pdc_port_priv *pp; 296 struct pdc_port_priv *pp;
297 int rc; 297 int rc;
298 298
@@ -326,7 +326,7 @@ err_out:
326 326
327static void pdc_port_stop(struct ata_port *ap) 327static void pdc_port_stop(struct ata_port *ap)
328{ 328{
329 struct device *dev = ap->host_set->dev; 329 struct device *dev = ap->host->dev;
330 struct pdc_port_priv *pp = ap->private_data; 330 struct pdc_port_priv *pp = ap->private_data;
331 331
332 ap->private_data = NULL; 332 ap->private_data = NULL;
@@ -336,11 +336,11 @@ static void pdc_port_stop(struct ata_port *ap)
336} 336}
337 337
338 338
339static void pdc_host_stop(struct ata_host_set *host_set) 339static void pdc_host_stop(struct ata_host *host)
340{ 340{
341 struct pdc_host_priv *hp = host_set->private_data; 341 struct pdc_host_priv *hp = host->private_data;
342 342
343 ata_pci_host_stop(host_set); 343 ata_pci_host_stop(host);
344 344
345 kfree(hp); 345 kfree(hp);
346} 346}
@@ -443,14 +443,14 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc)
443 443
444static void pdc_eng_timeout(struct ata_port *ap) 444static void pdc_eng_timeout(struct ata_port *ap)
445{ 445{
446 struct ata_host_set *host_set = ap->host_set; 446 struct ata_host *host = ap->host;
447 u8 drv_stat; 447 u8 drv_stat;
448 struct ata_queued_cmd *qc; 448 struct ata_queued_cmd *qc;
449 unsigned long flags; 449 unsigned long flags;
450 450
451 DPRINTK("ENTER\n"); 451 DPRINTK("ENTER\n");
452 452
453 spin_lock_irqsave(&host_set->lock, flags); 453 spin_lock_irqsave(&host->lock, flags);
454 454
455 qc = ata_qc_from_tag(ap, ap->active_tag); 455 qc = ata_qc_from_tag(ap, ap->active_tag);
456 456
@@ -473,7 +473,7 @@ static void pdc_eng_timeout(struct ata_port *ap)
473 break; 473 break;
474 } 474 }
475 475
476 spin_unlock_irqrestore(&host_set->lock, flags); 476 spin_unlock_irqrestore(&host->lock, flags);
477 ata_eh_qc_complete(qc); 477 ata_eh_qc_complete(qc);
478 DPRINTK("EXIT\n"); 478 DPRINTK("EXIT\n");
479} 479}
@@ -509,15 +509,15 @@ static inline unsigned int pdc_host_intr( struct ata_port *ap,
509 509
510static void pdc_irq_clear(struct ata_port *ap) 510static void pdc_irq_clear(struct ata_port *ap)
511{ 511{
512 struct ata_host_set *host_set = ap->host_set; 512 struct ata_host *host = ap->host;
513 void __iomem *mmio = host_set->mmio_base; 513 void __iomem *mmio = host->mmio_base;
514 514
515 readl(mmio + PDC_INT_SEQMASK); 515 readl(mmio + PDC_INT_SEQMASK);
516} 516}
517 517
518static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *regs) 518static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
519{ 519{
520 struct ata_host_set *host_set = dev_instance; 520 struct ata_host *host = dev_instance;
521 struct ata_port *ap; 521 struct ata_port *ap;
522 u32 mask = 0; 522 u32 mask = 0;
523 unsigned int i, tmp; 523 unsigned int i, tmp;
@@ -526,12 +526,12 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r
526 526
527 VPRINTK("ENTER\n"); 527 VPRINTK("ENTER\n");
528 528
529 if (!host_set || !host_set->mmio_base) { 529 if (!host || !host->mmio_base) {
530 VPRINTK("QUICK EXIT\n"); 530 VPRINTK("QUICK EXIT\n");
531 return IRQ_NONE; 531 return IRQ_NONE;
532 } 532 }
533 533
534 mmio_base = host_set->mmio_base; 534 mmio_base = host->mmio_base;
535 535
536 /* reading should also clear interrupts */ 536 /* reading should also clear interrupts */
537 mask = readl(mmio_base + PDC_INT_SEQMASK); 537 mask = readl(mmio_base + PDC_INT_SEQMASK);
@@ -541,7 +541,7 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r
541 return IRQ_NONE; 541 return IRQ_NONE;
542 } 542 }
543 543
544 spin_lock(&host_set->lock); 544 spin_lock(&host->lock);
545 545
546 mask &= 0xffff; /* only 16 tags possible */ 546 mask &= 0xffff; /* only 16 tags possible */
547 if (!mask) { 547 if (!mask) {
@@ -551,9 +551,9 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r
551 551
552 writel(mask, mmio_base + PDC_INT_SEQMASK); 552 writel(mask, mmio_base + PDC_INT_SEQMASK);
553 553
554 for (i = 0; i < host_set->n_ports; i++) { 554 for (i = 0; i < host->n_ports; i++) {
555 VPRINTK("port %u\n", i); 555 VPRINTK("port %u\n", i);
556 ap = host_set->ports[i]; 556 ap = host->ports[i];
557 tmp = mask & (1 << (i + 1)); 557 tmp = mask & (1 << (i + 1));
558 if (tmp && ap && 558 if (tmp && ap &&
559 !(ap->flags & ATA_FLAG_DISABLED)) { 559 !(ap->flags & ATA_FLAG_DISABLED)) {
@@ -568,7 +568,7 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r
568 VPRINTK("EXIT\n"); 568 VPRINTK("EXIT\n");
569 569
570done_irq: 570done_irq:
571 spin_unlock(&host_set->lock); 571 spin_unlock(&host->lock);
572 return IRQ_RETVAL(handled); 572 return IRQ_RETVAL(handled);
573} 573}
574 574
@@ -581,8 +581,8 @@ static inline void pdc_packet_start(struct ata_queued_cmd *qc)
581 581
582 VPRINTK("ENTER, ap %p\n", ap); 582 VPRINTK("ENTER, ap %p\n", ap);
583 583
584 writel(0x00000001, ap->host_set->mmio_base + (seq * 4)); 584 writel(0x00000001, ap->host->mmio_base + (seq * 4));
585 readl(ap->host_set->mmio_base + (seq * 4)); /* flush */ 585 readl(ap->host->mmio_base + (seq * 4)); /* flush */
586 586
587 pp->pkt[2] = seq; 587 pp->pkt[2] = seq;
588 wmb(); /* flush PRD, pkt writes */ 588 wmb(); /* flush PRD, pkt writes */
@@ -743,7 +743,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
743 probe_ent->private_data = hp; 743 probe_ent->private_data = hp;
744 744
745 probe_ent->sht = pdc_port_info[board_idx].sht; 745 probe_ent->sht = pdc_port_info[board_idx].sht;
746 probe_ent->host_flags = pdc_port_info[board_idx].host_flags; 746 probe_ent->port_flags = pdc_port_info[board_idx].flags;
747 probe_ent->pio_mask = pdc_port_info[board_idx].pio_mask; 747 probe_ent->pio_mask = pdc_port_info[board_idx].pio_mask;
748 probe_ent->mwdma_mask = pdc_port_info[board_idx].mwdma_mask; 748 probe_ent->mwdma_mask = pdc_port_info[board_idx].mwdma_mask;
749 probe_ent->udma_mask = pdc_port_info[board_idx].udma_mask; 749 probe_ent->udma_mask = pdc_port_info[board_idx].udma_mask;
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index 71bd6712b377..fa29dfe2a7b5 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -116,7 +116,7 @@ static void qs_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
116static int qs_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 116static int qs_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
117static irqreturn_t qs_intr (int irq, void *dev_instance, struct pt_regs *regs); 117static irqreturn_t qs_intr (int irq, void *dev_instance, struct pt_regs *regs);
118static int qs_port_start(struct ata_port *ap); 118static int qs_port_start(struct ata_port *ap);
119static void qs_host_stop(struct ata_host_set *host_set); 119static void qs_host_stop(struct ata_host *host);
120static void qs_port_stop(struct ata_port *ap); 120static void qs_port_stop(struct ata_port *ap);
121static void qs_phy_reset(struct ata_port *ap); 121static void qs_phy_reset(struct ata_port *ap);
122static void qs_qc_prep(struct ata_queued_cmd *qc); 122static void qs_qc_prep(struct ata_queued_cmd *qc);
@@ -174,7 +174,7 @@ static const struct ata_port_info qs_port_info[] = {
174 /* board_2068_idx */ 174 /* board_2068_idx */
175 { 175 {
176 .sht = &qs_ata_sht, 176 .sht = &qs_ata_sht,
177 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 177 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
178 ATA_FLAG_SATA_RESET | 178 ATA_FLAG_SATA_RESET |
179 //FIXME ATA_FLAG_SRST | 179 //FIXME ATA_FLAG_SRST |
180 ATA_FLAG_MMIO | ATA_FLAG_PIO_POLLING, 180 ATA_FLAG_MMIO | ATA_FLAG_PIO_POLLING,
@@ -220,7 +220,7 @@ static void qs_irq_clear(struct ata_port *ap)
220 220
221static inline void qs_enter_reg_mode(struct ata_port *ap) 221static inline void qs_enter_reg_mode(struct ata_port *ap)
222{ 222{
223 u8 __iomem *chan = ap->host_set->mmio_base + (ap->port_no * 0x4000); 223 u8 __iomem *chan = ap->host->mmio_base + (ap->port_no * 0x4000);
224 224
225 writeb(QS_CTR0_REG, chan + QS_CCT_CTR0); 225 writeb(QS_CTR0_REG, chan + QS_CCT_CTR0);
226 readb(chan + QS_CCT_CTR0); /* flush */ 226 readb(chan + QS_CCT_CTR0); /* flush */
@@ -228,7 +228,7 @@ static inline void qs_enter_reg_mode(struct ata_port *ap)
228 228
229static inline void qs_reset_channel_logic(struct ata_port *ap) 229static inline void qs_reset_channel_logic(struct ata_port *ap)
230{ 230{
231 u8 __iomem *chan = ap->host_set->mmio_base + (ap->port_no * 0x4000); 231 u8 __iomem *chan = ap->host->mmio_base + (ap->port_no * 0x4000);
232 232
233 writeb(QS_CTR1_RCHN, chan + QS_CCT_CTR1); 233 writeb(QS_CTR1_RCHN, chan + QS_CCT_CTR1);
234 readb(chan + QS_CCT_CTR0); /* flush */ 234 readb(chan + QS_CCT_CTR0); /* flush */
@@ -342,7 +342,7 @@ static void qs_qc_prep(struct ata_queued_cmd *qc)
342static inline void qs_packet_start(struct ata_queued_cmd *qc) 342static inline void qs_packet_start(struct ata_queued_cmd *qc)
343{ 343{
344 struct ata_port *ap = qc->ap; 344 struct ata_port *ap = qc->ap;
345 u8 __iomem *chan = ap->host_set->mmio_base + (ap->port_no * 0x4000); 345 u8 __iomem *chan = ap->host->mmio_base + (ap->port_no * 0x4000);
346 346
347 VPRINTK("ENTER, ap %p\n", ap); 347 VPRINTK("ENTER, ap %p\n", ap);
348 348
@@ -375,11 +375,11 @@ static unsigned int qs_qc_issue(struct ata_queued_cmd *qc)
375 return ata_qc_issue_prot(qc); 375 return ata_qc_issue_prot(qc);
376} 376}
377 377
378static inline unsigned int qs_intr_pkt(struct ata_host_set *host_set) 378static inline unsigned int qs_intr_pkt(struct ata_host *host)
379{ 379{
380 unsigned int handled = 0; 380 unsigned int handled = 0;
381 u8 sFFE; 381 u8 sFFE;
382 u8 __iomem *mmio_base = host_set->mmio_base; 382 u8 __iomem *mmio_base = host->mmio_base;
383 383
384 do { 384 do {
385 u32 sff0 = readl(mmio_base + QS_HST_SFF); 385 u32 sff0 = readl(mmio_base + QS_HST_SFF);
@@ -391,7 +391,7 @@ static inline unsigned int qs_intr_pkt(struct ata_host_set *host_set)
391 u8 sDST = sff0 >> 16; /* dev status */ 391 u8 sDST = sff0 >> 16; /* dev status */
392 u8 sHST = sff1 & 0x3f; /* host status */ 392 u8 sHST = sff1 & 0x3f; /* host status */
393 unsigned int port_no = (sff1 >> 8) & 0x03; 393 unsigned int port_no = (sff1 >> 8) & 0x03;
394 struct ata_port *ap = host_set->ports[port_no]; 394 struct ata_port *ap = host->ports[port_no];
395 395
396 DPRINTK("SFF=%08x%08x: sCHAN=%u sHST=%d sDST=%02x\n", 396 DPRINTK("SFF=%08x%08x: sCHAN=%u sHST=%d sDST=%02x\n",
397 sff1, sff0, port_no, sHST, sDST); 397 sff1, sff0, port_no, sHST, sDST);
@@ -421,13 +421,13 @@ static inline unsigned int qs_intr_pkt(struct ata_host_set *host_set)
421 return handled; 421 return handled;
422} 422}
423 423
424static inline unsigned int qs_intr_mmio(struct ata_host_set *host_set) 424static inline unsigned int qs_intr_mmio(struct ata_host *host)
425{ 425{
426 unsigned int handled = 0, port_no; 426 unsigned int handled = 0, port_no;
427 427
428 for (port_no = 0; port_no < host_set->n_ports; ++port_no) { 428 for (port_no = 0; port_no < host->n_ports; ++port_no) {
429 struct ata_port *ap; 429 struct ata_port *ap;
430 ap = host_set->ports[port_no]; 430 ap = host->ports[port_no];
431 if (ap && 431 if (ap &&
432 !(ap->flags & ATA_FLAG_DISABLED)) { 432 !(ap->flags & ATA_FLAG_DISABLED)) {
433 struct ata_queued_cmd *qc; 433 struct ata_queued_cmd *qc;
@@ -457,14 +457,14 @@ static inline unsigned int qs_intr_mmio(struct ata_host_set *host_set)
457 457
458static irqreturn_t qs_intr(int irq, void *dev_instance, struct pt_regs *regs) 458static irqreturn_t qs_intr(int irq, void *dev_instance, struct pt_regs *regs)
459{ 459{
460 struct ata_host_set *host_set = dev_instance; 460 struct ata_host *host = dev_instance;
461 unsigned int handled = 0; 461 unsigned int handled = 0;
462 462
463 VPRINTK("ENTER\n"); 463 VPRINTK("ENTER\n");
464 464
465 spin_lock(&host_set->lock); 465 spin_lock(&host->lock);
466 handled = qs_intr_pkt(host_set) | qs_intr_mmio(host_set); 466 handled = qs_intr_pkt(host) | qs_intr_mmio(host);
467 spin_unlock(&host_set->lock); 467 spin_unlock(&host->lock);
468 468
469 VPRINTK("EXIT\n"); 469 VPRINTK("EXIT\n");
470 470
@@ -491,9 +491,9 @@ static void qs_ata_setup_port(struct ata_ioports *port, unsigned long base)
491 491
492static int qs_port_start(struct ata_port *ap) 492static int qs_port_start(struct ata_port *ap)
493{ 493{
494 struct device *dev = ap->host_set->dev; 494 struct device *dev = ap->host->dev;
495 struct qs_port_priv *pp; 495 struct qs_port_priv *pp;
496 void __iomem *mmio_base = ap->host_set->mmio_base; 496 void __iomem *mmio_base = ap->host->mmio_base;
497 void __iomem *chan = mmio_base + (ap->port_no * 0x4000); 497 void __iomem *chan = mmio_base + (ap->port_no * 0x4000);
498 u64 addr; 498 u64 addr;
499 int rc; 499 int rc;
@@ -530,7 +530,7 @@ err_out:
530 530
531static void qs_port_stop(struct ata_port *ap) 531static void qs_port_stop(struct ata_port *ap)
532{ 532{
533 struct device *dev = ap->host_set->dev; 533 struct device *dev = ap->host->dev;
534 struct qs_port_priv *pp = ap->private_data; 534 struct qs_port_priv *pp = ap->private_data;
535 535
536 if (pp != NULL) { 536 if (pp != NULL) {
@@ -543,10 +543,10 @@ static void qs_port_stop(struct ata_port *ap)
543 ata_port_stop(ap); 543 ata_port_stop(ap);
544} 544}
545 545
546static void qs_host_stop(struct ata_host_set *host_set) 546static void qs_host_stop(struct ata_host *host)
547{ 547{
548 void __iomem *mmio_base = host_set->mmio_base; 548 void __iomem *mmio_base = host->mmio_base;
549 struct pci_dev *pdev = to_pci_dev(host_set->dev); 549 struct pci_dev *pdev = to_pci_dev(host->dev);
550 550
551 writeb(0, mmio_base + QS_HCT_CTRL); /* disable host interrupts */ 551 writeb(0, mmio_base + QS_HCT_CTRL); /* disable host interrupts */
552 writeb(QS_CNFG3_GSRST, mmio_base + QS_HCF_CNFG3); /* global reset */ 552 writeb(QS_CNFG3_GSRST, mmio_base + QS_HCF_CNFG3); /* global reset */
@@ -673,7 +673,7 @@ static int qs_ata_init_one(struct pci_dev *pdev,
673 INIT_LIST_HEAD(&probe_ent->node); 673 INIT_LIST_HEAD(&probe_ent->node);
674 674
675 probe_ent->sht = qs_port_info[board_idx].sht; 675 probe_ent->sht = qs_port_info[board_idx].sht;
676 probe_ent->host_flags = qs_port_info[board_idx].host_flags; 676 probe_ent->port_flags = qs_port_info[board_idx].flags;
677 probe_ent->pio_mask = qs_port_info[board_idx].pio_mask; 677 probe_ent->pio_mask = qs_port_info[board_idx].pio_mask;
678 probe_ent->mwdma_mask = qs_port_info[board_idx].mwdma_mask; 678 probe_ent->mwdma_mask = qs_port_info[board_idx].mwdma_mask;
679 probe_ent->udma_mask = qs_port_info[board_idx].udma_mask; 679 probe_ent->udma_mask = qs_port_info[board_idx].udma_mask;
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index f17b3ae4dd37..c63dbabc0cd9 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -56,7 +56,7 @@ enum {
56 SIL_FLAG_RERR_ON_DMA_ACT = (1 << 29), 56 SIL_FLAG_RERR_ON_DMA_ACT = (1 << 29),
57 SIL_FLAG_MOD15WRITE = (1 << 30), 57 SIL_FLAG_MOD15WRITE = (1 << 30),
58 58
59 SIL_DFL_HOST_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 59 SIL_DFL_PORT_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
60 ATA_FLAG_MMIO | ATA_FLAG_HRST_TO_RESUME, 60 ATA_FLAG_MMIO | ATA_FLAG_HRST_TO_RESUME,
61 61
62 /* 62 /*
@@ -218,7 +218,7 @@ static const struct ata_port_info sil_port_info[] = {
218 /* sil_3112 */ 218 /* sil_3112 */
219 { 219 {
220 .sht = &sil_sht, 220 .sht = &sil_sht,
221 .host_flags = SIL_DFL_HOST_FLAGS | SIL_FLAG_MOD15WRITE, 221 .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_MOD15WRITE,
222 .pio_mask = 0x1f, /* pio0-4 */ 222 .pio_mask = 0x1f, /* pio0-4 */
223 .mwdma_mask = 0x07, /* mwdma0-2 */ 223 .mwdma_mask = 0x07, /* mwdma0-2 */
224 .udma_mask = 0x3f, /* udma0-5 */ 224 .udma_mask = 0x3f, /* udma0-5 */
@@ -227,7 +227,7 @@ static const struct ata_port_info sil_port_info[] = {
227 /* sil_3112_no_sata_irq */ 227 /* sil_3112_no_sata_irq */
228 { 228 {
229 .sht = &sil_sht, 229 .sht = &sil_sht,
230 .host_flags = SIL_DFL_HOST_FLAGS | SIL_FLAG_MOD15WRITE | 230 .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_MOD15WRITE |
231 SIL_FLAG_NO_SATA_IRQ, 231 SIL_FLAG_NO_SATA_IRQ,
232 .pio_mask = 0x1f, /* pio0-4 */ 232 .pio_mask = 0x1f, /* pio0-4 */
233 .mwdma_mask = 0x07, /* mwdma0-2 */ 233 .mwdma_mask = 0x07, /* mwdma0-2 */
@@ -237,7 +237,7 @@ static const struct ata_port_info sil_port_info[] = {
237 /* sil_3512 */ 237 /* sil_3512 */
238 { 238 {
239 .sht = &sil_sht, 239 .sht = &sil_sht,
240 .host_flags = SIL_DFL_HOST_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT, 240 .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT,
241 .pio_mask = 0x1f, /* pio0-4 */ 241 .pio_mask = 0x1f, /* pio0-4 */
242 .mwdma_mask = 0x07, /* mwdma0-2 */ 242 .mwdma_mask = 0x07, /* mwdma0-2 */
243 .udma_mask = 0x3f, /* udma0-5 */ 243 .udma_mask = 0x3f, /* udma0-5 */
@@ -246,7 +246,7 @@ static const struct ata_port_info sil_port_info[] = {
246 /* sil_3114 */ 246 /* sil_3114 */
247 { 247 {
248 .sht = &sil_sht, 248 .sht = &sil_sht,
249 .host_flags = SIL_DFL_HOST_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT, 249 .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT,
250 .pio_mask = 0x1f, /* pio0-4 */ 250 .pio_mask = 0x1f, /* pio0-4 */
251 .mwdma_mask = 0x07, /* mwdma0-2 */ 251 .mwdma_mask = 0x07, /* mwdma0-2 */
252 .udma_mask = 0x3f, /* udma0-5 */ 252 .udma_mask = 0x3f, /* udma0-5 */
@@ -295,10 +295,9 @@ static unsigned char sil_get_device_cache_line(struct pci_dev *pdev)
295 295
296static void sil_post_set_mode (struct ata_port *ap) 296static void sil_post_set_mode (struct ata_port *ap)
297{ 297{
298 struct ata_host_set *host_set = ap->host_set; 298 struct ata_host *host = ap->host;
299 struct ata_device *dev; 299 struct ata_device *dev;
300 void __iomem *addr = 300 void __iomem *addr = host->mmio_base + sil_port[ap->port_no].xfer_mode;
301 host_set->mmio_base + sil_port[ap->port_no].xfer_mode;
302 u32 tmp, dev_mode[2]; 301 u32 tmp, dev_mode[2];
303 unsigned int i; 302 unsigned int i;
304 303
@@ -440,15 +439,15 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
440static irqreturn_t sil_interrupt(int irq, void *dev_instance, 439static irqreturn_t sil_interrupt(int irq, void *dev_instance,
441 struct pt_regs *regs) 440 struct pt_regs *regs)
442{ 441{
443 struct ata_host_set *host_set = dev_instance; 442 struct ata_host *host = dev_instance;
444 void __iomem *mmio_base = host_set->mmio_base; 443 void __iomem *mmio_base = host->mmio_base;
445 int handled = 0; 444 int handled = 0;
446 int i; 445 int i;
447 446
448 spin_lock(&host_set->lock); 447 spin_lock(&host->lock);
449 448
450 for (i = 0; i < host_set->n_ports; i++) { 449 for (i = 0; i < host->n_ports; i++) {
451 struct ata_port *ap = host_set->ports[i]; 450 struct ata_port *ap = host->ports[i];
452 u32 bmdma2 = readl(mmio_base + sil_port[ap->port_no].bmdma2); 451 u32 bmdma2 = readl(mmio_base + sil_port[ap->port_no].bmdma2);
453 452
454 if (unlikely(!ap || ap->flags & ATA_FLAG_DISABLED)) 453 if (unlikely(!ap || ap->flags & ATA_FLAG_DISABLED))
@@ -466,14 +465,14 @@ static irqreturn_t sil_interrupt(int irq, void *dev_instance,
466 handled = 1; 465 handled = 1;
467 } 466 }
468 467
469 spin_unlock(&host_set->lock); 468 spin_unlock(&host->lock);
470 469
471 return IRQ_RETVAL(handled); 470 return IRQ_RETVAL(handled);
472} 471}
473 472
474static void sil_freeze(struct ata_port *ap) 473static void sil_freeze(struct ata_port *ap)
475{ 474{
476 void __iomem *mmio_base = ap->host_set->mmio_base; 475 void __iomem *mmio_base = ap->host->mmio_base;
477 u32 tmp; 476 u32 tmp;
478 477
479 /* global IRQ mask doesn't block SATA IRQ, turn off explicitly */ 478 /* global IRQ mask doesn't block SATA IRQ, turn off explicitly */
@@ -488,7 +487,7 @@ static void sil_freeze(struct ata_port *ap)
488 487
489static void sil_thaw(struct ata_port *ap) 488static void sil_thaw(struct ata_port *ap)
490{ 489{
491 void __iomem *mmio_base = ap->host_set->mmio_base; 490 void __iomem *mmio_base = ap->host->mmio_base;
492 u32 tmp; 491 u32 tmp;
493 492
494 /* clear IRQ */ 493 /* clear IRQ */
@@ -567,7 +566,7 @@ static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
567} 566}
568 567
569static void sil_init_controller(struct pci_dev *pdev, 568static void sil_init_controller(struct pci_dev *pdev,
570 int n_ports, unsigned long host_flags, 569 int n_ports, unsigned long port_flags,
571 void __iomem *mmio_base) 570 void __iomem *mmio_base)
572{ 571{
573 u8 cls; 572 u8 cls;
@@ -587,7 +586,7 @@ static void sil_init_controller(struct pci_dev *pdev,
587 "cache line size not set. Driver may not function\n"); 586 "cache line size not set. Driver may not function\n");
588 587
589 /* Apply R_ERR on DMA activate FIS errata workaround */ 588 /* Apply R_ERR on DMA activate FIS errata workaround */
590 if (host_flags & SIL_FLAG_RERR_ON_DMA_ACT) { 589 if (port_flags & SIL_FLAG_RERR_ON_DMA_ACT) {
591 int cnt; 590 int cnt;
592 591
593 for (i = 0, cnt = 0; i < n_ports; i++) { 592 for (i = 0, cnt = 0; i < n_ports; i++) {
@@ -658,7 +657,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
658 probe_ent->udma_mask = sil_port_info[ent->driver_data].udma_mask; 657 probe_ent->udma_mask = sil_port_info[ent->driver_data].udma_mask;
659 probe_ent->irq = pdev->irq; 658 probe_ent->irq = pdev->irq;
660 probe_ent->irq_flags = IRQF_SHARED; 659 probe_ent->irq_flags = IRQF_SHARED;
661 probe_ent->host_flags = sil_port_info[ent->driver_data].host_flags; 660 probe_ent->port_flags = sil_port_info[ent->driver_data].flags;
662 661
663 mmio_base = pci_iomap(pdev, 5, 0); 662 mmio_base = pci_iomap(pdev, 5, 0);
664 if (mmio_base == NULL) { 663 if (mmio_base == NULL) {
@@ -679,7 +678,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
679 ata_std_ports(&probe_ent->port[i]); 678 ata_std_ports(&probe_ent->port[i]);
680 } 679 }
681 680
682 sil_init_controller(pdev, probe_ent->n_ports, probe_ent->host_flags, 681 sil_init_controller(pdev, probe_ent->n_ports, probe_ent->port_flags,
683 mmio_base); 682 mmio_base);
684 683
685 pci_set_master(pdev); 684 pci_set_master(pdev);
@@ -703,12 +702,12 @@ err_out:
703#ifdef CONFIG_PM 702#ifdef CONFIG_PM
704static int sil_pci_device_resume(struct pci_dev *pdev) 703static int sil_pci_device_resume(struct pci_dev *pdev)
705{ 704{
706 struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); 705 struct ata_host *host = dev_get_drvdata(&pdev->dev);
707 706
708 ata_pci_device_do_resume(pdev); 707 ata_pci_device_do_resume(pdev);
709 sil_init_controller(pdev, host_set->n_ports, host_set->ports[0]->flags, 708 sil_init_controller(pdev, host->n_ports, host->ports[0]->flags,
710 host_set->mmio_base); 709 host->mmio_base);
711 ata_host_set_resume(host_set); 710 ata_host_resume(host);
712 711
713 return 0; 712 return 0;
714} 713}
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 2d7cf3264587..39cb07baebae 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -316,7 +316,7 @@ struct sil24_port_priv {
316 struct ata_taskfile tf; /* Cached taskfile registers */ 316 struct ata_taskfile tf; /* Cached taskfile registers */
317}; 317};
318 318
319/* ap->host_set->private_data */ 319/* ap->host->private_data */
320struct sil24_host_priv { 320struct sil24_host_priv {
321 void __iomem *host_base; /* global controller control (128 bytes @BAR0) */ 321 void __iomem *host_base; /* global controller control (128 bytes @BAR0) */
322 void __iomem *port_base; /* port registers (4 * 8192 bytes @BAR2) */ 322 void __iomem *port_base; /* port registers (4 * 8192 bytes @BAR2) */
@@ -337,7 +337,7 @@ static void sil24_error_handler(struct ata_port *ap);
337static void sil24_post_internal_cmd(struct ata_queued_cmd *qc); 337static void sil24_post_internal_cmd(struct ata_queued_cmd *qc);
338static int sil24_port_start(struct ata_port *ap); 338static int sil24_port_start(struct ata_port *ap);
339static void sil24_port_stop(struct ata_port *ap); 339static void sil24_port_stop(struct ata_port *ap);
340static void sil24_host_stop(struct ata_host_set *host_set); 340static void sil24_host_stop(struct ata_host *host);
341static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 341static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
342#ifdef CONFIG_PM 342#ifdef CONFIG_PM
343static int sil24_pci_device_resume(struct pci_dev *pdev); 343static int sil24_pci_device_resume(struct pci_dev *pdev);
@@ -415,7 +415,7 @@ static const struct ata_port_operations sil24_ops = {
415}; 415};
416 416
417/* 417/*
418 * Use bits 30-31 of host_flags to encode available port numbers. 418 * Use bits 30-31 of port_flags to encode available port numbers.
419 * Current maxium is 4. 419 * Current maxium is 4.
420 */ 420 */
421#define SIL24_NPORTS2FLAG(nports) ((((unsigned)(nports) - 1) & 0x3) << 30) 421#define SIL24_NPORTS2FLAG(nports) ((((unsigned)(nports) - 1) & 0x3) << 30)
@@ -425,7 +425,7 @@ static struct ata_port_info sil24_port_info[] = {
425 /* sil_3124 */ 425 /* sil_3124 */
426 { 426 {
427 .sht = &sil24_sht, 427 .sht = &sil24_sht,
428 .host_flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(4) | 428 .flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(4) |
429 SIL24_FLAG_PCIX_IRQ_WOC, 429 SIL24_FLAG_PCIX_IRQ_WOC,
430 .pio_mask = 0x1f, /* pio0-4 */ 430 .pio_mask = 0x1f, /* pio0-4 */
431 .mwdma_mask = 0x07, /* mwdma0-2 */ 431 .mwdma_mask = 0x07, /* mwdma0-2 */
@@ -435,7 +435,7 @@ static struct ata_port_info sil24_port_info[] = {
435 /* sil_3132 */ 435 /* sil_3132 */
436 { 436 {
437 .sht = &sil24_sht, 437 .sht = &sil24_sht,
438 .host_flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(2), 438 .flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(2),
439 .pio_mask = 0x1f, /* pio0-4 */ 439 .pio_mask = 0x1f, /* pio0-4 */
440 .mwdma_mask = 0x07, /* mwdma0-2 */ 440 .mwdma_mask = 0x07, /* mwdma0-2 */
441 .udma_mask = 0x3f, /* udma0-5 */ 441 .udma_mask = 0x3f, /* udma0-5 */
@@ -444,7 +444,7 @@ static struct ata_port_info sil24_port_info[] = {
444 /* sil_3131/sil_3531 */ 444 /* sil_3131/sil_3531 */
445 { 445 {
446 .sht = &sil24_sht, 446 .sht = &sil24_sht,
447 .host_flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(1), 447 .flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(1),
448 .pio_mask = 0x1f, /* pio0-4 */ 448 .pio_mask = 0x1f, /* pio0-4 */
449 .mwdma_mask = 0x07, /* mwdma0-2 */ 449 .mwdma_mask = 0x07, /* mwdma0-2 */
450 .udma_mask = 0x3f, /* udma0-5 */ 450 .udma_mask = 0x3f, /* udma0-5 */
@@ -871,8 +871,8 @@ static inline void sil24_host_intr(struct ata_port *ap)
871 871
872static irqreturn_t sil24_interrupt(int irq, void *dev_instance, struct pt_regs *regs) 872static irqreturn_t sil24_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
873{ 873{
874 struct ata_host_set *host_set = dev_instance; 874 struct ata_host *host = dev_instance;
875 struct sil24_host_priv *hpriv = host_set->private_data; 875 struct sil24_host_priv *hpriv = host->private_data;
876 unsigned handled = 0; 876 unsigned handled = 0;
877 u32 status; 877 u32 status;
878 int i; 878 int i;
@@ -888,20 +888,20 @@ static irqreturn_t sil24_interrupt(int irq, void *dev_instance, struct pt_regs *
888 if (!(status & IRQ_STAT_4PORTS)) 888 if (!(status & IRQ_STAT_4PORTS))
889 goto out; 889 goto out;
890 890
891 spin_lock(&host_set->lock); 891 spin_lock(&host->lock);
892 892
893 for (i = 0; i < host_set->n_ports; i++) 893 for (i = 0; i < host->n_ports; i++)
894 if (status & (1 << i)) { 894 if (status & (1 << i)) {
895 struct ata_port *ap = host_set->ports[i]; 895 struct ata_port *ap = host->ports[i];
896 if (ap && !(ap->flags & ATA_FLAG_DISABLED)) { 896 if (ap && !(ap->flags & ATA_FLAG_DISABLED)) {
897 sil24_host_intr(host_set->ports[i]); 897 sil24_host_intr(host->ports[i]);
898 handled++; 898 handled++;
899 } else 899 } else
900 printk(KERN_ERR DRV_NAME 900 printk(KERN_ERR DRV_NAME
901 ": interrupt from disabled port %d\n", i); 901 ": interrupt from disabled port %d\n", i);
902 } 902 }
903 903
904 spin_unlock(&host_set->lock); 904 spin_unlock(&host->lock);
905 out: 905 out:
906 return IRQ_RETVAL(handled); 906 return IRQ_RETVAL(handled);
907} 907}
@@ -941,7 +941,7 @@ static inline void sil24_cblk_free(struct sil24_port_priv *pp, struct device *de
941 941
942static int sil24_port_start(struct ata_port *ap) 942static int sil24_port_start(struct ata_port *ap)
943{ 943{
944 struct device *dev = ap->host_set->dev; 944 struct device *dev = ap->host->dev;
945 struct sil24_port_priv *pp; 945 struct sil24_port_priv *pp;
946 union sil24_cmd_block *cb; 946 union sil24_cmd_block *cb;
947 size_t cb_size = sizeof(*cb) * SIL24_MAX_CMDS; 947 size_t cb_size = sizeof(*cb) * SIL24_MAX_CMDS;
@@ -980,7 +980,7 @@ err_out:
980 980
981static void sil24_port_stop(struct ata_port *ap) 981static void sil24_port_stop(struct ata_port *ap)
982{ 982{
983 struct device *dev = ap->host_set->dev; 983 struct device *dev = ap->host->dev;
984 struct sil24_port_priv *pp = ap->private_data; 984 struct sil24_port_priv *pp = ap->private_data;
985 985
986 sil24_cblk_free(pp, dev); 986 sil24_cblk_free(pp, dev);
@@ -988,10 +988,10 @@ static void sil24_port_stop(struct ata_port *ap)
988 kfree(pp); 988 kfree(pp);
989} 989}
990 990
991static void sil24_host_stop(struct ata_host_set *host_set) 991static void sil24_host_stop(struct ata_host *host)
992{ 992{
993 struct sil24_host_priv *hpriv = host_set->private_data; 993 struct sil24_host_priv *hpriv = host->private_data;
994 struct pci_dev *pdev = to_pci_dev(host_set->dev); 994 struct pci_dev *pdev = to_pci_dev(host->dev);
995 995
996 pci_iounmap(pdev, hpriv->host_base); 996 pci_iounmap(pdev, hpriv->host_base);
997 pci_iounmap(pdev, hpriv->port_base); 997 pci_iounmap(pdev, hpriv->port_base);
@@ -999,7 +999,7 @@ static void sil24_host_stop(struct ata_host_set *host_set)
999} 999}
1000 1000
1001static void sil24_init_controller(struct pci_dev *pdev, int n_ports, 1001static void sil24_init_controller(struct pci_dev *pdev, int n_ports,
1002 unsigned long host_flags, 1002 unsigned long port_flags,
1003 void __iomem *host_base, 1003 void __iomem *host_base,
1004 void __iomem *port_base) 1004 void __iomem *port_base)
1005{ 1005{
@@ -1032,7 +1032,7 @@ static void sil24_init_controller(struct pci_dev *pdev, int n_ports,
1032 } 1032 }
1033 1033
1034 /* Configure IRQ WoC */ 1034 /* Configure IRQ WoC */
1035 if (host_flags & SIL24_FLAG_PCIX_IRQ_WOC) 1035 if (port_flags & SIL24_FLAG_PCIX_IRQ_WOC)
1036 writel(PORT_CS_IRQ_WOC, port + PORT_CTRL_STAT); 1036 writel(PORT_CS_IRQ_WOC, port + PORT_CTRL_STAT);
1037 else 1037 else
1038 writel(PORT_CS_IRQ_WOC, port + PORT_CTRL_CLR); 1038 writel(PORT_CS_IRQ_WOC, port + PORT_CTRL_CLR);
@@ -1101,12 +1101,12 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1101 INIT_LIST_HEAD(&probe_ent->node); 1101 INIT_LIST_HEAD(&probe_ent->node);
1102 1102
1103 probe_ent->sht = pinfo->sht; 1103 probe_ent->sht = pinfo->sht;
1104 probe_ent->host_flags = pinfo->host_flags; 1104 probe_ent->port_flags = pinfo->flags;
1105 probe_ent->pio_mask = pinfo->pio_mask; 1105 probe_ent->pio_mask = pinfo->pio_mask;
1106 probe_ent->mwdma_mask = pinfo->mwdma_mask; 1106 probe_ent->mwdma_mask = pinfo->mwdma_mask;
1107 probe_ent->udma_mask = pinfo->udma_mask; 1107 probe_ent->udma_mask = pinfo->udma_mask;
1108 probe_ent->port_ops = pinfo->port_ops; 1108 probe_ent->port_ops = pinfo->port_ops;
1109 probe_ent->n_ports = SIL24_FLAG2NPORTS(pinfo->host_flags); 1109 probe_ent->n_ports = SIL24_FLAG2NPORTS(pinfo->flags);
1110 1110
1111 probe_ent->irq = pdev->irq; 1111 probe_ent->irq = pdev->irq;
1112 probe_ent->irq_flags = IRQF_SHARED; 1112 probe_ent->irq_flags = IRQF_SHARED;
@@ -1144,14 +1144,14 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1144 } 1144 }
1145 1145
1146 /* Apply workaround for completion IRQ loss on PCI-X errata */ 1146 /* Apply workaround for completion IRQ loss on PCI-X errata */
1147 if (probe_ent->host_flags & SIL24_FLAG_PCIX_IRQ_WOC) { 1147 if (probe_ent->port_flags & SIL24_FLAG_PCIX_IRQ_WOC) {
1148 tmp = readl(host_base + HOST_CTRL); 1148 tmp = readl(host_base + HOST_CTRL);
1149 if (tmp & (HOST_CTRL_TRDY | HOST_CTRL_STOP | HOST_CTRL_DEVSEL)) 1149 if (tmp & (HOST_CTRL_TRDY | HOST_CTRL_STOP | HOST_CTRL_DEVSEL))
1150 dev_printk(KERN_INFO, &pdev->dev, 1150 dev_printk(KERN_INFO, &pdev->dev,
1151 "Applying completion IRQ loss on PCI-X " 1151 "Applying completion IRQ loss on PCI-X "
1152 "errata fix\n"); 1152 "errata fix\n");
1153 else 1153 else
1154 probe_ent->host_flags &= ~SIL24_FLAG_PCIX_IRQ_WOC; 1154 probe_ent->port_flags &= ~SIL24_FLAG_PCIX_IRQ_WOC;
1155 } 1155 }
1156 1156
1157 for (i = 0; i < probe_ent->n_ports; i++) { 1157 for (i = 0; i < probe_ent->n_ports; i++) {
@@ -1164,7 +1164,7 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1164 ata_std_ports(&probe_ent->port[i]); 1164 ata_std_ports(&probe_ent->port[i]);
1165 } 1165 }
1166 1166
1167 sil24_init_controller(pdev, probe_ent->n_ports, probe_ent->host_flags, 1167 sil24_init_controller(pdev, probe_ent->n_ports, probe_ent->port_flags,
1168 host_base, port_base); 1168 host_base, port_base);
1169 1169
1170 pci_set_master(pdev); 1170 pci_set_master(pdev);
@@ -1191,19 +1191,18 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1191#ifdef CONFIG_PM 1191#ifdef CONFIG_PM
1192static int sil24_pci_device_resume(struct pci_dev *pdev) 1192static int sil24_pci_device_resume(struct pci_dev *pdev)
1193{ 1193{
1194 struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); 1194 struct ata_host *host = dev_get_drvdata(&pdev->dev);
1195 struct sil24_host_priv *hpriv = host_set->private_data; 1195 struct sil24_host_priv *hpriv = host->private_data;
1196 1196
1197 ata_pci_device_do_resume(pdev); 1197 ata_pci_device_do_resume(pdev);
1198 1198
1199 if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) 1199 if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND)
1200 writel(HOST_CTRL_GLOBAL_RST, hpriv->host_base + HOST_CTRL); 1200 writel(HOST_CTRL_GLOBAL_RST, hpriv->host_base + HOST_CTRL);
1201 1201
1202 sil24_init_controller(pdev, host_set->n_ports, 1202 sil24_init_controller(pdev, host->n_ports, host->ports[0]->flags,
1203 host_set->ports[0]->flags,
1204 hpriv->host_base, hpriv->port_base); 1203 hpriv->host_base, hpriv->port_base);
1205 1204
1206 ata_host_set_resume(host_set); 1205 ata_host_resume(host);
1207 1206
1208 return 0; 1207 return 0;
1209} 1208}
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index ac24f66897f6..9b17375d8056 100644
--- a/drivers/ata/sata_sis.c
+++ b/drivers/ata/sata_sis.c
@@ -128,7 +128,7 @@ static const struct ata_port_operations sis_ops = {
128 128
129static struct ata_port_info sis_port_info = { 129static struct ata_port_info sis_port_info = {
130 .sht = &sis_sht, 130 .sht = &sis_sht,
131 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, 131 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
132 .pio_mask = 0x1f, 132 .pio_mask = 0x1f,
133 .mwdma_mask = 0x7, 133 .mwdma_mask = 0x7,
134 .udma_mask = 0x7f, 134 .udma_mask = 0x7f,
@@ -158,7 +158,7 @@ static unsigned int get_scr_cfg_addr(unsigned int port_no, unsigned int sc_reg,
158 158
159static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg) 159static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg)
160{ 160{
161 struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); 161 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
162 unsigned int cfg_addr = get_scr_cfg_addr(ap->port_no, sc_reg, pdev->device); 162 unsigned int cfg_addr = get_scr_cfg_addr(ap->port_no, sc_reg, pdev->device);
163 u32 val, val2 = 0; 163 u32 val, val2 = 0;
164 u8 pmr; 164 u8 pmr;
@@ -178,7 +178,7 @@ static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg)
178 178
179static void sis_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32 val) 179static void sis_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32 val)
180{ 180{
181 struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); 181 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
182 unsigned int cfg_addr = get_scr_cfg_addr(ap->port_no, scr, pdev->device); 182 unsigned int cfg_addr = get_scr_cfg_addr(ap->port_no, scr, pdev->device);
183 u8 pmr; 183 u8 pmr;
184 184
@@ -195,7 +195,7 @@ static void sis_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32 val)
195 195
196static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg) 196static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg)
197{ 197{
198 struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); 198 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
199 u32 val, val2 = 0; 199 u32 val, val2 = 0;
200 u8 pmr; 200 u8 pmr;
201 201
@@ -217,7 +217,7 @@ static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg)
217 217
218static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) 218static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
219{ 219{
220 struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); 220 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
221 u8 pmr; 221 u8 pmr;
222 222
223 if (sc_reg > SCR_CONTROL) 223 if (sc_reg > SCR_CONTROL)
@@ -275,17 +275,17 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
275 /* check and see if the SCRs are in IO space or PCI cfg space */ 275 /* check and see if the SCRs are in IO space or PCI cfg space */
276 pci_read_config_dword(pdev, SIS_GENCTL, &genctl); 276 pci_read_config_dword(pdev, SIS_GENCTL, &genctl);
277 if ((genctl & GENCTL_IOMAPPED_SCR) == 0) 277 if ((genctl & GENCTL_IOMAPPED_SCR) == 0)
278 probe_ent->host_flags |= SIS_FLAG_CFGSCR; 278 probe_ent->port_flags |= SIS_FLAG_CFGSCR;
279 279
280 /* if hardware thinks SCRs are in IO space, but there are 280 /* if hardware thinks SCRs are in IO space, but there are
281 * no IO resources assigned, change to PCI cfg space. 281 * no IO resources assigned, change to PCI cfg space.
282 */ 282 */
283 if ((!(probe_ent->host_flags & SIS_FLAG_CFGSCR)) && 283 if ((!(probe_ent->port_flags & SIS_FLAG_CFGSCR)) &&
284 ((pci_resource_start(pdev, SIS_SCR_PCI_BAR) == 0) || 284 ((pci_resource_start(pdev, SIS_SCR_PCI_BAR) == 0) ||
285 (pci_resource_len(pdev, SIS_SCR_PCI_BAR) < 128))) { 285 (pci_resource_len(pdev, SIS_SCR_PCI_BAR) < 128))) {
286 genctl &= ~GENCTL_IOMAPPED_SCR; 286 genctl &= ~GENCTL_IOMAPPED_SCR;
287 pci_write_config_dword(pdev, SIS_GENCTL, genctl); 287 pci_write_config_dword(pdev, SIS_GENCTL, genctl);
288 probe_ent->host_flags |= SIS_FLAG_CFGSCR; 288 probe_ent->port_flags |= SIS_FLAG_CFGSCR;
289 } 289 }
290 290
291 pci_read_config_byte(pdev, SIS_PMR, &pmr); 291 pci_read_config_byte(pdev, SIS_PMR, &pmr);
@@ -306,7 +306,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
306 port2_start = 0x20; 306 port2_start = 0x20;
307 } 307 }
308 308
309 if (!(probe_ent->host_flags & SIS_FLAG_CFGSCR)) { 309 if (!(probe_ent->port_flags & SIS_FLAG_CFGSCR)) {
310 probe_ent->port[0].scr_addr = 310 probe_ent->port[0].scr_addr =
311 pci_resource_start(pdev, SIS_SCR_PCI_BAR); 311 pci_resource_start(pdev, SIS_SCR_PCI_BAR);
312 probe_ent->port[1].scr_addr = 312 probe_ent->port[1].scr_addr =
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index baf259a966d0..2a7e3495cf16 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -169,7 +169,7 @@ static void k2_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
169 * @qc: Info associated with this ATA transaction. 169 * @qc: Info associated with this ATA transaction.
170 * 170 *
171 * LOCKING: 171 * LOCKING:
172 * spin_lock_irqsave(host_set lock) 172 * spin_lock_irqsave(host lock)
173 */ 173 */
174 174
175static void k2_bmdma_setup_mmio (struct ata_queued_cmd *qc) 175static void k2_bmdma_setup_mmio (struct ata_queued_cmd *qc)
@@ -199,7 +199,7 @@ static void k2_bmdma_setup_mmio (struct ata_queued_cmd *qc)
199 * @qc: Info associated with this ATA transaction. 199 * @qc: Info associated with this ATA transaction.
200 * 200 *
201 * LOCKING: 201 * LOCKING:
202 * spin_lock_irqsave(host_set lock) 202 * spin_lock_irqsave(host lock)
203 */ 203 */
204 204
205static void k2_bmdma_start_mmio (struct ata_queued_cmd *qc) 205static void k2_bmdma_start_mmio (struct ata_queued_cmd *qc)
@@ -261,12 +261,12 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
261 return 0; 261 return 0;
262 262
263 /* Find the OF node for the PCI device proper */ 263 /* Find the OF node for the PCI device proper */
264 np = pci_device_to_OF_node(to_pci_dev(ap->host_set->dev)); 264 np = pci_device_to_OF_node(to_pci_dev(ap->host->dev));
265 if (np == NULL) 265 if (np == NULL)
266 return 0; 266 return 0;
267 267
268 /* Match it to a port node */ 268 /* Match it to a port node */
269 index = (ap == ap->host_set->ports[0]) ? 0 : 1; 269 index = (ap == ap->host->ports[0]) ? 0 : 1;
270 for (np = np->child; np != NULL; np = np->sibling) { 270 for (np = np->child; np != NULL; np = np->sibling) {
271 u32 *reg = (u32 *)get_property(np, "reg", NULL); 271 u32 *reg = (u32 *)get_property(np, "reg", NULL);
272 if (!reg) 272 if (!reg)
@@ -423,7 +423,7 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
423 writel(0x0, mmio_base + K2_SATA_SIM_OFFSET); 423 writel(0x0, mmio_base + K2_SATA_SIM_OFFSET);
424 424
425 probe_ent->sht = &k2_sata_sht; 425 probe_ent->sht = &k2_sata_sht;
426 probe_ent->host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 426 probe_ent->port_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
427 ATA_FLAG_MMIO; 427 ATA_FLAG_MMIO;
428 probe_ent->port_ops = &k2_sata_ops; 428 probe_ent->port_ops = &k2_sata_ops;
429 probe_ent->n_ports = 4; 429 probe_ent->n_ports = 4;
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
index 0da83cba5c12..091867e10ea3 100644
--- a/drivers/ata/sata_sx4.c
+++ b/drivers/ata/sata_sx4.c
@@ -160,7 +160,7 @@ static void pdc_port_stop(struct ata_port *ap);
160static void pdc20621_qc_prep(struct ata_queued_cmd *qc); 160static void pdc20621_qc_prep(struct ata_queued_cmd *qc);
161static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); 161static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
162static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); 162static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
163static void pdc20621_host_stop(struct ata_host_set *host_set); 163static void pdc20621_host_stop(struct ata_host *host);
164static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe); 164static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe);
165static int pdc20621_detect_dimm(struct ata_probe_ent *pe); 165static int pdc20621_detect_dimm(struct ata_probe_ent *pe);
166static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe, 166static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe,
@@ -218,7 +218,7 @@ static const struct ata_port_info pdc_port_info[] = {
218 /* board_20621 */ 218 /* board_20621 */
219 { 219 {
220 .sht = &pdc_sata_sht, 220 .sht = &pdc_sata_sht,
221 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 221 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
222 ATA_FLAG_SRST | ATA_FLAG_MMIO | 222 ATA_FLAG_SRST | ATA_FLAG_MMIO |
223 ATA_FLAG_NO_ATAPI | ATA_FLAG_PIO_POLLING, 223 ATA_FLAG_NO_ATAPI | ATA_FLAG_PIO_POLLING,
224 .pio_mask = 0x1f, /* pio0-4 */ 224 .pio_mask = 0x1f, /* pio0-4 */
@@ -244,21 +244,21 @@ static struct pci_driver pdc_sata_pci_driver = {
244}; 244};
245 245
246 246
247static void pdc20621_host_stop(struct ata_host_set *host_set) 247static void pdc20621_host_stop(struct ata_host *host)
248{ 248{
249 struct pci_dev *pdev = to_pci_dev(host_set->dev); 249 struct pci_dev *pdev = to_pci_dev(host->dev);
250 struct pdc_host_priv *hpriv = host_set->private_data; 250 struct pdc_host_priv *hpriv = host->private_data;
251 void __iomem *dimm_mmio = hpriv->dimm_mmio; 251 void __iomem *dimm_mmio = hpriv->dimm_mmio;
252 252
253 pci_iounmap(pdev, dimm_mmio); 253 pci_iounmap(pdev, dimm_mmio);
254 kfree(hpriv); 254 kfree(hpriv);
255 255
256 pci_iounmap(pdev, host_set->mmio_base); 256 pci_iounmap(pdev, host->mmio_base);
257} 257}
258 258
259static int pdc_port_start(struct ata_port *ap) 259static int pdc_port_start(struct ata_port *ap)
260{ 260{
261 struct device *dev = ap->host_set->dev; 261 struct device *dev = ap->host->dev;
262 struct pdc_port_priv *pp; 262 struct pdc_port_priv *pp;
263 int rc; 263 int rc;
264 264
@@ -293,7 +293,7 @@ err_out:
293 293
294static void pdc_port_stop(struct ata_port *ap) 294static void pdc_port_stop(struct ata_port *ap)
295{ 295{
296 struct device *dev = ap->host_set->dev; 296 struct device *dev = ap->host->dev;
297 struct pdc_port_priv *pp = ap->private_data; 297 struct pdc_port_priv *pp = ap->private_data;
298 298
299 ap->private_data = NULL; 299 ap->private_data = NULL;
@@ -453,8 +453,8 @@ static void pdc20621_dma_prep(struct ata_queued_cmd *qc)
453 struct scatterlist *sg; 453 struct scatterlist *sg;
454 struct ata_port *ap = qc->ap; 454 struct ata_port *ap = qc->ap;
455 struct pdc_port_priv *pp = ap->private_data; 455 struct pdc_port_priv *pp = ap->private_data;
456 void __iomem *mmio = ap->host_set->mmio_base; 456 void __iomem *mmio = ap->host->mmio_base;
457 struct pdc_host_priv *hpriv = ap->host_set->private_data; 457 struct pdc_host_priv *hpriv = ap->host->private_data;
458 void __iomem *dimm_mmio = hpriv->dimm_mmio; 458 void __iomem *dimm_mmio = hpriv->dimm_mmio;
459 unsigned int portno = ap->port_no; 459 unsigned int portno = ap->port_no;
460 unsigned int i, idx, total_len = 0, sgt_len; 460 unsigned int i, idx, total_len = 0, sgt_len;
@@ -514,8 +514,8 @@ static void pdc20621_nodata_prep(struct ata_queued_cmd *qc)
514{ 514{
515 struct ata_port *ap = qc->ap; 515 struct ata_port *ap = qc->ap;
516 struct pdc_port_priv *pp = ap->private_data; 516 struct pdc_port_priv *pp = ap->private_data;
517 void __iomem *mmio = ap->host_set->mmio_base; 517 void __iomem *mmio = ap->host->mmio_base;
518 struct pdc_host_priv *hpriv = ap->host_set->private_data; 518 struct pdc_host_priv *hpriv = ap->host->private_data;
519 void __iomem *dimm_mmio = hpriv->dimm_mmio; 519 void __iomem *dimm_mmio = hpriv->dimm_mmio;
520 unsigned int portno = ap->port_no; 520 unsigned int portno = ap->port_no;
521 unsigned int i; 521 unsigned int i;
@@ -565,8 +565,8 @@ static void __pdc20621_push_hdma(struct ata_queued_cmd *qc,
565 u32 pkt_ofs) 565 u32 pkt_ofs)
566{ 566{
567 struct ata_port *ap = qc->ap; 567 struct ata_port *ap = qc->ap;
568 struct ata_host_set *host_set = ap->host_set; 568 struct ata_host *host = ap->host;
569 void __iomem *mmio = host_set->mmio_base; 569 void __iomem *mmio = host->mmio_base;
570 570
571 /* hard-code chip #0 */ 571 /* hard-code chip #0 */
572 mmio += PDC_CHIP0_OFS; 572 mmio += PDC_CHIP0_OFS;
@@ -583,7 +583,7 @@ static void pdc20621_push_hdma(struct ata_queued_cmd *qc,
583 u32 pkt_ofs) 583 u32 pkt_ofs)
584{ 584{
585 struct ata_port *ap = qc->ap; 585 struct ata_port *ap = qc->ap;
586 struct pdc_host_priv *pp = ap->host_set->private_data; 586 struct pdc_host_priv *pp = ap->host->private_data;
587 unsigned int idx = pp->hdma_prod & PDC_HDMA_Q_MASK; 587 unsigned int idx = pp->hdma_prod & PDC_HDMA_Q_MASK;
588 588
589 if (!pp->doing_hdma) { 589 if (!pp->doing_hdma) {
@@ -601,7 +601,7 @@ static void pdc20621_push_hdma(struct ata_queued_cmd *qc,
601static void pdc20621_pop_hdma(struct ata_queued_cmd *qc) 601static void pdc20621_pop_hdma(struct ata_queued_cmd *qc)
602{ 602{
603 struct ata_port *ap = qc->ap; 603 struct ata_port *ap = qc->ap;
604 struct pdc_host_priv *pp = ap->host_set->private_data; 604 struct pdc_host_priv *pp = ap->host->private_data;
605 unsigned int idx = pp->hdma_cons & PDC_HDMA_Q_MASK; 605 unsigned int idx = pp->hdma_cons & PDC_HDMA_Q_MASK;
606 606
607 /* if nothing on queue, we're done */ 607 /* if nothing on queue, we're done */
@@ -620,7 +620,7 @@ static void pdc20621_dump_hdma(struct ata_queued_cmd *qc)
620{ 620{
621 struct ata_port *ap = qc->ap; 621 struct ata_port *ap = qc->ap;
622 unsigned int port_no = ap->port_no; 622 unsigned int port_no = ap->port_no;
623 struct pdc_host_priv *hpriv = ap->host_set->private_data; 623 struct pdc_host_priv *hpriv = ap->host->private_data;
624 void *dimm_mmio = hpriv->dimm_mmio; 624 void *dimm_mmio = hpriv->dimm_mmio;
625 625
626 dimm_mmio += (port_no * PDC_DIMM_WINDOW_STEP); 626 dimm_mmio += (port_no * PDC_DIMM_WINDOW_STEP);
@@ -638,9 +638,9 @@ static inline void pdc20621_dump_hdma(struct ata_queued_cmd *qc) { }
638static void pdc20621_packet_start(struct ata_queued_cmd *qc) 638static void pdc20621_packet_start(struct ata_queued_cmd *qc)
639{ 639{
640 struct ata_port *ap = qc->ap; 640 struct ata_port *ap = qc->ap;
641 struct ata_host_set *host_set = ap->host_set; 641 struct ata_host *host = ap->host;
642 unsigned int port_no = ap->port_no; 642 unsigned int port_no = ap->port_no;
643 void __iomem *mmio = host_set->mmio_base; 643 void __iomem *mmio = host->mmio_base;
644 unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); 644 unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE);
645 u8 seq = (u8) (port_no + 1); 645 u8 seq = (u8) (port_no + 1);
646 unsigned int port_ofs; 646 unsigned int port_ofs;
@@ -781,8 +781,8 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap,
781 781
782static void pdc20621_irq_clear(struct ata_port *ap) 782static void pdc20621_irq_clear(struct ata_port *ap)
783{ 783{
784 struct ata_host_set *host_set = ap->host_set; 784 struct ata_host *host = ap->host;
785 void __iomem *mmio = host_set->mmio_base; 785 void __iomem *mmio = host->mmio_base;
786 786
787 mmio += PDC_CHIP0_OFS; 787 mmio += PDC_CHIP0_OFS;
788 788
@@ -791,7 +791,7 @@ static void pdc20621_irq_clear(struct ata_port *ap)
791 791
792static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance, struct pt_regs *regs) 792static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
793{ 793{
794 struct ata_host_set *host_set = dev_instance; 794 struct ata_host *host = dev_instance;
795 struct ata_port *ap; 795 struct ata_port *ap;
796 u32 mask = 0; 796 u32 mask = 0;
797 unsigned int i, tmp, port_no; 797 unsigned int i, tmp, port_no;
@@ -800,12 +800,12 @@ static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance, struct pt_re
800 800
801 VPRINTK("ENTER\n"); 801 VPRINTK("ENTER\n");
802 802
803 if (!host_set || !host_set->mmio_base) { 803 if (!host || !host->mmio_base) {
804 VPRINTK("QUICK EXIT\n"); 804 VPRINTK("QUICK EXIT\n");
805 return IRQ_NONE; 805 return IRQ_NONE;
806 } 806 }
807 807
808 mmio_base = host_set->mmio_base; 808 mmio_base = host->mmio_base;
809 809
810 /* reading should also clear interrupts */ 810 /* reading should also clear interrupts */
811 mmio_base += PDC_CHIP0_OFS; 811 mmio_base += PDC_CHIP0_OFS;
@@ -822,16 +822,16 @@ static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance, struct pt_re
822 return IRQ_NONE; 822 return IRQ_NONE;
823 } 823 }
824 824
825 spin_lock(&host_set->lock); 825 spin_lock(&host->lock);
826 826
827 for (i = 1; i < 9; i++) { 827 for (i = 1; i < 9; i++) {
828 port_no = i - 1; 828 port_no = i - 1;
829 if (port_no > 3) 829 if (port_no > 3)
830 port_no -= 4; 830 port_no -= 4;
831 if (port_no >= host_set->n_ports) 831 if (port_no >= host->n_ports)
832 ap = NULL; 832 ap = NULL;
833 else 833 else
834 ap = host_set->ports[port_no]; 834 ap = host->ports[port_no];
835 tmp = mask & (1 << i); 835 tmp = mask & (1 << i);
836 VPRINTK("seq %u, port_no %u, ap %p, tmp %x\n", i, port_no, ap, tmp); 836 VPRINTK("seq %u, port_no %u, ap %p, tmp %x\n", i, port_no, ap, tmp);
837 if (tmp && ap && 837 if (tmp && ap &&
@@ -845,7 +845,7 @@ static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance, struct pt_re
845 } 845 }
846 } 846 }
847 847
848 spin_unlock(&host_set->lock); 848 spin_unlock(&host->lock);
849 849
850 VPRINTK("mask == 0x%x\n", mask); 850 VPRINTK("mask == 0x%x\n", mask);
851 851
@@ -857,13 +857,13 @@ static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance, struct pt_re
857static void pdc_eng_timeout(struct ata_port *ap) 857static void pdc_eng_timeout(struct ata_port *ap)
858{ 858{
859 u8 drv_stat; 859 u8 drv_stat;
860 struct ata_host_set *host_set = ap->host_set; 860 struct ata_host *host = ap->host;
861 struct ata_queued_cmd *qc; 861 struct ata_queued_cmd *qc;
862 unsigned long flags; 862 unsigned long flags;
863 863
864 DPRINTK("ENTER\n"); 864 DPRINTK("ENTER\n");
865 865
866 spin_lock_irqsave(&host_set->lock, flags); 866 spin_lock_irqsave(&host->lock, flags);
867 867
868 qc = ata_qc_from_tag(ap, ap->active_tag); 868 qc = ata_qc_from_tag(ap, ap->active_tag);
869 869
@@ -885,7 +885,7 @@ static void pdc_eng_timeout(struct ata_port *ap)
885 break; 885 break;
886 } 886 }
887 887
888 spin_unlock_irqrestore(&host_set->lock, flags); 888 spin_unlock_irqrestore(&host->lock, flags);
889 ata_eh_qc_complete(qc); 889 ata_eh_qc_complete(qc);
890 DPRINTK("EXIT\n"); 890 DPRINTK("EXIT\n");
891} 891}
@@ -1429,7 +1429,7 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *
1429 hpriv->dimm_mmio = dimm_mmio; 1429 hpriv->dimm_mmio = dimm_mmio;
1430 1430
1431 probe_ent->sht = pdc_port_info[board_idx].sht; 1431 probe_ent->sht = pdc_port_info[board_idx].sht;
1432 probe_ent->host_flags = pdc_port_info[board_idx].host_flags; 1432 probe_ent->port_flags = pdc_port_info[board_idx].flags;
1433 probe_ent->pio_mask = pdc_port_info[board_idx].pio_mask; 1433 probe_ent->pio_mask = pdc_port_info[board_idx].pio_mask;
1434 probe_ent->mwdma_mask = pdc_port_info[board_idx].mwdma_mask; 1434 probe_ent->mwdma_mask = pdc_port_info[board_idx].mwdma_mask;
1435 probe_ent->udma_mask = pdc_port_info[board_idx].udma_mask; 1435 probe_ent->udma_mask = pdc_port_info[board_idx].udma_mask;
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c
index 654aae2b25c5..8fc6e800011a 100644
--- a/drivers/ata/sata_uli.c
+++ b/drivers/ata/sata_uli.c
@@ -128,7 +128,7 @@ static const struct ata_port_operations uli_ops = {
128 128
129static struct ata_port_info uli_port_info = { 129static struct ata_port_info uli_port_info = {
130 .sht = &uli_sht, 130 .sht = &uli_sht,
131 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, 131 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
132 .pio_mask = 0x1f, /* pio0-4 */ 132 .pio_mask = 0x1f, /* pio0-4 */
133 .udma_mask = 0x7f, /* udma0-6 */ 133 .udma_mask = 0x7f, /* udma0-6 */
134 .port_ops = &uli_ops, 134 .port_ops = &uli_ops,
@@ -143,13 +143,13 @@ MODULE_VERSION(DRV_VERSION);
143 143
144static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg) 144static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg)
145{ 145{
146 struct uli_priv *hpriv = ap->host_set->private_data; 146 struct uli_priv *hpriv = ap->host->private_data;
147 return hpriv->scr_cfg_addr[ap->port_no] + (4 * sc_reg); 147 return hpriv->scr_cfg_addr[ap->port_no] + (4 * sc_reg);
148} 148}
149 149
150static u32 uli_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg) 150static u32 uli_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg)
151{ 151{
152 struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); 152 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
153 unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); 153 unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg);
154 u32 val; 154 u32 val;
155 155
@@ -159,7 +159,7 @@ static u32 uli_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg)
159 159
160static void uli_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32 val) 160static void uli_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32 val)
161{ 161{
162 struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); 162 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
163 unsigned int cfg_addr = get_scr_cfg_addr(ap, scr); 163 unsigned int cfg_addr = get_scr_cfg_addr(ap, scr);
164 164
165 pci_write_config_dword(pdev, cfg_addr, val); 165 pci_write_config_dword(pdev, cfg_addr, val);
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index a0699a1728d4..7f087aef99de 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -176,7 +176,7 @@ static const struct ata_port_operations vt6421_sata_ops = {
176 176
177static struct ata_port_info vt6420_port_info = { 177static struct ata_port_info vt6420_port_info = {
178 .sht = &svia_sht, 178 .sht = &svia_sht,
179 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, 179 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
180 .pio_mask = 0x1f, 180 .pio_mask = 0x1f,
181 .mwdma_mask = 0x07, 181 .mwdma_mask = 0x07,
182 .udma_mask = 0x7f, 182 .udma_mask = 0x7f,
@@ -346,7 +346,7 @@ static struct ata_probe_ent *vt6421_init_probe_ent(struct pci_dev *pdev)
346 INIT_LIST_HEAD(&probe_ent->node); 346 INIT_LIST_HEAD(&probe_ent->node);
347 347
348 probe_ent->sht = &svia_sht; 348 probe_ent->sht = &svia_sht;
349 probe_ent->host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY; 349 probe_ent->port_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY;
350 probe_ent->port_ops = &vt6421_sata_ops; 350 probe_ent->port_ops = &vt6421_sata_ops;
351 probe_ent->n_ports = N_PORTS; 351 probe_ent->n_ports = N_PORTS;
352 probe_ent->irq = pdev->irq; 352 probe_ent->irq = pdev->irq;
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c
index 4c69a705a483..d0d92f33de54 100644
--- a/drivers/ata/sata_vsc.c
+++ b/drivers/ata/sata_vsc.c
@@ -123,7 +123,7 @@ static void vsc_intr_mask_update(struct ata_port *ap, u8 ctl)
123 void __iomem *mask_addr; 123 void __iomem *mask_addr;
124 u8 mask; 124 u8 mask;
125 125
126 mask_addr = ap->host_set->mmio_base + 126 mask_addr = ap->host->mmio_base +
127 VSC_SATA_INT_MASK_OFFSET + ap->port_no; 127 VSC_SATA_INT_MASK_OFFSET + ap->port_no;
128 mask = readb(mask_addr); 128 mask = readb(mask_addr);
129 if (ctl & ATA_NIEN) 129 if (ctl & ATA_NIEN)
@@ -206,20 +206,20 @@ static void vsc_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
206static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance, 206static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance,
207 struct pt_regs *regs) 207 struct pt_regs *regs)
208{ 208{
209 struct ata_host_set *host_set = dev_instance; 209 struct ata_host *host = dev_instance;
210 unsigned int i; 210 unsigned int i;
211 unsigned int handled = 0; 211 unsigned int handled = 0;
212 u32 int_status; 212 u32 int_status;
213 213
214 spin_lock(&host_set->lock); 214 spin_lock(&host->lock);
215 215
216 int_status = readl(host_set->mmio_base + VSC_SATA_INT_STAT_OFFSET); 216 int_status = readl(host->mmio_base + VSC_SATA_INT_STAT_OFFSET);
217 217
218 for (i = 0; i < host_set->n_ports; i++) { 218 for (i = 0; i < host->n_ports; i++) {
219 if (int_status & ((u32) 0xFF << (8 * i))) { 219 if (int_status & ((u32) 0xFF << (8 * i))) {
220 struct ata_port *ap; 220 struct ata_port *ap;
221 221
222 ap = host_set->ports[i]; 222 ap = host->ports[i];
223 223
224 if (is_vsc_sata_int_err(i, int_status)) { 224 if (is_vsc_sata_int_err(i, int_status)) {
225 u32 err_status; 225 u32 err_status;
@@ -259,7 +259,7 @@ static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance,
259 } 259 }
260 } 260 }
261 261
262 spin_unlock(&host_set->lock); 262 spin_unlock(&host->lock);
263 263
264 return IRQ_RETVAL(handled); 264 return IRQ_RETVAL(handled);
265} 265}
@@ -395,7 +395,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d
395 pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, 0x80); 395 pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, 0x80);
396 396
397 probe_ent->sht = &vsc_sata_sht; 397 probe_ent->sht = &vsc_sata_sht;
398 probe_ent->host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 398 probe_ent->port_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
399 ATA_FLAG_MMIO; 399 ATA_FLAG_MMIO;
400 probe_ent->port_ops = &vsc_sata_ops; 400 probe_ent->port_ops = &vsc_sata_ops;
401 probe_ent->n_ports = 4; 401 probe_ent->n_ports = 4;