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/gayle.c | |
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/gayle.c')
-rw-r--r-- | drivers/ide/legacy/gayle.c | 16 |
1 files changed, 5 insertions, 11 deletions
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 | } |