diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:50 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:50 -0400 |
commit | c97c6aca75fd5f718056fde7cff798b8cbdb07c0 (patch) | |
tree | 275635f3afb9d3a1f1f9ea5cebe08b5f327fc92c /drivers/ide/legacy | |
parent | 51d87ed0aab98999bebaf891b99730e15502a592 (diff) |
ide: pass hw_regs_t-s to ide_device_add[_all]() (take 3)
* Add 'hw_regs_t **hws' argument to ide_device_add[_all]() and convert
host drivers + ide_legacy_init_one() + ide_setup_pci_device[s]() to use
it instead of calling ide_init_port_hw() directly.
[ However if host has > 1 port we must still set hwif->chipset to hint
consecutive ide_find_port() call that the previous slot is occupied. ]
* Unexport ide_init_port_hw().
v2:
* Use defines instead of hard-coded values in buddha.c, gayle.c and q40ide.c.
(Suggested by Geert Uytterhoeven)
* Better patch description.
v3:
* Fix build problem in ide-cs.c. (Noticed by Stephen Rothwell)
There should be no functional changes caused by this patch.
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy')
-rw-r--r-- | drivers/ide/legacy/buddha.c | 16 | ||||
-rw-r--r-- | drivers/ide/legacy/falconide.c | 6 | ||||
-rw-r--r-- | drivers/ide/legacy/gayle.c | 13 | ||||
-rw-r--r-- | drivers/ide/legacy/ide-4drives.c | 10 | ||||
-rw-r--r-- | drivers/ide/legacy/ide-cs.c | 10 | ||||
-rw-r--r-- | drivers/ide/legacy/ide_platform.c | 9 | ||||
-rw-r--r-- | drivers/ide/legacy/macide.c | 6 | ||||
-rw-r--r-- | drivers/ide/legacy/q40ide.c | 14 |
8 files changed, 37 insertions, 47 deletions
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c index 0497e7f85b09..c61bc6a1db36 100644 --- a/drivers/ide/legacy/buddha.c +++ b/drivers/ide/legacy/buddha.c | |||
@@ -37,6 +37,8 @@ | |||
37 | #define CATWEASEL_NUM_HWIFS 3 | 37 | #define CATWEASEL_NUM_HWIFS 3 |
38 | #define XSURF_NUM_HWIFS 2 | 38 | #define XSURF_NUM_HWIFS 2 |
39 | 39 | ||
40 | #define MAX_NUM_HWIFS 3 | ||
41 | |||
40 | /* | 42 | /* |
41 | * Bases of the IDE interfaces (relative to the board address) | 43 | * Bases of the IDE interfaces (relative to the board address) |
42 | */ | 44 | */ |
@@ -148,7 +150,6 @@ static void __init buddha_setup_ports(hw_regs_t *hw, unsigned long base, | |||
148 | 150 | ||
149 | static int __init buddha_init(void) | 151 | static int __init buddha_init(void) |
150 | { | 152 | { |
151 | hw_regs_t hw; | ||
152 | ide_hwif_t *hwif; | 153 | ide_hwif_t *hwif; |
153 | int i; | 154 | int i; |
154 | 155 | ||
@@ -159,6 +160,7 @@ static int __init buddha_init(void) | |||
159 | 160 | ||
160 | while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { | 161 | while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { |
161 | unsigned long board; | 162 | unsigned long board; |
163 | hw_regs_t hw[MAX_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; | ||
162 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 164 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
163 | 165 | ||
164 | if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) { | 166 | if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) { |
@@ -221,19 +223,19 @@ fail_base2: | |||
221 | ack_intr = xsurf_ack_intr; | 223 | ack_intr = xsurf_ack_intr; |
222 | } | 224 | } |
223 | 225 | ||
224 | buddha_setup_ports(&hw, base, ctl, irq_port, ack_intr); | 226 | buddha_setup_ports(&hw[i], base, ctl, irq_port, |
227 | ack_intr); | ||
225 | 228 | ||
226 | hwif = ide_find_port(); | 229 | hwif = ide_find_port(); |
227 | if (hwif) { | 230 | if (hwif) { |
228 | u8 index = hwif->index; | 231 | hwif->chipset = ide_generic; |
229 | |||
230 | ide_init_port_hw(hwif, &hw); | ||
231 | 232 | ||
232 | idx[i] = index; | 233 | hws[i] = &hw[i]; |
234 | idx[i] = hwif->index; | ||
233 | } | 235 | } |
234 | } | 236 | } |
235 | 237 | ||
236 | ide_device_add(idx, NULL); | 238 | ide_device_add(idx, NULL, hws); |
237 | } | 239 | } |
238 | 240 | ||
239 | return 0; | 241 | return 0; |
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c index 129a812bb57f..1bb2aa72cc7f 100644 --- a/drivers/ide/legacy/falconide.c +++ b/drivers/ide/legacy/falconide.c | |||
@@ -91,8 +91,8 @@ static void __init falconide_setup_ports(hw_regs_t *hw) | |||
91 | 91 | ||
92 | static int __init falconide_init(void) | 92 | static int __init falconide_init(void) |
93 | { | 93 | { |
94 | hw_regs_t hw; | ||
95 | ide_hwif_t *hwif; | 94 | ide_hwif_t *hwif; |
95 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; | ||
96 | 96 | ||
97 | if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE)) | 97 | if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE)) |
98 | return 0; | 98 | return 0; |
@@ -111,14 +111,12 @@ static int __init falconide_init(void) | |||
111 | u8 index = hwif->index; | 111 | u8 index = hwif->index; |
112 | u8 idx[4] = { index, 0xff, 0xff, 0xff }; | 112 | u8 idx[4] = { index, 0xff, 0xff, 0xff }; |
113 | 113 | ||
114 | ide_init_port_hw(hwif, &hw); | ||
115 | |||
116 | /* Atari has a byte-swapped IDE interface */ | 114 | /* Atari has a byte-swapped IDE interface */ |
117 | hwif->input_data = falconide_input_data; | 115 | hwif->input_data = falconide_input_data; |
118 | hwif->output_data = falconide_output_data; | 116 | hwif->output_data = falconide_output_data; |
119 | 117 | ||
120 | ide_get_lock(NULL, NULL); | 118 | ide_get_lock(NULL, NULL); |
121 | ide_device_add(idx, NULL); | 119 | ide_device_add(idx, NULL, hws); |
122 | ide_release_lock(); | 120 | ide_release_lock(); |
123 | } | 121 | } |
124 | 122 | ||
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c index 7e74b20202df..e45c7341186c 100644 --- a/drivers/ide/legacy/gayle.c +++ b/drivers/ide/legacy/gayle.c | |||
@@ -125,6 +125,7 @@ static void __init gayle_setup_ports(hw_regs_t *hw, unsigned long base, | |||
125 | static int __init gayle_init(void) | 125 | static int __init gayle_init(void) |
126 | { | 126 | { |
127 | int a4000, i; | 127 | int a4000, i; |
128 | hw_regs_t hw[GAYLE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; | ||
128 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 129 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
129 | 130 | ||
130 | if (!MACH_IS_AMIGA) | 131 | if (!MACH_IS_AMIGA) |
@@ -151,7 +152,6 @@ found: | |||
151 | for (i = 0; i < GAYLE_NUM_PROBE_HWIFS; i++) { | 152 | for (i = 0; i < GAYLE_NUM_PROBE_HWIFS; i++) { |
152 | unsigned long base, ctrlport, irqport; | 153 | unsigned long base, ctrlport, irqport; |
153 | ide_ack_intr_t *ack_intr; | 154 | ide_ack_intr_t *ack_intr; |
154 | hw_regs_t hw; | ||
155 | ide_hwif_t *hwif; | 155 | ide_hwif_t *hwif; |
156 | unsigned long phys_base, res_start, res_n; | 156 | unsigned long phys_base, res_start, res_n; |
157 | 157 | ||
@@ -179,20 +179,19 @@ found: | |||
179 | base = (unsigned long)ZTWO_VADDR(phys_base); | 179 | base = (unsigned long)ZTWO_VADDR(phys_base); |
180 | ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0; | 180 | ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0; |
181 | 181 | ||
182 | gayle_setup_ports(&hw, base, ctrlport, irqport, ack_intr); | 182 | gayle_setup_ports(&hw[i], base, ctrlport, irqport, ack_intr); |
183 | 183 | ||
184 | hwif = ide_find_port(); | 184 | hwif = ide_find_port(); |
185 | if (hwif) { | 185 | if (hwif) { |
186 | u8 index = hwif->index; | 186 | hwif->chipset = ide_generic; |
187 | 187 | ||
188 | ide_init_port_hw(hwif, &hw); | 188 | hws[i] = &hw[i]; |
189 | 189 | idx[i] = hwif->index; | |
190 | idx[i] = index; | ||
191 | } else | 190 | } else |
192 | release_mem_region(res_start, res_n); | 191 | release_mem_region(res_start, res_n); |
193 | } | 192 | } |
194 | 193 | ||
195 | ide_device_add(idx, NULL); | 194 | ide_device_add(idx, NULL, hws); |
196 | 195 | ||
197 | return 0; | 196 | return 0; |
198 | } | 197 | } |
diff --git a/drivers/ide/legacy/ide-4drives.c b/drivers/ide/legacy/ide-4drives.c index 89c8ff0a4d08..6310dc50e3c5 100644 --- a/drivers/ide/legacy/ide-4drives.c +++ b/drivers/ide/legacy/ide-4drives.c | |||
@@ -30,8 +30,8 @@ static int __init ide_4drives_init(void) | |||
30 | { | 30 | { |
31 | ide_hwif_t *hwif, *mate; | 31 | ide_hwif_t *hwif, *mate; |
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 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 34 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
34 | hw_regs_t hw; | ||
35 | 35 | ||
36 | if (probe_4drives == 0) | 36 | if (probe_4drives == 0) |
37 | return -ENODEV; | 37 | return -ENODEV; |
@@ -57,17 +57,19 @@ static int __init ide_4drives_init(void) | |||
57 | 57 | ||
58 | hwif = ide_find_port(); | 58 | hwif = ide_find_port(); |
59 | if (hwif) { | 59 | if (hwif) { |
60 | ide_init_port_hw(hwif, &hw); | 60 | hwif->chipset = ide_4drives; |
61 | |||
62 | hws[0] = &hw; | ||
61 | idx[0] = hwif->index; | 63 | idx[0] = hwif->index; |
62 | } | 64 | } |
63 | 65 | ||
64 | mate = ide_find_port(); | 66 | mate = ide_find_port(); |
65 | if (mate) { | 67 | if (mate) { |
66 | ide_init_port_hw(mate, &hw); | 68 | hws[1] = &hw; |
67 | idx[1] = mate->index; | 69 | idx[1] = mate->index; |
68 | } | 70 | } |
69 | 71 | ||
70 | ide_device_add(idx, &ide_4drives_port_info); | 72 | ide_device_add(idx, &ide_4drives_port_info, hws); |
71 | 73 | ||
72 | return 0; | 74 | return 0; |
73 | } | 75 | } |
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index 27b1e0b7ecb4..f93d5454ebf8 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
@@ -161,8 +161,8 @@ static ide_hwif_t *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 | ide_hwif_t *hwif; | 163 | ide_hwif_t *hwif; |
164 | hw_regs_t hw; | ||
165 | int i; | 164 | int i; |
165 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; | ||
166 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 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)) { |
@@ -188,13 +188,9 @@ static ide_hwif_t *idecs_register(unsigned long io, unsigned long ctl, | |||
188 | if (hwif == NULL) | 188 | if (hwif == NULL) |
189 | goto out_release; | 189 | goto out_release; |
190 | 190 | ||
191 | i = hwif->index; | 191 | idx[0] = hwif->index; |
192 | 192 | ||
193 | ide_init_port_hw(hwif, &hw); | 193 | ide_device_add(idx, &idecs_port_info, hws); |
194 | |||
195 | idx[0] = i; | ||
196 | |||
197 | ide_device_add(idx, &idecs_port_info); | ||
198 | 194 | ||
199 | if (hwif->present) | 195 | if (hwif->present) |
200 | return hwif; | 196 | return hwif; |
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index a249562b34b5..609da0d43196 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c | |||
@@ -54,10 +54,9 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
54 | void __iomem *base, *alt_base; | 54 | void __iomem *base, *alt_base; |
55 | ide_hwif_t *hwif; | 55 | ide_hwif_t *hwif; |
56 | struct pata_platform_info *pdata; | 56 | struct pata_platform_info *pdata; |
57 | int ret = 0, mmio = 0; | ||
58 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; | ||
57 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 59 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
58 | int ret = 0; | ||
59 | int mmio = 0; | ||
60 | hw_regs_t hw; | ||
61 | struct ide_port_info d = platform_ide_port_info; | 60 | struct ide_port_info d = platform_ide_port_info; |
62 | 61 | ||
63 | pdata = pdev->dev.platform_data; | 62 | pdata = pdev->dev.platform_data; |
@@ -104,8 +103,6 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
104 | plat_ide_setup_ports(&hw, base, alt_base, pdata, res_irq->start); | 103 | plat_ide_setup_ports(&hw, base, alt_base, pdata, res_irq->start); |
105 | hw.dev = &pdev->dev; | 104 | hw.dev = &pdev->dev; |
106 | 105 | ||
107 | ide_init_port_hw(hwif, &hw); | ||
108 | |||
109 | if (mmio) { | 106 | if (mmio) { |
110 | d.host_flags |= IDE_HFLAG_MMIO; | 107 | d.host_flags |= IDE_HFLAG_MMIO; |
111 | default_hwif_mmiops(hwif); | 108 | default_hwif_mmiops(hwif); |
@@ -113,7 +110,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
113 | 110 | ||
114 | idx[0] = hwif->index; | 111 | idx[0] = hwif->index; |
115 | 112 | ||
116 | ide_device_add(idx, &d); | 113 | ide_device_add(idx, &d, hws); |
117 | 114 | ||
118 | platform_set_drvdata(pdev, hwif); | 115 | platform_set_drvdata(pdev, hwif); |
119 | 116 | ||
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c index 0a6195bcfeda..d839df2239fc 100644 --- a/drivers/ide/legacy/macide.c +++ b/drivers/ide/legacy/macide.c | |||
@@ -95,7 +95,7 @@ static int __init macide_init(void) | |||
95 | ide_ack_intr_t *ack_intr; | 95 | ide_ack_intr_t *ack_intr; |
96 | unsigned long base; | 96 | unsigned long base; |
97 | int irq; | 97 | int irq; |
98 | hw_regs_t hw; | 98 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
99 | 99 | ||
100 | if (!MACH_IS_MAC) | 100 | if (!MACH_IS_MAC) |
101 | return -ENODEV; | 101 | return -ENODEV; |
@@ -130,9 +130,7 @@ static int __init macide_init(void) | |||
130 | u8 index = hwif->index; | 130 | u8 index = hwif->index; |
131 | u8 idx[4] = { index, 0xff, 0xff, 0xff }; | 131 | u8 idx[4] = { index, 0xff, 0xff, 0xff }; |
132 | 132 | ||
133 | ide_init_port_hw(hwif, &hw); | 133 | ide_device_add(idx, NULL, hws); |
134 | |||
135 | ide_device_add(idx, NULL); | ||
136 | } | 134 | } |
137 | 135 | ||
138 | return 0; | 136 | return 0; |
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c index 9c2b9d078f69..fcb04b8b0238 100644 --- a/drivers/ide/legacy/q40ide.c +++ b/drivers/ide/legacy/q40ide.c | |||
@@ -112,7 +112,7 @@ static int __init q40ide_init(void) | |||
112 | { | 112 | { |
113 | int i; | 113 | int i; |
114 | ide_hwif_t *hwif; | 114 | ide_hwif_t *hwif; |
115 | const char *name; | 115 | hw_regs_t hw[Q40IDE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; |
116 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 116 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
117 | 117 | ||
118 | if (!MACH_IS_Q40) | 118 | if (!MACH_IS_Q40) |
@@ -121,9 +121,8 @@ static int __init q40ide_init(void) | |||
121 | printk(KERN_INFO "ide: Q40 IDE controller\n"); | 121 | printk(KERN_INFO "ide: Q40 IDE controller\n"); |
122 | 122 | ||
123 | for (i = 0; i < Q40IDE_NUM_HWIFS; i++) { | 123 | for (i = 0; i < Q40IDE_NUM_HWIFS; i++) { |
124 | hw_regs_t hw; | 124 | const char *name = q40_ide_names[i]; |
125 | 125 | ||
126 | name = q40_ide_names[i]; | ||
127 | if (!request_region(pcide_bases[i], 8, name)) { | 126 | if (!request_region(pcide_bases[i], 8, name)) { |
128 | printk("could not reserve ports %lx-%lx for %s\n", | 127 | printk("could not reserve ports %lx-%lx for %s\n", |
129 | pcide_bases[i],pcide_bases[i]+8,name); | 128 | pcide_bases[i],pcide_bases[i]+8,name); |
@@ -135,24 +134,23 @@ static int __init q40ide_init(void) | |||
135 | release_region(pcide_bases[i], 8); | 134 | release_region(pcide_bases[i], 8); |
136 | continue; | 135 | continue; |
137 | } | 136 | } |
138 | q40_ide_setup_ports(&hw, pcide_bases[i], | 137 | q40_ide_setup_ports(&hw[i], pcide_bases[i], NULL, |
139 | NULL, | ||
140 | // m68kide_iops, | ||
141 | q40ide_default_irq(pcide_bases[i])); | 138 | q40ide_default_irq(pcide_bases[i])); |
142 | 139 | ||
143 | hwif = ide_find_port(); | 140 | hwif = ide_find_port(); |
144 | if (hwif) { | 141 | if (hwif) { |
145 | ide_init_port_hw(hwif, &hw); | 142 | hwif->chipset = ide_generic; |
146 | 143 | ||
147 | /* Q40 has a byte-swapped IDE interface */ | 144 | /* Q40 has a byte-swapped IDE interface */ |
148 | hwif->input_data = q40ide_input_data; | 145 | hwif->input_data = q40ide_input_data; |
149 | hwif->output_data = q40ide_output_data; | 146 | hwif->output_data = q40ide_output_data; |
150 | 147 | ||
148 | hws[i] = &hw[i]; | ||
151 | idx[i] = hwif->index; | 149 | idx[i] = hwif->index; |
152 | } | 150 | } |
153 | } | 151 | } |
154 | 152 | ||
155 | ide_device_add(idx, NULL); | 153 | ide_device_add(idx, NULL, hws); |
156 | 154 | ||
157 | return 0; | 155 | return 0; |
158 | } | 156 | } |