Fix gcc 4.5.1 miscompiling drivers/char/i8k.c (again)
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / ide / rapide.c
blob00f54248f41f0d76fbf62e2c791123a0bf17dfe9
1 /*
2 * Copyright (c) 1996-2002 Russell King.
3 */
5 #include <linux/module.h>
6 #include <linux/slab.h>
7 #include <linux/blkdev.h>
8 #include <linux/errno.h>
9 #include <linux/ide.h>
10 #include <linux/init.h>
12 #include <asm/ecard.h>
14 static const struct ide_port_info rapide_port_info = {
15 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
16 .chipset = ide_generic,
19 static void rapide_setup_ports(struct ide_hw *hw, void __iomem *base,
20 void __iomem *ctrl, unsigned int sz, int irq)
22 unsigned long port = (unsigned long)base;
23 int i;
25 for (i = 0; i <= 7; i++) {
26 hw->io_ports_array[i] = port;
27 port += sz;
29 hw->io_ports.ctl_addr = (unsigned long)ctrl;
30 hw->irq = irq;
33 static int __devinit
34 rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
36 void __iomem *base;
37 struct ide_host *host;
38 int ret;
39 struct ide_hw hw, *hws[] = { &hw };
41 ret = ecard_request_resources(ec);
42 if (ret)
43 goto out;
45 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
46 if (!base) {
47 ret = -ENOMEM;
48 goto release;
51 memset(&hw, 0, sizeof(hw));
52 rapide_setup_ports(&hw, base, base + 0x818, 1 << 6, ec->irq);
53 hw.dev = &ec->dev;
55 ret = ide_host_add(&rapide_port_info, hws, 1, &host);
56 if (ret)
57 goto release;
59 ecard_set_drvdata(ec, host);
60 goto out;
62 release:
63 ecard_release_resources(ec);
64 out:
65 return ret;
68 static void __devexit rapide_remove(struct expansion_card *ec)
70 struct ide_host *host = ecard_get_drvdata(ec);
72 ecard_set_drvdata(ec, NULL);
74 ide_host_remove(host);
76 ecard_release_resources(ec);
79 static struct ecard_id rapide_ids[] = {
80 { MANU_YELLOWSTONE, PROD_YELLOWSTONE_RAPIDE32 },
81 { 0xffff, 0xffff }
84 static struct ecard_driver rapide_driver = {
85 .probe = rapide_probe,
86 .remove = __devexit_p(rapide_remove),
87 .id_table = rapide_ids,
88 .drv = {
89 .name = "rapide",
93 static int __init rapide_init(void)
95 return ecard_register_driver(&rapide_driver);
98 static void __exit rapide_exit(void)
100 ecard_remove_driver(&rapide_driver);
103 MODULE_LICENSE("GPL");
104 MODULE_DESCRIPTION("Yellowstone RAPIDE driver");
106 module_init(rapide_init);
107 module_exit(rapide_exit);