diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:57 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:57 -0400 |
commit | 48c3c1072651922ed153bcf0a33ea82cf20df390 (patch) | |
tree | 92ad23e3869e70731eca99394c08a3bf06b8753e /drivers/ide/legacy | |
parent | 374e042c3e767ac2e5a40b78529220e0b3de793c (diff) |
ide: add struct ide_host (take 3)
* Add struct ide_host which keeps pointers to host's ports.
* Add ide_host_alloc[_all]() and ide_host_remove() helpers.
* Pass 'struct ide_host *host' instead of 'u8 *idx' to
ide_device_add[_all]() and rename it to ide_host_register[_all]().
* Convert host drivers and core code to use struct ide_host.
* Remove no longer needed ide_find_port().
* Make ide_find_port_slot() static.
* Unexport ide_unregister().
v2:
* Add missing 'struct ide_host *host' to macide.c.
v3:
* Fix build problem in pmac.c (s/ide_alloc_host/ide_host_alloc/)
(Noticed by Stephen Rothwell).
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy')
-rw-r--r-- | drivers/ide/legacy/buddha.c | 19 | ||||
-rw-r--r-- | drivers/ide/legacy/falconide.c | 11 | ||||
-rw-r--r-- | drivers/ide/legacy/gayle.c | 16 | ||||
-rw-r--r-- | drivers/ide/legacy/ide-4drives.c | 23 | ||||
-rw-r--r-- | drivers/ide/legacy/ide-cs.c | 46 | ||||
-rw-r--r-- | drivers/ide/legacy/ide_platform.c | 23 | ||||
-rw-r--r-- | drivers/ide/legacy/macide.c | 12 | ||||
-rw-r--r-- | drivers/ide/legacy/q40ide.c | 15 |
8 files changed, 62 insertions, 103 deletions
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c index c61bc6a1db36..2625667fab4c 100644 --- a/drivers/ide/legacy/buddha.c +++ b/drivers/ide/legacy/buddha.c | |||
@@ -150,18 +150,15 @@ static void __init buddha_setup_ports(hw_regs_t *hw, unsigned long base, | |||
150 | 150 | ||
151 | static int __init buddha_init(void) | 151 | static int __init buddha_init(void) |
152 | { | 152 | { |
153 | ide_hwif_t *hwif; | ||
154 | int i; | ||
155 | |||
156 | struct zorro_dev *z = NULL; | 153 | struct zorro_dev *z = NULL; |
154 | struct ide_host *host; | ||
157 | u_long buddha_board = 0; | 155 | u_long buddha_board = 0; |
158 | BuddhaType type; | 156 | BuddhaType type; |
159 | int buddha_num_hwifs; | 157 | int buddha_num_hwifs, i; |
160 | 158 | ||
161 | while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { | 159 | while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { |
162 | unsigned long board; | 160 | unsigned long board; |
163 | hw_regs_t hw[MAX_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; | 161 | hw_regs_t hw[MAX_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; |
164 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
165 | 162 | ||
166 | if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) { | 163 | if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) { |
167 | buddha_num_hwifs = BUDDHA_NUM_HWIFS; | 164 | buddha_num_hwifs = BUDDHA_NUM_HWIFS; |
@@ -226,16 +223,12 @@ fail_base2: | |||
226 | buddha_setup_ports(&hw[i], base, ctl, irq_port, | 223 | buddha_setup_ports(&hw[i], base, ctl, irq_port, |
227 | ack_intr); | 224 | ack_intr); |
228 | 225 | ||
229 | hwif = ide_find_port(); | 226 | hws[i] = &hw[i]; |
230 | if (hwif) { | ||
231 | hwif->chipset = ide_generic; | ||
232 | |||
233 | hws[i] = &hw[i]; | ||
234 | idx[i] = hwif->index; | ||
235 | } | ||
236 | } | 227 | } |
237 | 228 | ||
238 | ide_device_add(idx, NULL, hws); | 229 | host = ide_host_alloc(NULL, hws); |
230 | if (host) | ||
231 | ide_host_register(host, NULL, hws); | ||
239 | } | 232 | } |
240 | 233 | ||
241 | return 0; | 234 | return 0; |
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c index 3e2c6125f031..4eb5c3f9fecc 100644 --- a/drivers/ide/legacy/falconide.c +++ b/drivers/ide/legacy/falconide.c | |||
@@ -112,7 +112,7 @@ static void __init falconide_setup_ports(hw_regs_t *hw) | |||
112 | 112 | ||
113 | static int __init falconide_init(void) | 113 | static int __init falconide_init(void) |
114 | { | 114 | { |
115 | ide_hwif_t *hwif; | 115 | struct ide_host *host; |
116 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; | 116 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
117 | 117 | ||
118 | if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE)) | 118 | if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE)) |
@@ -127,13 +127,10 @@ static int __init falconide_init(void) | |||
127 | 127 | ||
128 | falconide_setup_ports(&hw); | 128 | falconide_setup_ports(&hw); |
129 | 129 | ||
130 | hwif = ide_find_port(); | 130 | host = ide_host_alloc(&falconide_port_info, hws); |
131 | if (hwif) { | 131 | if (host) { |
132 | u8 index = hwif->index; | ||
133 | u8 idx[4] = { index, 0xff, 0xff, 0xff }; | ||
134 | |||
135 | ide_get_lock(NULL, NULL); | 132 | ide_get_lock(NULL, NULL); |
136 | ide_device_add(idx, &falconide_port_info, hws); | 133 | ide_host_register(host, &falconide_port_info, hws); |
137 | ide_release_lock(); | 134 | ide_release_lock(); |
138 | } | 135 | } |
139 | 136 | ||
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c index 7baeefa870fa..13d22bded6b4 100644 --- a/drivers/ide/legacy/gayle.c +++ b/drivers/ide/legacy/gayle.c | |||
@@ -127,9 +127,9 @@ static int __init gayle_init(void) | |||
127 | unsigned long phys_base, res_start, res_n; | 127 | unsigned long phys_base, res_start, res_n; |
128 | unsigned long base, ctrlport, irqport; | 128 | unsigned long base, ctrlport, irqport; |
129 | ide_ack_intr_t *ack_intr; | 129 | ide_ack_intr_t *ack_intr; |
130 | struct ide_host *host; | ||
130 | int a4000, i; | 131 | int a4000, i; |
131 | hw_regs_t hw[GAYLE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; | 132 | hw_regs_t hw[GAYLE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; |
132 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
133 | 133 | ||
134 | if (!MACH_IS_AMIGA) | 134 | if (!MACH_IS_AMIGA) |
135 | return -ENODEV; | 135 | return -ENODEV; |
@@ -172,23 +172,17 @@ found: | |||
172 | return -EBUSY; | 172 | return -EBUSY; |
173 | 173 | ||
174 | for (i = 0; i < GAYLE_NUM_PROBE_HWIFS; i++) { | 174 | for (i = 0; i < GAYLE_NUM_PROBE_HWIFS; i++) { |
175 | ide_hwif_t *hwif; | ||
176 | |||
177 | base = (unsigned long)ZTWO_VADDR(phys_base + i * GAYLE_NEXT_PORT); | 175 | base = (unsigned long)ZTWO_VADDR(phys_base + i * GAYLE_NEXT_PORT); |
178 | ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0; | 176 | ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0; |
179 | 177 | ||
180 | gayle_setup_ports(&hw[i], base, ctrlport, irqport, ack_intr); | 178 | gayle_setup_ports(&hw[i], base, ctrlport, irqport, ack_intr); |
181 | 179 | ||
182 | hwif = ide_find_port(); | 180 | hws[i] = &hw[i]; |
183 | if (hwif) { | ||
184 | hwif->chipset = ide_generic; | ||
185 | |||
186 | hws[i] = &hw[i]; | ||
187 | idx[i] = hwif->index; | ||
188 | } | ||
189 | } | 181 | } |
190 | 182 | ||
191 | ide_device_add(idx, NULL, hws); | 183 | host = ide_host_alloc(NULL, hws); |
184 | if (host) | ||
185 | ide_host_register(host, NULL, hws); | ||
192 | 186 | ||
193 | return 0; | 187 | return 0; |
194 | } | 188 | } |
diff --git a/drivers/ide/legacy/ide-4drives.c b/drivers/ide/legacy/ide-4drives.c index 6310dc50e3c5..5935153ef2ad 100644 --- a/drivers/ide/legacy/ide-4drives.c +++ b/drivers/ide/legacy/ide-4drives.c | |||
@@ -28,10 +28,9 @@ static const struct ide_port_info ide_4drives_port_info = { | |||
28 | 28 | ||
29 | static int __init ide_4drives_init(void) | 29 | static int __init ide_4drives_init(void) |
30 | { | 30 | { |
31 | ide_hwif_t *hwif, *mate; | 31 | struct ide_host *host; |
32 | unsigned long base = 0x1f0, ctl = 0x3f6; | 32 | unsigned long base = 0x1f0, ctl = 0x3f6; |
33 | hw_regs_t hw, *hws[] = { NULL, NULL, NULL, NULL }; | 33 | hw_regs_t hw, *hws[] = { &hw, &hw, NULL, NULL }; |
34 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
35 | 34 | ||
36 | if (probe_4drives == 0) | 35 | if (probe_4drives == 0) |
37 | return -ENODEV; | 36 | return -ENODEV; |
@@ -55,21 +54,9 @@ static int __init ide_4drives_init(void) | |||
55 | hw.irq = 14; | 54 | hw.irq = 14; |
56 | hw.chipset = ide_4drives; | 55 | hw.chipset = ide_4drives; |
57 | 56 | ||
58 | hwif = ide_find_port(); | 57 | host = ide_host_alloc(&ide_4drives_port_info, hws); |
59 | if (hwif) { | 58 | if (host) |
60 | hwif->chipset = ide_4drives; | 59 | ide_host_register(host, &ide_4drives_port_info, hws); |
61 | |||
62 | hws[0] = &hw; | ||
63 | idx[0] = hwif->index; | ||
64 | } | ||
65 | |||
66 | mate = ide_find_port(); | ||
67 | if (mate) { | ||
68 | hws[1] = &hw; | ||
69 | idx[1] = mate->index; | ||
70 | } | ||
71 | |||
72 | ide_device_add(idx, &ide_4drives_port_info, hws); | ||
73 | 60 | ||
74 | return 0; | 61 | return 0; |
75 | } | 62 | } |
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index f93d5454ebf8..1a4b9e6887fa 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
@@ -74,7 +74,7 @@ INT_MODULE_PARM(pc_debug, 0); | |||
74 | 74 | ||
75 | typedef struct ide_info_t { | 75 | typedef struct ide_info_t { |
76 | struct pcmcia_device *p_dev; | 76 | struct pcmcia_device *p_dev; |
77 | ide_hwif_t *hwif; | 77 | struct ide_host *host; |
78 | int ndev; | 78 | int ndev; |
79 | dev_node_t node; | 79 | dev_node_t node; |
80 | } ide_info_t; | 80 | } ide_info_t; |
@@ -132,7 +132,7 @@ static int ide_probe(struct pcmcia_device *link) | |||
132 | static void ide_detach(struct pcmcia_device *link) | 132 | static void ide_detach(struct pcmcia_device *link) |
133 | { | 133 | { |
134 | ide_info_t *info = link->priv; | 134 | ide_info_t *info = link->priv; |
135 | ide_hwif_t *hwif = info->hwif; | 135 | ide_hwif_t *hwif = info->host->ports[0]; |
136 | unsigned long data_addr, ctl_addr; | 136 | unsigned long data_addr, ctl_addr; |
137 | 137 | ||
138 | DEBUG(0, "ide_detach(0x%p)\n", link); | 138 | DEBUG(0, "ide_detach(0x%p)\n", link); |
@@ -157,13 +157,13 @@ static const struct ide_port_info idecs_port_info = { | |||
157 | .host_flags = IDE_HFLAG_NO_DMA, | 157 | .host_flags = IDE_HFLAG_NO_DMA, |
158 | }; | 158 | }; |
159 | 159 | ||
160 | static ide_hwif_t *idecs_register(unsigned long io, unsigned long ctl, | 160 | static struct ide_host *idecs_register(unsigned long io, unsigned long ctl, |
161 | unsigned long irq, struct pcmcia_device *handle) | 161 | unsigned long irq, struct pcmcia_device *handle) |
162 | { | 162 | { |
163 | struct ide_host *host; | ||
163 | ide_hwif_t *hwif; | 164 | ide_hwif_t *hwif; |
164 | int i; | 165 | int i; |
165 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; | 166 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
166 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
167 | 167 | ||
168 | if (!request_region(io, 8, DRV_NAME)) { | 168 | if (!request_region(io, 8, DRV_NAME)) { |
169 | printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n", | 169 | printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n", |
@@ -184,26 +184,26 @@ static ide_hwif_t *idecs_register(unsigned long io, unsigned long ctl, | |||
184 | hw.chipset = ide_pci; | 184 | hw.chipset = ide_pci; |
185 | hw.dev = &handle->dev; | 185 | hw.dev = &handle->dev; |
186 | 186 | ||
187 | hwif = ide_find_port(); | 187 | host = ide_host_alloc(&idecs_port_info, hws); |
188 | if (hwif == NULL) | 188 | if (host == NULL) |
189 | goto out_release; | 189 | goto out_release; |
190 | 190 | ||
191 | idx[0] = hwif->index; | 191 | ide_host_register(host, &idecs_port_info, hws); |
192 | 192 | ||
193 | ide_device_add(idx, &idecs_port_info, hws); | 193 | hwif = host->ports[0]; |
194 | 194 | ||
195 | if (hwif->present) | 195 | if (hwif->present) |
196 | return hwif; | 196 | return host; |
197 | 197 | ||
198 | /* retry registration in case device is still spinning up */ | 198 | /* retry registration in case device is still spinning up */ |
199 | for (i = 0; i < 10; i++) { | 199 | for (i = 0; i < 10; i++) { |
200 | msleep(100); | 200 | msleep(100); |
201 | ide_port_scan(hwif); | 201 | ide_port_scan(hwif); |
202 | if (hwif->present) | 202 | if (hwif->present) |
203 | return hwif; | 203 | return host; |
204 | } | 204 | } |
205 | 205 | ||
206 | return hwif; | 206 | return host; |
207 | 207 | ||
208 | out_release: | 208 | out_release: |
209 | release_region(ctl, 1); | 209 | release_region(ctl, 1); |
@@ -235,7 +235,7 @@ static int ide_config(struct pcmcia_device *link) | |||
235 | cistpl_cftable_entry_t *cfg; | 235 | cistpl_cftable_entry_t *cfg; |
236 | int pass, last_ret = 0, last_fn = 0, is_kme = 0; | 236 | int pass, last_ret = 0, last_fn = 0, is_kme = 0; |
237 | unsigned long io_base, ctl_base; | 237 | unsigned long io_base, ctl_base; |
238 | ide_hwif_t *hwif; | 238 | struct ide_host *host; |
239 | 239 | ||
240 | DEBUG(0, "ide_config(0x%p)\n", link); | 240 | DEBUG(0, "ide_config(0x%p)\n", link); |
241 | 241 | ||
@@ -330,21 +330,21 @@ static int ide_config(struct pcmcia_device *link) | |||
330 | if (is_kme) | 330 | if (is_kme) |
331 | outb(0x81, ctl_base+1); | 331 | outb(0x81, ctl_base+1); |
332 | 332 | ||
333 | hwif = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link); | 333 | host = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link); |
334 | if (hwif == NULL && link->io.NumPorts1 == 0x20) { | 334 | if (host == NULL && link->io.NumPorts1 == 0x20) { |
335 | outb(0x02, ctl_base + 0x10); | 335 | outb(0x02, ctl_base + 0x10); |
336 | hwif = idecs_register(io_base + 0x10, ctl_base + 0x10, | 336 | host = idecs_register(io_base + 0x10, ctl_base + 0x10, |
337 | link->irq.AssignedIRQ, link); | 337 | link->irq.AssignedIRQ, link); |
338 | } | 338 | } |
339 | 339 | ||
340 | if (hwif == NULL) | 340 | if (host == NULL) |
341 | goto failed; | 341 | goto failed; |
342 | 342 | ||
343 | info->ndev = 1; | 343 | info->ndev = 1; |
344 | sprintf(info->node.dev_name, "hd%c", 'a' + hwif->index * 2); | 344 | sprintf(info->node.dev_name, "hd%c", 'a' + host->ports[0]->index * 2); |
345 | info->node.major = hwif->major; | 345 | info->node.major = host->ports[0]->major; |
346 | info->node.minor = 0; | 346 | info->node.minor = 0; |
347 | info->hwif = hwif; | 347 | info->host = host; |
348 | link->dev_node = &info->node; | 348 | link->dev_node = &info->node; |
349 | printk(KERN_INFO "ide-cs: %s: Vpp = %d.%d\n", | 349 | printk(KERN_INFO "ide-cs: %s: Vpp = %d.%d\n", |
350 | info->node.dev_name, link->conf.Vpp / 10, link->conf.Vpp % 10); | 350 | info->node.dev_name, link->conf.Vpp / 10, link->conf.Vpp % 10); |
@@ -375,15 +375,15 @@ failed: | |||
375 | static void ide_release(struct pcmcia_device *link) | 375 | static void ide_release(struct pcmcia_device *link) |
376 | { | 376 | { |
377 | ide_info_t *info = link->priv; | 377 | ide_info_t *info = link->priv; |
378 | ide_hwif_t *hwif = info->hwif; | 378 | struct ide_host *host = info->host; |
379 | 379 | ||
380 | DEBUG(0, "ide_release(0x%p)\n", link); | 380 | DEBUG(0, "ide_release(0x%p)\n", link); |
381 | 381 | ||
382 | if (info->ndev) { | 382 | if (info->ndev) |
383 | /* FIXME: if this fails we need to queue the cleanup somehow | 383 | /* FIXME: if this fails we need to queue the cleanup somehow |
384 | -- need to investigate the required PCMCIA magic */ | 384 | -- need to investigate the required PCMCIA magic */ |
385 | ide_unregister(hwif); | 385 | ide_host_remove(host); |
386 | } | 386 | |
387 | info->ndev = 0; | 387 | info->ndev = 0; |
388 | 388 | ||
389 | pcmcia_disable_device(link); | 389 | pcmcia_disable_device(link); |
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index 3d71e336a221..58a942c6a131 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c | |||
@@ -52,11 +52,10 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
52 | { | 52 | { |
53 | struct resource *res_base, *res_alt, *res_irq; | 53 | struct resource *res_base, *res_alt, *res_irq; |
54 | void __iomem *base, *alt_base; | 54 | void __iomem *base, *alt_base; |
55 | ide_hwif_t *hwif; | ||
56 | struct pata_platform_info *pdata; | 55 | struct pata_platform_info *pdata; |
56 | struct ide_host *host; | ||
57 | int ret = 0, mmio = 0; | 57 | int ret = 0, mmio = 0; |
58 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; | 58 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
59 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
60 | struct ide_port_info d = platform_ide_port_info; | 59 | struct ide_port_info d = platform_ide_port_info; |
61 | 60 | ||
62 | pdata = pdev->dev.platform_data; | 61 | pdata = pdev->dev.platform_data; |
@@ -93,12 +92,6 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
93 | res_alt->start, res_alt->end - res_alt->start + 1); | 92 | res_alt->start, res_alt->end - res_alt->start + 1); |
94 | } | 93 | } |
95 | 94 | ||
96 | hwif = ide_find_port(); | ||
97 | if (!hwif) { | ||
98 | ret = -ENODEV; | ||
99 | goto out; | ||
100 | } | ||
101 | |||
102 | memset(&hw, 0, sizeof(hw)); | 95 | memset(&hw, 0, sizeof(hw)); |
103 | plat_ide_setup_ports(&hw, base, alt_base, pdata, res_irq->start); | 96 | plat_ide_setup_ports(&hw, base, alt_base, pdata, res_irq->start); |
104 | hw.dev = &pdev->dev; | 97 | hw.dev = &pdev->dev; |
@@ -106,11 +99,15 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
106 | if (mmio) | 99 | if (mmio) |
107 | d.host_flags |= IDE_HFLAG_MMIO; | 100 | d.host_flags |= IDE_HFLAG_MMIO; |
108 | 101 | ||
109 | idx[0] = hwif->index; | 102 | host = ide_host_alloc(&d, hws); |
103 | if (host == NULL) { | ||
104 | ret = -ENODEV; | ||
105 | goto out; | ||
106 | } | ||
110 | 107 | ||
111 | ide_device_add(idx, &d, hws); | 108 | ide_host_register(host, &d, hws); |
112 | 109 | ||
113 | platform_set_drvdata(pdev, hwif); | 110 | platform_set_drvdata(pdev, host); |
114 | 111 | ||
115 | return 0; | 112 | return 0; |
116 | 113 | ||
@@ -120,9 +117,9 @@ out: | |||
120 | 117 | ||
121 | static int __devexit plat_ide_remove(struct platform_device *pdev) | 118 | static int __devexit plat_ide_remove(struct platform_device *pdev) |
122 | { | 119 | { |
123 | ide_hwif_t *hwif = pdev->dev.driver_data; | 120 | struct ide_host *host = pdev->dev.driver_data; |
124 | 121 | ||
125 | ide_unregister(hwif); | 122 | ide_host_remove(host); |
126 | 123 | ||
127 | return 0; | 124 | return 0; |
128 | } | 125 | } |
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c index d839df2239fc..b49cf8c2b91a 100644 --- a/drivers/ide/legacy/macide.c +++ b/drivers/ide/legacy/macide.c | |||
@@ -91,8 +91,8 @@ static const char *mac_ide_name[] = | |||
91 | 91 | ||
92 | static int __init macide_init(void) | 92 | static int __init macide_init(void) |
93 | { | 93 | { |
94 | ide_hwif_t *hwif; | ||
95 | ide_ack_intr_t *ack_intr; | 94 | ide_ack_intr_t *ack_intr; |
95 | struct ide_host *host; | ||
96 | unsigned long base; | 96 | unsigned long base; |
97 | int irq; | 97 | int irq; |
98 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; | 98 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
@@ -125,13 +125,9 @@ static int __init macide_init(void) | |||
125 | 125 | ||
126 | macide_setup_ports(&hw, base, irq, ack_intr); | 126 | macide_setup_ports(&hw, base, irq, ack_intr); |
127 | 127 | ||
128 | hwif = ide_find_port(); | 128 | host = ide_host_alloc(NULL, hws); |
129 | if (hwif) { | 129 | if (host) |
130 | u8 index = hwif->index; | 130 | ide_host_register(host, NULL, hws); |
131 | u8 idx[4] = { index, 0xff, 0xff, 0xff }; | ||
132 | |||
133 | ide_device_add(idx, NULL, hws); | ||
134 | } | ||
135 | 131 | ||
136 | return 0; | 132 | return 0; |
137 | } | 133 | } |
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c index 2dc306f852a6..8fb4438a6afd 100644 --- a/drivers/ide/legacy/q40ide.c +++ b/drivers/ide/legacy/q40ide.c | |||
@@ -131,10 +131,9 @@ static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={ | |||
131 | 131 | ||
132 | static int __init q40ide_init(void) | 132 | static int __init q40ide_init(void) |
133 | { | 133 | { |
134 | struct ide_host *host; | ||
134 | int i; | 135 | int i; |
135 | ide_hwif_t *hwif; | ||
136 | hw_regs_t hw[Q40IDE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; | 136 | hw_regs_t hw[Q40IDE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; |
137 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
138 | 137 | ||
139 | if (!MACH_IS_Q40) | 138 | if (!MACH_IS_Q40) |
140 | return -ENODEV; | 139 | return -ENODEV; |
@@ -158,16 +157,12 @@ static int __init q40ide_init(void) | |||
158 | q40_ide_setup_ports(&hw[i], pcide_bases[i], NULL, | 157 | q40_ide_setup_ports(&hw[i], pcide_bases[i], NULL, |
159 | q40ide_default_irq(pcide_bases[i])); | 158 | q40ide_default_irq(pcide_bases[i])); |
160 | 159 | ||
161 | hwif = ide_find_port(); | 160 | hws[i] = &hw[i]; |
162 | if (hwif) { | ||
163 | hwif->chipset = ide_generic; | ||
164 | |||
165 | hws[i] = &hw[i]; | ||
166 | idx[i] = hwif->index; | ||
167 | } | ||
168 | } | 161 | } |
169 | 162 | ||
170 | ide_device_add(idx, &q40ide_port_info, hws); | 163 | host = ide_host_alloc(&q40ide_port_info, hws); |
164 | if (host) | ||
165 | ide_host_register(host, &q40ide_port_info, hws); | ||
171 | 166 | ||
172 | return 0; | 167 | return 0; |
173 | } | 168 | } |