aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_legacy.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-04-17 10:44:08 -0400
committerJeff Garzik <jeff@garzik.org>2007-04-28 14:16:06 -0400
commit5d728824efeda61d304153bfcf1378a3c18b7d70 (patch)
tree8a3d4ba0c1c650da5c161f11155e7c19f0fe78aa /drivers/ata/pata_legacy.c
parent4447d35156169cf136e829eb6b5cac2d6370f2d9 (diff)
libata: convert the remaining PATA drivers to new init model
Convert pdc_adma, pata_cs5520, pata_isapnp, pata_ixp4xx_cf, pata_legacy, pata_mpc52xx, pata_mpiix, pata_pcmcia, pata_pdc2027x, pata_platform, pata_qdi, pata_scc and pata_winbond to new init model. * init_one()'s now follow more consistent init order * cs5520 now registers one host with two ports, not two hosts. If any of the two ports are disabled, it's made dummy as other drivers do. Tested pdc_adma and pata_legacy. Both are as broken as before. The rest are compile tested only. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_legacy.c')
-rw-r--r--drivers/ata/pata_legacy.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index 0b1749a84df2..707099291e01 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -716,7 +716,8 @@ static struct ata_port_operations opti82c46x_port_ops = {
716static __init int legacy_init_one(int port, unsigned long io, unsigned long ctrl, int irq) 716static __init int legacy_init_one(int port, unsigned long io, unsigned long ctrl, int irq)
717{ 717{
718 struct legacy_data *ld = &legacy_data[nr_legacy_host]; 718 struct legacy_data *ld = &legacy_data[nr_legacy_host];
719 struct ata_probe_ent ae; 719 struct ata_host *host;
720 struct ata_port *ap;
720 struct platform_device *pdev; 721 struct platform_device *pdev;
721 struct ata_port_operations *ops = &legacy_port_ops; 722 struct ata_port_operations *ops = &legacy_port_ops;
722 void __iomem *io_addr, *ctrl_addr; 723 void __iomem *io_addr, *ctrl_addr;
@@ -798,24 +799,23 @@ static __init int legacy_init_one(int port, unsigned long io, unsigned long ctrl
798 if (ops == &legacy_port_ops && (autospeed & mask)) 799 if (ops == &legacy_port_ops && (autospeed & mask))
799 ops = &simple_port_ops; 800 ops = &simple_port_ops;
800 801
801 memset(&ae, 0, sizeof(struct ata_probe_ent)); 802 ret = -ENOMEM;
802 INIT_LIST_HEAD(&ae.node); 803 host = ata_host_alloc(&pdev->dev, 1);
803 ae.dev = &pdev->dev; 804 if (!host)
804 ae.port_ops = ops; 805 goto fail;
805 ae.sht = &legacy_sht; 806 ap = host->ports[0];
806 ae.n_ports = 1; 807
807 ae.pio_mask = pio_modes; 808 ap->ops = ops;
808 ae.irq = irq; 809 ap->pio_mask = pio_modes;
809 ae.irq_flags = 0; 810 ap->flags |= ATA_FLAG_SLAVE_POSS | iordy;
810 ae.port_flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST|iordy; 811 ap->ioaddr.cmd_addr = io_addr;
811 ae.port[0].cmd_addr = io_addr; 812 ap->ioaddr.altstatus_addr = ctrl_addr;
812 ae.port[0].altstatus_addr = ctrl_addr; 813 ap->ioaddr.ctl_addr = ctrl_addr;
813 ae.port[0].ctl_addr = ctrl_addr; 814 ata_std_ports(&ap->ioaddr);
814 ata_std_ports(&ae.port[0]); 815 ap->private_data = ld;
815 ae.private_data = ld; 816
816 817 ret = ata_host_activate(host, irq, ata_interrupt, 0, &legacy_sht);
817 ret = -ENODEV; 818 if (ret)
818 if (!ata_device_add(&ae))
819 goto fail; 819 goto fail;
820 820
821 legacy_host[nr_legacy_host++] = dev_get_drvdata(&pdev->dev); 821 legacy_host[nr_legacy_host++] = dev_get_drvdata(&pdev->dev);