diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-12-06 12:00:33 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-12-06 12:00:33 -0500 |
commit | 3d14b5beba35250c548d3851a2b84fce742d8311 (patch) | |
tree | 065e3d93c3fcbc5ee4c44fa78662393cddbdf6de /drivers/isdn/hisax/sedlbauer_cs.c | |
parent | 0719dc341389882cc834ed18fc9b7fc6006b2b85 (diff) | |
parent | 1bf8e6219552d5dd27012d567ec8c4bb9c2d86b4 (diff) |
Merge branch 'sa1100' into devel
Diffstat (limited to 'drivers/isdn/hisax/sedlbauer_cs.c')
-rw-r--r-- | drivers/isdn/hisax/sedlbauer_cs.c | 64 |
1 files changed, 23 insertions, 41 deletions
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 9a3c9f5e4fe8..af5d393cc2d0 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c | |||
@@ -57,24 +57,6 @@ MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for Sedlbauer cards"); | |||
57 | MODULE_AUTHOR("Marcus Niemann"); | 57 | MODULE_AUTHOR("Marcus Niemann"); |
58 | MODULE_LICENSE("Dual MPL/GPL"); | 58 | MODULE_LICENSE("Dual MPL/GPL"); |
59 | 59 | ||
60 | /* | ||
61 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
62 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
63 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
64 | be present but disabled -- but it can then be enabled for specific | ||
65 | modules at load time with a 'pc_debug=#' option to insmod. | ||
66 | */ | ||
67 | |||
68 | #ifdef PCMCIA_DEBUG | ||
69 | static int pc_debug = PCMCIA_DEBUG; | ||
70 | module_param(pc_debug, int, 0); | ||
71 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); | ||
72 | static char *version = | ||
73 | "sedlbauer_cs.c 1.1a 2001/01/28 15:04:04 (M.Niemann)"; | ||
74 | #else | ||
75 | #define DEBUG(n, args...) | ||
76 | #endif | ||
77 | |||
78 | 60 | ||
79 | /*====================================================================*/ | 61 | /*====================================================================*/ |
80 | 62 | ||
@@ -151,7 +133,7 @@ static int sedlbauer_probe(struct pcmcia_device *link) | |||
151 | { | 133 | { |
152 | local_info_t *local; | 134 | local_info_t *local; |
153 | 135 | ||
154 | DEBUG(0, "sedlbauer_attach()\n"); | 136 | dev_dbg(&link->dev, "sedlbauer_attach()\n"); |
155 | 137 | ||
156 | /* Allocate space for private device-specific data */ | 138 | /* Allocate space for private device-specific data */ |
157 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); | 139 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
@@ -163,7 +145,6 @@ static int sedlbauer_probe(struct pcmcia_device *link) | |||
163 | 145 | ||
164 | /* Interrupt setup */ | 146 | /* Interrupt setup */ |
165 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; | 147 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; |
166 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
167 | link->irq.Handler = NULL; | 148 | link->irq.Handler = NULL; |
168 | 149 | ||
169 | /* | 150 | /* |
@@ -198,7 +179,7 @@ static int sedlbauer_probe(struct pcmcia_device *link) | |||
198 | 179 | ||
199 | static void sedlbauer_detach(struct pcmcia_device *link) | 180 | static void sedlbauer_detach(struct pcmcia_device *link) |
200 | { | 181 | { |
201 | DEBUG(0, "sedlbauer_detach(0x%p)\n", link); | 182 | dev_dbg(&link->dev, "sedlbauer_detach(0x%p)\n", link); |
202 | 183 | ||
203 | ((local_info_t *)link->priv)->stop = 1; | 184 | ((local_info_t *)link->priv)->stop = 1; |
204 | sedlbauer_release(link); | 185 | sedlbauer_release(link); |
@@ -214,9 +195,6 @@ static void sedlbauer_detach(struct pcmcia_device *link) | |||
214 | device available to the system. | 195 | device available to the system. |
215 | 196 | ||
216 | ======================================================================*/ | 197 | ======================================================================*/ |
217 | #define CS_CHECK(fn, ret) \ | ||
218 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
219 | |||
220 | static int sedlbauer_config_check(struct pcmcia_device *p_dev, | 198 | static int sedlbauer_config_check(struct pcmcia_device *p_dev, |
221 | cistpl_cftable_entry_t *cfg, | 199 | cistpl_cftable_entry_t *cfg, |
222 | cistpl_cftable_entry_t *dflt, | 200 | cistpl_cftable_entry_t *dflt, |
@@ -293,11 +271,11 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, | |||
293 | req->Base = mem->win[0].host_addr; | 271 | req->Base = mem->win[0].host_addr; |
294 | req->Size = mem->win[0].len; | 272 | req->Size = mem->win[0].len; |
295 | req->AccessSpeed = 0; | 273 | req->AccessSpeed = 0; |
296 | if (pcmcia_request_window(&p_dev, req, &p_dev->win) != 0) | 274 | if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0) |
297 | return -ENODEV; | 275 | return -ENODEV; |
298 | map.Page = 0; | 276 | map.Page = 0; |
299 | map.CardOffset = mem->win[0].card_addr; | 277 | map.CardOffset = mem->win[0].card_addr; |
300 | if (pcmcia_map_mem_page(p_dev->win, &map) != 0) | 278 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0) |
301 | return -ENODEV; | 279 | return -ENODEV; |
302 | } | 280 | } |
303 | return 0; | 281 | return 0; |
@@ -309,10 +287,10 @@ static int sedlbauer_config(struct pcmcia_device *link) | |||
309 | { | 287 | { |
310 | local_info_t *dev = link->priv; | 288 | local_info_t *dev = link->priv; |
311 | win_req_t *req; | 289 | win_req_t *req; |
312 | int last_fn, last_ret; | 290 | int ret; |
313 | IsdnCard_t icard; | 291 | IsdnCard_t icard; |
314 | 292 | ||
315 | DEBUG(0, "sedlbauer_config(0x%p)\n", link); | 293 | dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); |
316 | 294 | ||
317 | req = kzalloc(sizeof(win_req_t), GFP_KERNEL); | 295 | req = kzalloc(sizeof(win_req_t), GFP_KERNEL); |
318 | if (!req) | 296 | if (!req) |
@@ -330,8 +308,8 @@ static int sedlbauer_config(struct pcmcia_device *link) | |||
330 | these things without consulting the CIS, and most client drivers | 308 | these things without consulting the CIS, and most client drivers |
331 | will only use the CIS to fill in implementation-defined details. | 309 | will only use the CIS to fill in implementation-defined details. |
332 | */ | 310 | */ |
333 | last_ret = pcmcia_loop_config(link, sedlbauer_config_check, req); | 311 | ret = pcmcia_loop_config(link, sedlbauer_config_check, req); |
334 | if (last_ret) | 312 | if (ret) |
335 | goto failed; | 313 | goto failed; |
336 | 314 | ||
337 | /* | 315 | /* |
@@ -339,15 +317,20 @@ static int sedlbauer_config(struct pcmcia_device *link) | |||
339 | handler to the interrupt, unless the 'Handler' member of the | 317 | handler to the interrupt, unless the 'Handler' member of the |
340 | irq structure is initialized. | 318 | irq structure is initialized. |
341 | */ | 319 | */ |
342 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 320 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
343 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 321 | ret = pcmcia_request_irq(link, &link->irq); |
322 | if (ret) | ||
323 | goto failed; | ||
324 | } | ||
344 | 325 | ||
345 | /* | 326 | /* |
346 | This actually configures the PCMCIA socket -- setting up | 327 | This actually configures the PCMCIA socket -- setting up |
347 | the I/O windows and the interrupt mapping, and putting the | 328 | the I/O windows and the interrupt mapping, and putting the |
348 | card and host interface into "Memory and IO" mode. | 329 | card and host interface into "Memory and IO" mode. |
349 | */ | 330 | */ |
350 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 331 | ret = pcmcia_request_configuration(link, &link->conf); |
332 | if (ret) | ||
333 | goto failed; | ||
351 | 334 | ||
352 | /* | 335 | /* |
353 | At this point, the dev_node_t structure(s) need to be | 336 | At this point, the dev_node_t structure(s) need to be |
@@ -380,19 +363,18 @@ static int sedlbauer_config(struct pcmcia_device *link) | |||
380 | icard.protocol = protocol; | 363 | icard.protocol = protocol; |
381 | icard.typ = ISDN_CTYPE_SEDLBAUER_PCMCIA; | 364 | icard.typ = ISDN_CTYPE_SEDLBAUER_PCMCIA; |
382 | 365 | ||
383 | last_ret = hisax_init_pcmcia(link, &(((local_info_t*)link->priv)->stop), &icard); | 366 | ret = hisax_init_pcmcia(link, |
384 | if (last_ret < 0) { | 367 | &(((local_info_t *)link->priv)->stop), &icard); |
385 | printk(KERN_ERR "sedlbauer_cs: failed to initialize SEDLBAUER PCMCIA %d at i/o %#x\n", | 368 | if (ret < 0) { |
386 | last_ret, link->io.BasePort1); | 369 | printk(KERN_ERR "sedlbauer_cs: failed to initialize SEDLBAUER PCMCIA %d at i/o %#x\n", |
370 | ret, link->io.BasePort1); | ||
387 | sedlbauer_release(link); | 371 | sedlbauer_release(link); |
388 | return -ENODEV; | 372 | return -ENODEV; |
389 | } else | 373 | } else |
390 | ((local_info_t*)link->priv)->cardnr = last_ret; | 374 | ((local_info_t *)link->priv)->cardnr = ret; |
391 | 375 | ||
392 | return 0; | 376 | return 0; |
393 | 377 | ||
394 | cs_failed: | ||
395 | cs_error(link, last_fn, last_ret); | ||
396 | failed: | 378 | failed: |
397 | sedlbauer_release(link); | 379 | sedlbauer_release(link); |
398 | return -ENODEV; | 380 | return -ENODEV; |
@@ -410,7 +392,7 @@ failed: | |||
410 | static void sedlbauer_release(struct pcmcia_device *link) | 392 | static void sedlbauer_release(struct pcmcia_device *link) |
411 | { | 393 | { |
412 | local_info_t *local = link->priv; | 394 | local_info_t *local = link->priv; |
413 | DEBUG(0, "sedlbauer_release(0x%p)\n", link); | 395 | dev_dbg(&link->dev, "sedlbauer_release(0x%p)\n", link); |
414 | 396 | ||
415 | if (local) { | 397 | if (local) { |
416 | if (local->cardnr >= 0) { | 398 | if (local->cardnr >= 0) { |