aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:26:06 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:26:06 -0500
commit15b99ac1729503db9e6dc642a50b9b6cb3bf51f9 (patch)
treecfb8897487beba502aac2b28bc35066a87e34299 /drivers/isdn
parentfba395eee7d3f342ca739c20f5b3ee635d0420a0 (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')
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c21
-rw-r--r--drivers/isdn/hisax/avma1_cs.c19
-rw-r--r--drivers/isdn/hisax/elsa_cs.c15
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c16
-rw-r--r--drivers/isdn/hisax/teles_cs.c21
5 files changed, 45 insertions, 47 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index c9c794e2926d..28f9211726c5 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -51,7 +51,7 @@ MODULE_LICENSE("GPL");
51 handler. 51 handler.
52*/ 52*/
53 53
54static void avmcs_config(struct pcmcia_device *link); 54static int avmcs_config(struct pcmcia_device *link);
55static void avmcs_release(struct pcmcia_device *link); 55static void avmcs_release(struct pcmcia_device *link);
56 56
57/* 57/*
@@ -99,7 +99,7 @@ typedef struct local_info_t {
99 99
100======================================================================*/ 100======================================================================*/
101 101
102static int avmcs_attach(struct pcmcia_device *p_dev) 102static int avmcs_probe(struct pcmcia_device *p_dev)
103{ 103{
104 local_info_t *local; 104 local_info_t *local;
105 105
@@ -128,12 +128,10 @@ static int avmcs_attach(struct pcmcia_device *p_dev)
128 p_dev->priv = local; 128 p_dev->priv = local;
129 129
130 p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 130 p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
131 avmcs_config(p_dev); 131 return avmcs_config(p_dev);
132
133 return 0;
134 132
135 err: 133 err:
136 return -EINVAL; 134 return -ENOMEM;
137} /* avmcs_attach */ 135} /* avmcs_attach */
138 136
139/*====================================================================== 137/*======================================================================
@@ -185,7 +183,7 @@ static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple,
185 return get_tuple(handle, tuple, parse); 183 return get_tuple(handle, tuple, parse);
186} 184}
187 185
188static void avmcs_config(struct pcmcia_device *link) 186static int avmcs_config(struct pcmcia_device *link)
189{ 187{
190 tuple_t tuple; 188 tuple_t tuple;
191 cisparse_t parse; 189 cisparse_t parse;
@@ -219,7 +217,7 @@ static void avmcs_config(struct pcmcia_device *link)
219 if (i != CS_SUCCESS) { 217 if (i != CS_SUCCESS) {
220 cs_error(link, ParseTuple, i); 218 cs_error(link, ParseTuple, i);
221 link->state &= ~DEV_CONFIG_PENDING; 219 link->state &= ~DEV_CONFIG_PENDING;
222 return; 220 return -ENODEV;
223 } 221 }
224 222
225 /* Configure card */ 223 /* Configure card */
@@ -319,7 +317,7 @@ found_port:
319 /* If any step failed, release any partially configured state */ 317 /* If any step failed, release any partially configured state */
320 if (i != 0) { 318 if (i != 0) {
321 avmcs_release(link); 319 avmcs_release(link);
322 return; 320 return -ENODEV;
323 } 321 }
324 322
325 323
@@ -333,9 +331,10 @@ found_port:
333 printk(KERN_ERR "avm_cs: failed to add AVM-%s-Controller at i/o %#x, irq %d\n", 331 printk(KERN_ERR "avm_cs: failed to add AVM-%s-Controller at i/o %#x, irq %d\n",
334 dev->node.dev_name, link->io.BasePort1, link->irq.AssignedIRQ); 332 dev->node.dev_name, link->io.BasePort1, link->irq.AssignedIRQ);
335 avmcs_release(link); 333 avmcs_release(link);
336 return; 334 return -ENODEV;
337 } 335 }
338 dev->node.minor = i; 336 dev->node.minor = i;
337 return 0;
339 338
340} /* avmcs_config */ 339} /* avmcs_config */
341 340
@@ -367,7 +366,7 @@ static struct pcmcia_driver avmcs_driver = {
367 .drv = { 366 .drv = {
368 .name = "avm_cs", 367 .name = "avm_cs",
369 }, 368 },
370 .probe = avmcs_attach, 369 .probe = avmcs_probe,
371 .remove = avmcs_detach, 370 .remove = avmcs_detach,
372 .id_table = avmcs_ids, 371 .id_table = avmcs_ids,
373}; 372};
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
70static void avma1cs_config(struct pcmcia_device *link); 70static int avma1cs_config(struct pcmcia_device *link);
71static void avma1cs_release(struct pcmcia_device *link); 71static 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
119static int avma1cs_attach(struct pcmcia_device *p_dev) 119static 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
209static void avma1cs_config(struct pcmcia_device *link) 207static 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
97static void elsa_cs_config(struct pcmcia_device *link); 97static int elsa_cs_config(struct pcmcia_device *link);
98static void elsa_cs_release(struct pcmcia_device *link); 98static 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
142static int elsa_cs_attach(struct pcmcia_device *link) 142static 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
238static void elsa_cs_config(struct pcmcia_device *link) 236static 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;
350cs_failed: 348cs_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
98static void sedlbauer_config(struct pcmcia_device *link); 98static int sedlbauer_config(struct pcmcia_device *link);
99static void sedlbauer_release(struct pcmcia_device *link); 99static 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
151static int sedlbauer_attach(struct pcmcia_device *link) 151static 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) \
225do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 223do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
226 224
227static void sedlbauer_config(struct pcmcia_device *link) 225static 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
431cs_failed: 430cs_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
78static void teles_cs_config(struct pcmcia_device *link); 78static int teles_cs_config(struct pcmcia_device *link);
79static void teles_cs_release(struct pcmcia_device *link); 79static 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
133static int teles_attach(struct pcmcia_device *link) 133static 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
228static void teles_cs_config(struct pcmcia_device *link) 226static 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;
340cs_failed: 340cs_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,