aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:57 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:57 -0400
commit6f904d015262dfa43eb1cecc00b0998b4c3543f2 (patch)
treed12a5818072d04525db6eb2d74668ba03bdead2d /drivers/ide/legacy
parent48c3c1072651922ed153bcf0a33ea82cf20df390 (diff)
ide: add ide_host_add() helper
Add ide_host_add() helper which does ide_host_alloc()+ide_host_register(), then convert ide_setup_pci_device[s](), ide_legacy_device_add() and some host drivers to use it. While at it: * Fix ide_setup_pci_device[s](), ide_arm.c, gayle.c, ide-4drives.c, macide.c, q40ide.c, cmd640.c and cs5520.c to return correct error value. * -ENOENT -> -ENOMEM in rapide.c, ide-h8300.c, ide-generic.c, au1xxx-ide.c and pmac.c * -ENODEV -> -ENOMEM in palm_bk3710.c, ide_platform.c and delkin_cb.c * -1 -> -ENOMEM in ide-pnp.c Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy')
-rw-r--r--drivers/ide/legacy/buddha.c5
-rw-r--r--drivers/ide/legacy/gayle.c7
-rw-r--r--drivers/ide/legacy/ide-4drives.c7
-rw-r--r--drivers/ide/legacy/ide-cs.c8
-rw-r--r--drivers/ide/legacy/ide_platform.c8
-rw-r--r--drivers/ide/legacy/macide.c7
-rw-r--r--drivers/ide/legacy/q40ide.c7
7 files changed, 10 insertions, 39 deletions
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c
index 2625667fab4c..7c2afa97f417 100644
--- a/drivers/ide/legacy/buddha.c
+++ b/drivers/ide/legacy/buddha.c
@@ -151,7 +151,6 @@ static void __init buddha_setup_ports(hw_regs_t *hw, unsigned long base,
151static int __init buddha_init(void) 151static int __init buddha_init(void)
152{ 152{
153 struct zorro_dev *z = NULL; 153 struct zorro_dev *z = NULL;
154 struct ide_host *host;
155 u_long buddha_board = 0; 154 u_long buddha_board = 0;
156 BuddhaType type; 155 BuddhaType type;
157 int buddha_num_hwifs, i; 156 int buddha_num_hwifs, i;
@@ -226,9 +225,7 @@ fail_base2:
226 hws[i] = &hw[i]; 225 hws[i] = &hw[i];
227 } 226 }
228 227
229 host = ide_host_alloc(NULL, hws); 228 ide_host_add(NULL, hws, NULL);
230 if (host)
231 ide_host_register(host, NULL, hws);
232 } 229 }
233 230
234 return 0; 231 return 0;
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c
index 13d22bded6b4..dd5c467d8dd0 100644
--- a/drivers/ide/legacy/gayle.c
+++ b/drivers/ide/legacy/gayle.c
@@ -127,7 +127,6 @@ 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;
131 int a4000, i; 130 int a4000, i;
132 hw_regs_t hw[GAYLE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; 131 hw_regs_t hw[GAYLE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL };
133 132
@@ -180,11 +179,7 @@ found:
180 hws[i] = &hw[i]; 179 hws[i] = &hw[i];
181 } 180 }
182 181
183 host = ide_host_alloc(NULL, hws); 182 return ide_host_add(NULL, hws, NULL);
184 if (host)
185 ide_host_register(host, NULL, hws);
186
187 return 0;
188} 183}
189 184
190module_init(gayle_init); 185module_init(gayle_init);
diff --git a/drivers/ide/legacy/ide-4drives.c b/drivers/ide/legacy/ide-4drives.c
index 5935153ef2ad..c76d55de6996 100644
--- a/drivers/ide/legacy/ide-4drives.c
+++ b/drivers/ide/legacy/ide-4drives.c
@@ -28,7 +28,6 @@ static const struct ide_port_info ide_4drives_port_info = {
28 28
29static int __init ide_4drives_init(void) 29static int __init ide_4drives_init(void)
30{ 30{
31 struct ide_host *host;
32 unsigned long base = 0x1f0, ctl = 0x3f6; 31 unsigned long base = 0x1f0, ctl = 0x3f6;
33 hw_regs_t hw, *hws[] = { &hw, &hw, NULL, NULL }; 32 hw_regs_t hw, *hws[] = { &hw, &hw, NULL, NULL };
34 33
@@ -54,11 +53,7 @@ static int __init ide_4drives_init(void)
54 hw.irq = 14; 53 hw.irq = 14;
55 hw.chipset = ide_4drives; 54 hw.chipset = ide_4drives;
56 55
57 host = ide_host_alloc(&ide_4drives_port_info, hws); 56 return ide_host_add(&ide_4drives_port_info, hws, NULL);
58 if (host)
59 ide_host_register(host, &ide_4drives_port_info, hws);
60
61 return 0;
62} 57}
63 58
64module_init(ide_4drives_init); 59module_init(ide_4drives_init);
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index 1a4b9e6887fa..21bfac137844 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -162,7 +162,7 @@ static struct ide_host *idecs_register(unsigned long io, unsigned long ctl,
162{ 162{
163 struct ide_host *host; 163 struct ide_host *host;
164 ide_hwif_t *hwif; 164 ide_hwif_t *hwif;
165 int i; 165 int i, rc;
166 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 166 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
167 167
168 if (!request_region(io, 8, DRV_NAME)) { 168 if (!request_region(io, 8, DRV_NAME)) {
@@ -184,12 +184,10 @@ static struct ide_host *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 host = ide_host_alloc(&idecs_port_info, hws); 187 rc = ide_host_add(&idecs_port_info, hws, &host);
188 if (host == NULL) 188 if (rc)
189 goto out_release; 189 goto out_release;
190 190
191 ide_host_register(host, &idecs_port_info, hws);
192
193 hwif = host->ports[0]; 191 hwif = host->ports[0];
194 192
195 if (hwif->present) 193 if (hwif->present)
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c
index 58a942c6a131..051b4ab0f359 100644
--- a/drivers/ide/legacy/ide_platform.c
+++ b/drivers/ide/legacy/ide_platform.c
@@ -99,13 +99,9 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
99 if (mmio) 99 if (mmio)
100 d.host_flags |= IDE_HFLAG_MMIO; 100 d.host_flags |= IDE_HFLAG_MMIO;
101 101
102 host = ide_host_alloc(&d, hws); 102 ret = ide_host_add(&d, hws, &host);
103 if (host == NULL) { 103 if (ret)
104 ret = -ENODEV;
105 goto out; 104 goto out;
106 }
107
108 ide_host_register(host, &d, hws);
109 105
110 platform_set_drvdata(pdev, host); 106 platform_set_drvdata(pdev, host);
111 107
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
index b49cf8c2b91a..a0bb167980e7 100644
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -92,7 +92,6 @@ static const char *mac_ide_name[] =
92static int __init macide_init(void) 92static int __init macide_init(void)
93{ 93{
94 ide_ack_intr_t *ack_intr; 94 ide_ack_intr_t *ack_intr;
95 struct ide_host *host;
96 unsigned long base; 95 unsigned long base;
97 int irq; 96 int irq;
98 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; 97 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
@@ -125,11 +124,7 @@ static int __init macide_init(void)
125 124
126 macide_setup_ports(&hw, base, irq, ack_intr); 125 macide_setup_ports(&hw, base, irq, ack_intr);
127 126
128 host = ide_host_alloc(NULL, hws); 127 return ide_host_add(NULL, hws, NULL);
129 if (host)
130 ide_host_register(host, NULL, hws);
131
132 return 0;
133} 128}
134 129
135module_init(macide_init); 130module_init(macide_init);
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c
index 8fb4438a6afd..4abd8fc78197 100644
--- a/drivers/ide/legacy/q40ide.c
+++ b/drivers/ide/legacy/q40ide.c
@@ -131,7 +131,6 @@ static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={
131 131
132static int __init q40ide_init(void) 132static int __init q40ide_init(void)
133{ 133{
134 struct ide_host *host;
135 int i; 134 int i;
136 hw_regs_t hw[Q40IDE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; 135 hw_regs_t hw[Q40IDE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL };
137 136
@@ -160,11 +159,7 @@ static int __init q40ide_init(void)
160 hws[i] = &hw[i]; 159 hws[i] = &hw[i];
161 } 160 }
162 161
163 host = ide_host_alloc(&q40ide_port_info, hws); 162 return ide_host_add(&q40ide_port_info, hws, NULL);
164 if (host)
165 ide_host_register(host, &q40ide_port_info, hws);
166
167 return 0;
168} 163}
169 164
170module_init(q40ide_init); 165module_init(q40ide_init);