aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/sedlbauer_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2009-10-24 09:50:13 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2009-11-09 02:29:59 -0500
commite773cfe167c320d07b9423bc51fc4ab0221775a4 (patch)
treee27b0b26b2c55c629100edaa73c7429ed7d41ee9 /drivers/isdn/hisax/sedlbauer_cs.c
parentcbf624f0e18c4a05219855663a3e5f9fe8f2d876 (diff)
pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (isdn)
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of requiring manual settings of PCMCIA_DEBUG. Also, remove all usages of the CS_CHECK macro and replace them with proper Linux style calling and return value checking. The extra error reporting may be dropped, as the PCMCIA core already complains about any (non-driver-author) errors. CC: Karsten Keil <isdn@linux-pingi.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/isdn/hisax/sedlbauer_cs.c')
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c59
1 files changed, 21 insertions, 38 deletions
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index 9a3c9f5e4fe8..33d7530527c7 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");
57MODULE_AUTHOR("Marcus Niemann"); 57MODULE_AUTHOR("Marcus Niemann");
58MODULE_LICENSE("Dual MPL/GPL"); 58MODULE_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
69static int pc_debug = PCMCIA_DEBUG;
70module_param(pc_debug, int, 0);
71#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args);
72static 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);
@@ -198,7 +180,7 @@ static int sedlbauer_probe(struct pcmcia_device *link)
198 180
199static void sedlbauer_detach(struct pcmcia_device *link) 181static void sedlbauer_detach(struct pcmcia_device *link)
200{ 182{
201 DEBUG(0, "sedlbauer_detach(0x%p)\n", link); 183 dev_dbg(&link->dev, "sedlbauer_detach(0x%p)\n", link);
202 184
203 ((local_info_t *)link->priv)->stop = 1; 185 ((local_info_t *)link->priv)->stop = 1;
204 sedlbauer_release(link); 186 sedlbauer_release(link);
@@ -214,9 +196,6 @@ static void sedlbauer_detach(struct pcmcia_device *link)
214 device available to the system. 196 device available to the system.
215 197
216======================================================================*/ 198======================================================================*/
217#define CS_CHECK(fn, ret) \
218do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
219
220static int sedlbauer_config_check(struct pcmcia_device *p_dev, 199static int sedlbauer_config_check(struct pcmcia_device *p_dev,
221 cistpl_cftable_entry_t *cfg, 200 cistpl_cftable_entry_t *cfg,
222 cistpl_cftable_entry_t *dflt, 201 cistpl_cftable_entry_t *dflt,
@@ -309,10 +288,10 @@ static int sedlbauer_config(struct pcmcia_device *link)
309{ 288{
310 local_info_t *dev = link->priv; 289 local_info_t *dev = link->priv;
311 win_req_t *req; 290 win_req_t *req;
312 int last_fn, last_ret; 291 int ret;
313 IsdnCard_t icard; 292 IsdnCard_t icard;
314 293
315 DEBUG(0, "sedlbauer_config(0x%p)\n", link); 294 dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link);
316 295
317 req = kzalloc(sizeof(win_req_t), GFP_KERNEL); 296 req = kzalloc(sizeof(win_req_t), GFP_KERNEL);
318 if (!req) 297 if (!req)
@@ -330,8 +309,8 @@ static int sedlbauer_config(struct pcmcia_device *link)
330 these things without consulting the CIS, and most client drivers 309 these things without consulting the CIS, and most client drivers
331 will only use the CIS to fill in implementation-defined details. 310 will only use the CIS to fill in implementation-defined details.
332 */ 311 */
333 last_ret = pcmcia_loop_config(link, sedlbauer_config_check, req); 312 ret = pcmcia_loop_config(link, sedlbauer_config_check, req);
334 if (last_ret) 313 if (ret)
335 goto failed; 314 goto failed;
336 315
337 /* 316 /*
@@ -339,15 +318,20 @@ static int sedlbauer_config(struct pcmcia_device *link)
339 handler to the interrupt, unless the 'Handler' member of the 318 handler to the interrupt, unless the 'Handler' member of the
340 irq structure is initialized. 319 irq structure is initialized.
341 */ 320 */
342 if (link->conf.Attributes & CONF_ENABLE_IRQ) 321 if (link->conf.Attributes & CONF_ENABLE_IRQ) {
343 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 322 ret = pcmcia_request_irq(link, &link->irq);
323 if (ret)
324 goto failed;
325 }
344 326
345 /* 327 /*
346 This actually configures the PCMCIA socket -- setting up 328 This actually configures the PCMCIA socket -- setting up
347 the I/O windows and the interrupt mapping, and putting the 329 the I/O windows and the interrupt mapping, and putting the
348 card and host interface into "Memory and IO" mode. 330 card and host interface into "Memory and IO" mode.
349 */ 331 */
350 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 332 ret = pcmcia_request_configuration(link, &link->conf);
333 if (ret)
334 goto failed;
351 335
352 /* 336 /*
353 At this point, the dev_node_t structure(s) need to be 337 At this point, the dev_node_t structure(s) need to be
@@ -380,19 +364,18 @@ static int sedlbauer_config(struct pcmcia_device *link)
380 icard.protocol = protocol; 364 icard.protocol = protocol;
381 icard.typ = ISDN_CTYPE_SEDLBAUER_PCMCIA; 365 icard.typ = ISDN_CTYPE_SEDLBAUER_PCMCIA;
382 366
383 last_ret = hisax_init_pcmcia(link, &(((local_info_t*)link->priv)->stop), &icard); 367 ret = hisax_init_pcmcia(link,
384 if (last_ret < 0) { 368 &(((local_info_t *)link->priv)->stop), &icard);
385 printk(KERN_ERR "sedlbauer_cs: failed to initialize SEDLBAUER PCMCIA %d at i/o %#x\n", 369 if (ret < 0) {
386 last_ret, link->io.BasePort1); 370 printk(KERN_ERR "sedlbauer_cs: failed to initialize SEDLBAUER PCMCIA %d at i/o %#x\n",
371 ret, link->io.BasePort1);
387 sedlbauer_release(link); 372 sedlbauer_release(link);
388 return -ENODEV; 373 return -ENODEV;
389 } else 374 } else
390 ((local_info_t*)link->priv)->cardnr = last_ret; 375 ((local_info_t *)link->priv)->cardnr = ret;
391 376
392 return 0; 377 return 0;
393 378
394cs_failed:
395 cs_error(link, last_fn, last_ret);
396failed: 379failed:
397 sedlbauer_release(link); 380 sedlbauer_release(link);
398 return -ENODEV; 381 return -ENODEV;
@@ -410,7 +393,7 @@ failed:
410static void sedlbauer_release(struct pcmcia_device *link) 393static void sedlbauer_release(struct pcmcia_device *link)
411{ 394{
412 local_info_t *local = link->priv; 395 local_info_t *local = link->priv;
413 DEBUG(0, "sedlbauer_release(0x%p)\n", link); 396 dev_dbg(&link->dev, "sedlbauer_release(0x%p)\n", link);
414 397
415 if (local) { 398 if (local) {
416 if (local->cardnr >= 0) { 399 if (local->cardnr >= 0) {