]> err.no Git - linux-2.6/blobdiff - drivers/ide/arm/icside.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
[linux-2.6] / drivers / ide / arm / icside.c
index 0283d162f7f72f724c7589b41c69b005e76e1d8b..df4af40839541e5b0d3fd3b1621591f33c13f852 100644 (file)
@@ -72,7 +72,7 @@ struct icside_state {
        void __iomem *ioc_base;
        unsigned int sel;
        unsigned int type;
-       ide_hwif_t *hwif[2];
+       struct ide_host *host;
 };
 
 #define ICS_TYPE_A3IN  0
@@ -442,10 +442,10 @@ static void icside_setup_ports(hw_regs_t *hw, void __iomem *base,
 static int __init
 icside_register_v5(struct icside_state *state, struct expansion_card *ec)
 {
-       ide_hwif_t *hwif;
        void __iomem *base;
+       struct ide_host *host;
        hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
-       u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
+       int ret;
 
        base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
        if (!base)
@@ -465,19 +465,23 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
 
        icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec);
 
-       hwif = ide_find_port();
-       if (!hwif)
+       host = ide_host_alloc(NULL, hws);
+       if (host == NULL)
                return -ENODEV;
 
-       state->hwif[0] = hwif;
+       state->host = host;
 
        ecard_set_drvdata(ec, state);
 
-       idx[0] = hwif->index;
-
-       ide_device_add(idx, NULL, hws);
+       ret = ide_host_register(host, NULL, hws);
+       if (ret)
+               goto err_free;
 
        return 0;
+err_free:
+       ide_host_free(host);
+       ecard_set_drvdata(ec, NULL);
+       return ret;
 }
 
 static const struct ide_port_info icside_v6_port_info __initdata = {
@@ -492,12 +496,11 @@ static const struct ide_port_info icside_v6_port_info __initdata = {
 static int __init
 icside_register_v6(struct icside_state *state, struct expansion_card *ec)
 {
-       ide_hwif_t *hwif, *mate;
        void __iomem *ioc_base, *easi_base;
+       struct ide_host *host;
        unsigned int sel = 0;
        int ret;
        hw_regs_t hw[2], *hws[] = { &hw[0], NULL, NULL, NULL };
-       u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
        struct ide_port_info d = icside_v6_port_info;
 
        ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
@@ -537,25 +540,11 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
        icside_setup_ports(&hw[0], easi_base, &icside_cardinfo_v6_1, ec);
        icside_setup_ports(&hw[1], easi_base, &icside_cardinfo_v6_2, ec);
 
-       /*
-        * Find and register the interfaces.
-        */
-       hwif = ide_find_port();
-       if (hwif == NULL)
+       host = ide_host_alloc(&d, hws);
+       if (host == NULL)
                return -ENODEV;
 
-       hwif->chipset = ide_acorn;
-
-       idx[0] = hwif->index;
-
-       mate = ide_find_port();
-       if (mate) {
-               hws[1] = &hw[1];
-               idx[1] = mate->index;
-       }
-
-       state->hwif[0]    = hwif;
-       state->hwif[1]    = mate;
+       state->host = host;
 
        ecard_set_drvdata(ec, state);
 
@@ -565,11 +554,17 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
                d.dma_ops = NULL;
        }
 
-       ide_device_add(idx, &d, hws);
+       ret = ide_host_register(host, NULL, hws);
+       if (ret)
+               goto err_free;
 
        return 0;
-
- out:
+err_free:
+       ide_host_free(host);
+       if (d.dma_ops)
+               free_dma(ec->dma);
+       ecard_set_drvdata(ec, NULL);
+out:
        return ret;
 }
 
@@ -715,8 +710,14 @@ static int __init icside_init(void)
        return ecard_register_driver(&icside_driver);
 }
 
+static void __exit icside_exit(void);
+{
+       ecard_unregister_driver(&icside_driver);
+}
+
 MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>");
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("ICS IDE driver");
 
 module_init(icside_init);
+module_exit(icside_exit);