aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2009-10-23 06:51:28 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2009-11-08 12:23:12 -0500
commitd50dbec3ce52e1608636b8a624d087da9ced8cde (patch)
tree536cced7021883bcc3a7f82e94c42cd4c614ba43 /drivers/pcmcia/cs.c
parent18a7a19b37838789452e0bd2855a51475628b971 (diff)
pcmcia: use dynamic debug instead of custom infrastructure
Use the generic "dynamic debug" infrastructure instead of CONIG_PCMCIA_DEBUG in the PCMCIA core (pcmcia.ko and pcmcia_core.ko). To enable debugging, enable CONFIG_DYNAMIC_DEBUG, mount debugfs and $ echo -n 'module pcmcia_core +p' > /sys/kernel/debug/dynamic_debug/control for the complete module "pcmcia_core", for example. For more detailled instructions, please see Documentation/dynamic-debug-howto.txt Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/cs.c')
-rw-r--r--drivers/pcmcia/cs.c57
1 files changed, 24 insertions, 33 deletions
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 934d4bee39a0..b0ec9c614ce7 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -61,17 +61,6 @@ INT_MODULE_PARM(unreset_limit, 30); /* unreset_check's */
61/* Access speed for attribute memory windows */ 61/* Access speed for attribute memory windows */
62INT_MODULE_PARM(cis_speed, 300); /* ns */ 62INT_MODULE_PARM(cis_speed, 300); /* ns */
63 63
64#ifdef CONFIG_PCMCIA_DEBUG
65static int pc_debug;
66
67module_param(pc_debug, int, 0644);
68
69int cs_debug_level(int level)
70{
71 return pc_debug > level;
72}
73#endif
74
75 64
76socket_state_t dead_socket = { 65socket_state_t dead_socket = {
77 .csc_mask = SS_DETECT, 66 .csc_mask = SS_DETECT,
@@ -182,7 +171,7 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
182 if (!socket || !socket->ops || !socket->dev.parent || !socket->resource_ops) 171 if (!socket || !socket->ops || !socket->dev.parent || !socket->resource_ops)
183 return -EINVAL; 172 return -EINVAL;
184 173
185 cs_dbg(socket, 0, "pcmcia_register_socket(0x%p)\n", socket->ops); 174 dev_dbg(&socket->dev, "pcmcia_register_socket(0x%p)\n", socket->ops);
186 175
187 spin_lock_init(&socket->lock); 176 spin_lock_init(&socket->lock);
188 177
@@ -274,7 +263,7 @@ void pcmcia_unregister_socket(struct pcmcia_socket *socket)
274 if (!socket) 263 if (!socket)
275 return; 264 return;
276 265
277 cs_dbg(socket, 0, "pcmcia_unregister_socket(0x%p)\n", socket->ops); 266 dev_dbg(&socket->dev, "pcmcia_unregister_socket(0x%p)\n", socket->ops);
278 267
279 if (socket->thread) 268 if (socket->thread)
280 kthread_stop(socket->thread); 269 kthread_stop(socket->thread);
@@ -327,7 +316,7 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority)
327 if (s->state & SOCKET_CARDBUS) 316 if (s->state & SOCKET_CARDBUS)
328 return 0; 317 return 0;
329 318
330 cs_dbg(s, 1, "send_event(event %d, pri %d, callback 0x%p)\n", 319 dev_dbg(&s->dev, "send_event(event %d, pri %d, callback 0x%p)\n",
331 event, priority, s->callback); 320 event, priority, s->callback);
332 321
333 if (!s->callback) 322 if (!s->callback)
@@ -344,7 +333,7 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority)
344 333
345static void socket_remove_drivers(struct pcmcia_socket *skt) 334static void socket_remove_drivers(struct pcmcia_socket *skt)
346{ 335{
347 cs_dbg(skt, 4, "remove_drivers\n"); 336 dev_dbg(&skt->dev, "remove_drivers\n");
348 337
349 send_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH); 338 send_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH);
350} 339}
@@ -353,7 +342,7 @@ static int socket_reset(struct pcmcia_socket *skt)
353{ 342{
354 int status, i; 343 int status, i;
355 344
356 cs_dbg(skt, 4, "reset\n"); 345 dev_dbg(&skt->dev, "reset\n");
357 346
358 skt->socket.flags |= SS_OUTPUT_ENA | SS_RESET; 347 skt->socket.flags |= SS_OUTPUT_ENA | SS_RESET;
359 skt->ops->set_socket(skt, &skt->socket); 348 skt->ops->set_socket(skt, &skt->socket);
@@ -375,7 +364,7 @@ static int socket_reset(struct pcmcia_socket *skt)
375 msleep(unreset_check * 10); 364 msleep(unreset_check * 10);
376 } 365 }
377 366
378 cs_err(skt, "time out after reset.\n"); 367 dev_printk(KERN_ERR, &skt->dev, "time out after reset.\n");
379 return -ETIMEDOUT; 368 return -ETIMEDOUT;
380} 369}
381 370
@@ -389,7 +378,7 @@ static void socket_shutdown(struct pcmcia_socket *s)
389{ 378{
390 int status; 379 int status;
391 380
392 cs_dbg(s, 4, "shutdown\n"); 381 dev_dbg(&s->dev, "shutdown\n");
393 382
394 socket_remove_drivers(s); 383 socket_remove_drivers(s);
395 s->state &= SOCKET_INUSE | SOCKET_PRESENT; 384 s->state &= SOCKET_INUSE | SOCKET_PRESENT;
@@ -424,7 +413,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
424{ 413{
425 int status, i; 414 int status, i;
426 415
427 cs_dbg(skt, 4, "setup\n"); 416 dev_dbg(&skt->dev, "setup\n");
428 417
429 skt->ops->get_status(skt, &status); 418 skt->ops->get_status(skt, &status);
430 if (!(status & SS_DETECT)) 419 if (!(status & SS_DETECT))
@@ -444,13 +433,15 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
444 } 433 }
445 434
446 if (status & SS_PENDING) { 435 if (status & SS_PENDING) {
447 cs_err(skt, "voltage interrogation timed out.\n"); 436 dev_printk(KERN_ERR, &skt->dev,
437 "voltage interrogation timed out.\n");
448 return -ETIMEDOUT; 438 return -ETIMEDOUT;
449 } 439 }
450 440
451 if (status & SS_CARDBUS) { 441 if (status & SS_CARDBUS) {
452 if (!(skt->features & SS_CAP_CARDBUS)) { 442 if (!(skt->features & SS_CAP_CARDBUS)) {
453 cs_err(skt, "cardbus cards are not supported.\n"); 443 dev_printk(KERN_ERR, &skt->dev,
444 "cardbus cards are not supported.\n");
454 return -EINVAL; 445 return -EINVAL;
455 } 446 }
456 skt->state |= SOCKET_CARDBUS; 447 skt->state |= SOCKET_CARDBUS;
@@ -464,7 +455,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
464 else if (!(status & SS_XVCARD)) 455 else if (!(status & SS_XVCARD))
465 skt->socket.Vcc = skt->socket.Vpp = 50; 456 skt->socket.Vcc = skt->socket.Vpp = 50;
466 else { 457 else {
467 cs_err(skt, "unsupported voltage key.\n"); 458 dev_printk(KERN_ERR, &skt->dev, "unsupported voltage key.\n");
468 return -EIO; 459 return -EIO;
469 } 460 }
470 461
@@ -481,7 +472,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
481 472
482 skt->ops->get_status(skt, &status); 473 skt->ops->get_status(skt, &status);
483 if (!(status & SS_POWERON)) { 474 if (!(status & SS_POWERON)) {
484 cs_err(skt, "unable to apply power.\n"); 475 dev_printk(KERN_ERR, &skt->dev, "unable to apply power.\n");
485 return -EIO; 476 return -EIO;
486 } 477 }
487 478
@@ -501,7 +492,7 @@ static int socket_insert(struct pcmcia_socket *skt)
501{ 492{
502 int ret; 493 int ret;
503 494
504 cs_dbg(skt, 4, "insert\n"); 495 dev_dbg(&skt->dev, "insert\n");
505 496
506 if (!cs_socket_get(skt)) 497 if (!cs_socket_get(skt))
507 return -ENODEV; 498 return -ENODEV;
@@ -521,7 +512,7 @@ static int socket_insert(struct pcmcia_socket *skt)
521 skt->state |= SOCKET_CARDBUS_CONFIG; 512 skt->state |= SOCKET_CARDBUS_CONFIG;
522 } 513 }
523#endif 514#endif
524 cs_dbg(skt, 4, "insert done\n"); 515 dev_dbg(&skt->dev, "insert done\n");
525 516
526 send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); 517 send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
527 } else { 518 } else {
@@ -573,7 +564,7 @@ static int socket_resume(struct pcmcia_socket *skt)
573 * FIXME: need a better check here for cardbus cards. 564 * FIXME: need a better check here for cardbus cards.
574 */ 565 */
575 if (verify_cis_cache(skt) != 0) { 566 if (verify_cis_cache(skt) != 0) {
576 cs_dbg(skt, 4, "cis mismatch - different card\n"); 567 dev_dbg(&skt->dev, "cis mismatch - different card\n");
577 socket_remove_drivers(skt); 568 socket_remove_drivers(skt);
578 destroy_cis_cache(skt); 569 destroy_cis_cache(skt);
579 /* 570 /*
@@ -584,7 +575,7 @@ static int socket_resume(struct pcmcia_socket *skt)
584 msleep(200); 575 msleep(200);
585 send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); 576 send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
586 } else { 577 } else {
587 cs_dbg(skt, 4, "cis matches cache\n"); 578 dev_dbg(&skt->dev, "cis matches cache\n");
588 send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW); 579 send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW);
589 } 580 }
590 } else { 581 } else {
@@ -706,7 +697,7 @@ static int pccardd(void *__skt)
706void pcmcia_parse_events(struct pcmcia_socket *s, u_int events) 697void pcmcia_parse_events(struct pcmcia_socket *s, u_int events)
707{ 698{
708 unsigned long flags; 699 unsigned long flags;
709 cs_dbg(s, 4, "parse_events: events %08x\n", events); 700 dev_dbg(&s->dev, "parse_events: events %08x\n", events);
710 if (s->thread) { 701 if (s->thread) {
711 spin_lock_irqsave(&s->thread_lock, flags); 702 spin_lock_irqsave(&s->thread_lock, flags);
712 s->thread_events |= events; 703 s->thread_events |= events;
@@ -756,7 +747,7 @@ int pcmcia_reset_card(struct pcmcia_socket *skt)
756{ 747{
757 int ret; 748 int ret;
758 749
759 cs_dbg(skt, 1, "resetting socket\n"); 750 dev_dbg(&skt->dev, "resetting socket\n");
760 751
761 mutex_lock(&skt->skt_mutex); 752 mutex_lock(&skt->skt_mutex);
762 do { 753 do {
@@ -801,7 +792,7 @@ int pcmcia_suspend_card(struct pcmcia_socket *skt)
801{ 792{
802 int ret; 793 int ret;
803 794
804 cs_dbg(skt, 1, "suspending socket\n"); 795 dev_dbg(&skt->dev, "suspending socket\n");
805 796
806 mutex_lock(&skt->skt_mutex); 797 mutex_lock(&skt->skt_mutex);
807 do { 798 do {
@@ -831,7 +822,7 @@ int pcmcia_resume_card(struct pcmcia_socket *skt)
831{ 822{
832 int ret; 823 int ret;
833 824
834 cs_dbg(skt, 1, "waking up socket\n"); 825 dev_dbg(&skt->dev, "waking up socket\n");
835 826
836 mutex_lock(&skt->skt_mutex); 827 mutex_lock(&skt->skt_mutex);
837 do { 828 do {
@@ -859,7 +850,7 @@ int pcmcia_eject_card(struct pcmcia_socket *skt)
859{ 850{
860 int ret; 851 int ret;
861 852
862 cs_dbg(skt, 1, "user eject request\n"); 853 dev_dbg(&skt->dev, "user eject request\n");
863 854
864 mutex_lock(&skt->skt_mutex); 855 mutex_lock(&skt->skt_mutex);
865 do { 856 do {
@@ -888,7 +879,7 @@ int pcmcia_insert_card(struct pcmcia_socket *skt)
888{ 879{
889 int ret; 880 int ret;
890 881
891 cs_dbg(skt, 1, "user insert request\n"); 882 dev_dbg(&skt->dev, "user insert request\n");
892 883
893 mutex_lock(&skt->skt_mutex); 884 mutex_lock(&skt->skt_mutex);
894 do { 885 do {