diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:26:06 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:26:06 -0500 |
commit | 15b99ac1729503db9e6dc642a50b9b6cb3bf51f9 (patch) | |
tree | cfb8897487beba502aac2b28bc35066a87e34299 /drivers/isdn/hisax | |
parent | fba395eee7d3f342ca739c20f5b3ee635d0420a0 (diff) |
[PATCH] pcmcia: add return value to _config() functions
Most of the driver initialization isn't done in the .probe function, but in
the internal _config() functions. Make them return a value, so that .probe
can properly report whether the probing of the device succeeded or not.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/isdn/hisax')
-rw-r--r-- | drivers/isdn/hisax/avma1_cs.c | 19 | ||||
-rw-r--r-- | drivers/isdn/hisax/elsa_cs.c | 15 | ||||
-rw-r--r-- | drivers/isdn/hisax/sedlbauer_cs.c | 16 | ||||
-rw-r--r-- | drivers/isdn/hisax/teles_cs.c | 21 |
4 files changed, 35 insertions, 36 deletions
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index ff6b0e185bc4..11c7c4f09e7e 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c | |||
@@ -67,7 +67,7 @@ module_param(isdnprot, int, 0); | |||
67 | handler. | 67 | handler. |
68 | */ | 68 | */ |
69 | 69 | ||
70 | static void avma1cs_config(struct pcmcia_device *link); | 70 | static int avma1cs_config(struct pcmcia_device *link); |
71 | static void avma1cs_release(struct pcmcia_device *link); | 71 | static void avma1cs_release(struct pcmcia_device *link); |
72 | 72 | ||
73 | /* | 73 | /* |
@@ -116,7 +116,7 @@ typedef struct local_info_t { | |||
116 | 116 | ||
117 | ======================================================================*/ | 117 | ======================================================================*/ |
118 | 118 | ||
119 | static int avma1cs_attach(struct pcmcia_device *p_dev) | 119 | static int avma1cs_probe(struct pcmcia_device *p_dev) |
120 | { | 120 | { |
121 | local_info_t *local; | 121 | local_info_t *local; |
122 | 122 | ||
@@ -150,9 +150,7 @@ static int avma1cs_attach(struct pcmcia_device *p_dev) | |||
150 | p_dev->conf.Present = PRESENT_OPTION; | 150 | p_dev->conf.Present = PRESENT_OPTION; |
151 | 151 | ||
152 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 152 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
153 | avma1cs_config(p_dev); | 153 | return avma1cs_config(p_dev); |
154 | |||
155 | return 0; | ||
156 | } /* avma1cs_attach */ | 154 | } /* avma1cs_attach */ |
157 | 155 | ||
158 | /*====================================================================== | 156 | /*====================================================================== |
@@ -206,7 +204,7 @@ static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, | |||
206 | return get_tuple(handle, tuple, parse); | 204 | return get_tuple(handle, tuple, parse); |
207 | } | 205 | } |
208 | 206 | ||
209 | static void avma1cs_config(struct pcmcia_device *link) | 207 | static int avma1cs_config(struct pcmcia_device *link) |
210 | { | 208 | { |
211 | tuple_t tuple; | 209 | tuple_t tuple; |
212 | cisparse_t parse; | 210 | cisparse_t parse; |
@@ -242,7 +240,7 @@ static void avma1cs_config(struct pcmcia_device *link) | |||
242 | if (i != CS_SUCCESS) { | 240 | if (i != CS_SUCCESS) { |
243 | cs_error(link, ParseTuple, i); | 241 | cs_error(link, ParseTuple, i); |
244 | link->state &= ~DEV_CONFIG_PENDING; | 242 | link->state &= ~DEV_CONFIG_PENDING; |
245 | return; | 243 | return -ENODEV; |
246 | } | 244 | } |
247 | 245 | ||
248 | /* Configure card */ | 246 | /* Configure card */ |
@@ -325,7 +323,7 @@ found_port: | |||
325 | /* If any step failed, release any partially configured state */ | 323 | /* If any step failed, release any partially configured state */ |
326 | if (i != 0) { | 324 | if (i != 0) { |
327 | avma1cs_release(link); | 325 | avma1cs_release(link); |
328 | return; | 326 | return -ENODEV; |
329 | } | 327 | } |
330 | 328 | ||
331 | printk(KERN_NOTICE "avma1_cs: checking at i/o %#x, irq %d\n", | 329 | printk(KERN_NOTICE "avma1_cs: checking at i/o %#x, irq %d\n", |
@@ -340,10 +338,11 @@ found_port: | |||
340 | if (i < 0) { | 338 | if (i < 0) { |
341 | printk(KERN_ERR "avma1_cs: failed to initialize AVM A1 PCMCIA %d at i/o %#x\n", i, link->io.BasePort1); | 339 | printk(KERN_ERR "avma1_cs: failed to initialize AVM A1 PCMCIA %d at i/o %#x\n", i, link->io.BasePort1); |
342 | avma1cs_release(link); | 340 | avma1cs_release(link); |
343 | return; | 341 | return -ENODEV; |
344 | } | 342 | } |
345 | dev->node.minor = i; | 343 | dev->node.minor = i; |
346 | 344 | ||
345 | return 0; | ||
347 | } /* avma1cs_config */ | 346 | } /* avma1cs_config */ |
348 | 347 | ||
349 | /*====================================================================== | 348 | /*====================================================================== |
@@ -379,7 +378,7 @@ static struct pcmcia_driver avma1cs_driver = { | |||
379 | .drv = { | 378 | .drv = { |
380 | .name = "avma1_cs", | 379 | .name = "avma1_cs", |
381 | }, | 380 | }, |
382 | .probe = avma1cs_attach, | 381 | .probe = avma1cs_probe, |
383 | .remove = avma1cs_detach, | 382 | .remove = avma1cs_detach, |
384 | .id_table = avma1cs_ids, | 383 | .id_table = avma1cs_ids, |
385 | }; | 384 | }; |
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index 7a42bd43162f..4856680ce761 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c | |||
@@ -94,7 +94,7 @@ module_param(protocol, int, 0); | |||
94 | handler. | 94 | handler. |
95 | */ | 95 | */ |
96 | 96 | ||
97 | static void elsa_cs_config(struct pcmcia_device *link); | 97 | static int elsa_cs_config(struct pcmcia_device *link); |
98 | static void elsa_cs_release(struct pcmcia_device *link); | 98 | static void elsa_cs_release(struct pcmcia_device *link); |
99 | 99 | ||
100 | /* | 100 | /* |
@@ -139,7 +139,7 @@ typedef struct local_info_t { | |||
139 | 139 | ||
140 | ======================================================================*/ | 140 | ======================================================================*/ |
141 | 141 | ||
142 | static int elsa_cs_attach(struct pcmcia_device *link) | 142 | static int elsa_cs_probe(struct pcmcia_device *link) |
143 | { | 143 | { |
144 | local_info_t *local; | 144 | local_info_t *local; |
145 | 145 | ||
@@ -175,9 +175,7 @@ static int elsa_cs_attach(struct pcmcia_device *link) | |||
175 | link->conf.IntType = INT_MEMORY_AND_IO; | 175 | link->conf.IntType = INT_MEMORY_AND_IO; |
176 | 176 | ||
177 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 177 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
178 | elsa_cs_config(link); | 178 | return elsa_cs_config(link); |
179 | |||
180 | return 0; | ||
181 | } /* elsa_cs_attach */ | 179 | } /* elsa_cs_attach */ |
182 | 180 | ||
183 | /*====================================================================== | 181 | /*====================================================================== |
@@ -235,7 +233,7 @@ static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, | |||
235 | return get_tuple(handle, tuple, parse); | 233 | return get_tuple(handle, tuple, parse); |
236 | } | 234 | } |
237 | 235 | ||
238 | static void elsa_cs_config(struct pcmcia_device *link) | 236 | static int elsa_cs_config(struct pcmcia_device *link) |
239 | { | 237 | { |
240 | tuple_t tuple; | 238 | tuple_t tuple; |
241 | cisparse_t parse; | 239 | cisparse_t parse; |
@@ -346,10 +344,11 @@ static void elsa_cs_config(struct pcmcia_device *link) | |||
346 | } else | 344 | } else |
347 | ((local_info_t*)link->priv)->cardnr = i; | 345 | ((local_info_t*)link->priv)->cardnr = i; |
348 | 346 | ||
349 | return; | 347 | return 0; |
350 | cs_failed: | 348 | cs_failed: |
351 | cs_error(link, last_fn, i); | 349 | cs_error(link, last_fn, i); |
352 | elsa_cs_release(link); | 350 | elsa_cs_release(link); |
351 | return -ENODEV; | ||
353 | } /* elsa_cs_config */ | 352 | } /* elsa_cs_config */ |
354 | 353 | ||
355 | /*====================================================================== | 354 | /*====================================================================== |
@@ -406,7 +405,7 @@ static struct pcmcia_driver elsa_cs_driver = { | |||
406 | .drv = { | 405 | .drv = { |
407 | .name = "elsa_cs", | 406 | .name = "elsa_cs", |
408 | }, | 407 | }, |
409 | .probe = elsa_cs_attach, | 408 | .probe = elsa_cs_probe, |
410 | .remove = elsa_cs_detach, | 409 | .remove = elsa_cs_detach, |
411 | .id_table = elsa_ids, | 410 | .id_table = elsa_ids, |
412 | .suspend = elsa_suspend, | 411 | .suspend = elsa_suspend, |
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 2af48a684654..a35a29586a62 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c | |||
@@ -95,7 +95,7 @@ module_param(protocol, int, 0); | |||
95 | event handler. | 95 | event handler. |
96 | */ | 96 | */ |
97 | 97 | ||
98 | static void sedlbauer_config(struct pcmcia_device *link); | 98 | static int sedlbauer_config(struct pcmcia_device *link); |
99 | static void sedlbauer_release(struct pcmcia_device *link); | 99 | static void sedlbauer_release(struct pcmcia_device *link); |
100 | 100 | ||
101 | /* | 101 | /* |
@@ -148,7 +148,7 @@ typedef struct local_info_t { | |||
148 | 148 | ||
149 | ======================================================================*/ | 149 | ======================================================================*/ |
150 | 150 | ||
151 | static int sedlbauer_attach(struct pcmcia_device *link) | 151 | static int sedlbauer_probe(struct pcmcia_device *link) |
152 | { | 152 | { |
153 | local_info_t *local; | 153 | local_info_t *local; |
154 | 154 | ||
@@ -187,9 +187,7 @@ static int sedlbauer_attach(struct pcmcia_device *link) | |||
187 | link->conf.IntType = INT_MEMORY_AND_IO; | 187 | link->conf.IntType = INT_MEMORY_AND_IO; |
188 | 188 | ||
189 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 189 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
190 | sedlbauer_config(link); | 190 | return sedlbauer_config(link); |
191 | |||
192 | return 0; | ||
193 | } /* sedlbauer_attach */ | 191 | } /* sedlbauer_attach */ |
194 | 192 | ||
195 | /*====================================================================== | 193 | /*====================================================================== |
@@ -224,7 +222,7 @@ static void sedlbauer_detach(struct pcmcia_device *link) | |||
224 | #define CS_CHECK(fn, ret) \ | 222 | #define CS_CHECK(fn, ret) \ |
225 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 223 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
226 | 224 | ||
227 | static void sedlbauer_config(struct pcmcia_device *link) | 225 | static int sedlbauer_config(struct pcmcia_device *link) |
228 | { | 226 | { |
229 | local_info_t *dev = link->priv; | 227 | local_info_t *dev = link->priv; |
230 | tuple_t tuple; | 228 | tuple_t tuple; |
@@ -423,14 +421,16 @@ static void sedlbauer_config(struct pcmcia_device *link) | |||
423 | printk(KERN_ERR "sedlbauer_cs: failed to initialize SEDLBAUER PCMCIA %d at i/o %#x\n", | 421 | printk(KERN_ERR "sedlbauer_cs: failed to initialize SEDLBAUER PCMCIA %d at i/o %#x\n", |
424 | last_ret, link->io.BasePort1); | 422 | last_ret, link->io.BasePort1); |
425 | sedlbauer_release(link); | 423 | sedlbauer_release(link); |
424 | return -ENODEV; | ||
426 | } else | 425 | } else |
427 | ((local_info_t*)link->priv)->cardnr = last_ret; | 426 | ((local_info_t*)link->priv)->cardnr = last_ret; |
428 | 427 | ||
429 | return; | 428 | return 0; |
430 | 429 | ||
431 | cs_failed: | 430 | cs_failed: |
432 | cs_error(link, last_fn, last_ret); | 431 | cs_error(link, last_fn, last_ret); |
433 | sedlbauer_release(link); | 432 | sedlbauer_release(link); |
433 | return -ENODEV; | ||
434 | 434 | ||
435 | } /* sedlbauer_config */ | 435 | } /* sedlbauer_config */ |
436 | 436 | ||
@@ -493,7 +493,7 @@ static struct pcmcia_driver sedlbauer_driver = { | |||
493 | .drv = { | 493 | .drv = { |
494 | .name = "sedlbauer_cs", | 494 | .name = "sedlbauer_cs", |
495 | }, | 495 | }, |
496 | .probe = sedlbauer_attach, | 496 | .probe = sedlbauer_probe, |
497 | .remove = sedlbauer_detach, | 497 | .remove = sedlbauer_detach, |
498 | .id_table = sedlbauer_ids, | 498 | .id_table = sedlbauer_ids, |
499 | .suspend = sedlbauer_suspend, | 499 | .suspend = sedlbauer_suspend, |
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 698e9ec95f0b..7b66038096f3 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c | |||
@@ -75,7 +75,7 @@ module_param(protocol, int, 0); | |||
75 | handler. | 75 | handler. |
76 | */ | 76 | */ |
77 | 77 | ||
78 | static void teles_cs_config(struct pcmcia_device *link); | 78 | static int teles_cs_config(struct pcmcia_device *link); |
79 | static void teles_cs_release(struct pcmcia_device *link); | 79 | static void teles_cs_release(struct pcmcia_device *link); |
80 | 80 | ||
81 | /* | 81 | /* |
@@ -130,7 +130,7 @@ typedef struct local_info_t { | |||
130 | 130 | ||
131 | ======================================================================*/ | 131 | ======================================================================*/ |
132 | 132 | ||
133 | static int teles_attach(struct pcmcia_device *link) | 133 | static int teles_probe(struct pcmcia_device *link) |
134 | { | 134 | { |
135 | local_info_t *local; | 135 | local_info_t *local; |
136 | 136 | ||
@@ -165,9 +165,7 @@ static int teles_attach(struct pcmcia_device *link) | |||
165 | link->conf.IntType = INT_MEMORY_AND_IO; | 165 | link->conf.IntType = INT_MEMORY_AND_IO; |
166 | 166 | ||
167 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 167 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
168 | teles_cs_config(link); | 168 | return teles_cs_config(link); |
169 | |||
170 | return 0; | ||
171 | } /* teles_attach */ | 169 | } /* teles_attach */ |
172 | 170 | ||
173 | /*====================================================================== | 171 | /*====================================================================== |
@@ -225,7 +223,7 @@ static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, | |||
225 | return get_tuple(handle, tuple, parse); | 223 | return get_tuple(handle, tuple, parse); |
226 | } | 224 | } |
227 | 225 | ||
228 | static void teles_cs_config(struct pcmcia_device *link) | 226 | static int teles_cs_config(struct pcmcia_device *link) |
229 | { | 227 | { |
230 | tuple_t tuple; | 228 | tuple_t tuple; |
231 | cisparse_t parse; | 229 | cisparse_t parse; |
@@ -333,13 +331,16 @@ static void teles_cs_config(struct pcmcia_device *link) | |||
333 | printk(KERN_ERR "teles_cs: failed to initialize Teles PCMCIA %d at i/o %#x\n", | 331 | printk(KERN_ERR "teles_cs: failed to initialize Teles PCMCIA %d at i/o %#x\n", |
334 | i, link->io.BasePort1); | 332 | i, link->io.BasePort1); |
335 | teles_cs_release(link); | 333 | teles_cs_release(link); |
336 | } else | 334 | return -ENODEV; |
337 | ((local_info_t*)link->priv)->cardnr = i; | 335 | } |
336 | |||
337 | ((local_info_t*)link->priv)->cardnr = i; | ||
338 | return 0; | ||
338 | 339 | ||
339 | return; | ||
340 | cs_failed: | 340 | cs_failed: |
341 | cs_error(link, last_fn, i); | 341 | cs_error(link, last_fn, i); |
342 | teles_cs_release(link); | 342 | teles_cs_release(link); |
343 | return -ENODEV; | ||
343 | } /* teles_cs_config */ | 344 | } /* teles_cs_config */ |
344 | 345 | ||
345 | /*====================================================================== | 346 | /*====================================================================== |
@@ -396,7 +397,7 @@ static struct pcmcia_driver teles_cs_driver = { | |||
396 | .drv = { | 397 | .drv = { |
397 | .name = "teles_cs", | 398 | .name = "teles_cs", |
398 | }, | 399 | }, |
399 | .probe = teles_attach, | 400 | .probe = teles_probe, |
400 | .remove = teles_detach, | 401 | .remove = teles_detach, |
401 | .id_table = teles_ids, | 402 | .id_table = teles_ids, |
402 | .suspend = teles_suspend, | 403 | .suspend = teles_suspend, |