aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
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
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')
-rw-r--r--drivers/pcmcia/cardbus.c4
-rw-r--r--drivers/pcmcia/cistpl.c10
-rw-r--r--drivers/pcmcia/cs.c57
-rw-r--r--drivers/pcmcia/cs_internal.h22
-rw-r--r--drivers/pcmcia/ds.c87
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c31
-rw-r--r--drivers/pcmcia/pcmcia_resource.c63
7 files changed, 100 insertions, 174 deletions
diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c
index db77e1f3309a..4cd70d056810 100644
--- a/drivers/pcmcia/cardbus.c
+++ b/drivers/pcmcia/cardbus.c
@@ -91,7 +91,7 @@ static u_int xlate_rom_addr(void __iomem *b, u_int addr)
91static void cb_release_cis_mem(struct pcmcia_socket * s) 91static void cb_release_cis_mem(struct pcmcia_socket * s)
92{ 92{
93 if (s->cb_cis_virt) { 93 if (s->cb_cis_virt) {
94 cs_dbg(s, 1, "cb_release_cis_mem()\n"); 94 dev_dbg(&s->dev, "cb_release_cis_mem()\n");
95 iounmap(s->cb_cis_virt); 95 iounmap(s->cb_cis_virt);
96 s->cb_cis_virt = NULL; 96 s->cb_cis_virt = NULL;
97 s->cb_cis_res = NULL; 97 s->cb_cis_res = NULL;
@@ -132,7 +132,7 @@ int read_cb_mem(struct pcmcia_socket * s, int space, u_int addr, u_int len, void
132 struct pci_dev *dev; 132 struct pci_dev *dev;
133 struct resource *res; 133 struct resource *res;
134 134
135 cs_dbg(s, 3, "read_cb_mem(%d, %#x, %u)\n", space, addr, len); 135 dev_dbg(&s->dev, "read_cb_mem(%d, %#x, %u)\n", space, addr, len);
136 136
137 dev = pci_get_slot(s->cb_dev->subordinate, 0); 137 dev = pci_get_slot(s->cb_dev->subordinate, 0);
138 if (!dev) 138 if (!dev)
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 24dd3c1eac0b..8c1b73cf021b 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -138,7 +138,7 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
138 void __iomem *sys, *end; 138 void __iomem *sys, *end;
139 unsigned char *buf = ptr; 139 unsigned char *buf = ptr;
140 140
141 cs_dbg(s, 3, "pcmcia_read_cis_mem(%d, %#x, %u)\n", attr, addr, len); 141 dev_dbg(&s->dev, "pcmcia_read_cis_mem(%d, %#x, %u)\n", attr, addr, len);
142 142
143 if (attr & IS_INDIRECT) { 143 if (attr & IS_INDIRECT) {
144 /* Indirect accesses use a bunch of special registers at fixed 144 /* Indirect accesses use a bunch of special registers at fixed
@@ -190,7 +190,7 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
190 addr = 0; 190 addr = 0;
191 } 191 }
192 } 192 }
193 cs_dbg(s, 3, " %#2.2x %#2.2x %#2.2x %#2.2x ...\n", 193 dev_dbg(&s->dev, " %#2.2x %#2.2x %#2.2x %#2.2x ...\n",
194 *(u_char *)(ptr+0), *(u_char *)(ptr+1), 194 *(u_char *)(ptr+0), *(u_char *)(ptr+1),
195 *(u_char *)(ptr+2), *(u_char *)(ptr+3)); 195 *(u_char *)(ptr+2), *(u_char *)(ptr+3));
196 return 0; 196 return 0;
@@ -204,7 +204,7 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
204 void __iomem *sys, *end; 204 void __iomem *sys, *end;
205 unsigned char *buf = ptr; 205 unsigned char *buf = ptr;
206 206
207 cs_dbg(s, 3, "pcmcia_write_cis_mem(%d, %#x, %u)\n", attr, addr, len); 207 dev_dbg(&s->dev, "pcmcia_write_cis_mem(%d, %#x, %u)\n", attr, addr, len);
208 208
209 if (attr & IS_INDIRECT) { 209 if (attr & IS_INDIRECT) {
210 /* Indirect accesses use a bunch of special registers at fixed 210 /* Indirect accesses use a bunch of special registers at fixed
@@ -584,7 +584,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_
584 ofs += link[1] + 2; 584 ofs += link[1] + 2;
585 } 585 }
586 if (i == MAX_TUPLES) { 586 if (i == MAX_TUPLES) {
587 cs_dbg(s, 1, "cs: overrun in pcmcia_get_next_tuple\n"); 587 dev_dbg(&s->dev, "cs: overrun in pcmcia_get_next_tuple\n");
588 return -ENOSPC; 588 return -ENOSPC;
589 } 589 }
590 590
@@ -1440,7 +1440,7 @@ int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse)
1440 break; 1440 break;
1441 } 1441 }
1442 if (ret) 1442 if (ret)
1443 __cs_dbg(0, "parse_tuple failed %d\n", ret); 1443 pr_debug("parse_tuple failed %d\n", ret);
1444 return ret; 1444 return ret;
1445} 1445}
1446EXPORT_SYMBOL(pcmcia_parse_tuple); 1446EXPORT_SYMBOL(pcmcia_parse_tuple);
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 {
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h
index 70432cae76eb..0a3ada970bf8 100644
--- a/drivers/pcmcia/cs_internal.h
+++ b/drivers/pcmcia/cs_internal.h
@@ -107,28 +107,6 @@ static inline void cs_socket_put(struct pcmcia_socket *skt)
107 } 107 }
108} 108}
109 109
110#ifdef CONFIG_PCMCIA_DEBUG
111extern int cs_debug_level(int);
112
113#define cs_dbg(skt, lvl, fmt, arg...) do { \
114 if (cs_debug_level(lvl)) \
115 dev_printk(KERN_DEBUG, &skt->dev, \
116 "cs: " fmt, ## arg); \
117} while (0)
118#define __cs_dbg(lvl, fmt, arg...) do { \
119 if (cs_debug_level(lvl)) \
120 printk(KERN_DEBUG \
121 "cs: " fmt, ## arg); \
122} while (0)
123
124#else
125#define cs_dbg(skt, lvl, fmt, arg...) do { } while (0)
126#define __cs_dbg(lvl, fmt, arg...) do { } while (0)
127#endif
128
129#define cs_err(skt, fmt, arg...) \
130 dev_printk(KERN_ERR, &skt->dev, "cs: " fmt, ## arg)
131
132 110
133/* 111/*
134 * Stuff internal to module "pcmcia_core": 112 * Stuff internal to module "pcmcia_core":
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index f5b7079f13d3..5b069aeaf17a 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -41,23 +41,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
41MODULE_DESCRIPTION("PCMCIA Driver Services"); 41MODULE_DESCRIPTION("PCMCIA Driver Services");
42MODULE_LICENSE("GPL"); 42MODULE_LICENSE("GPL");
43 43
44#ifdef CONFIG_PCMCIA_DEBUG
45int ds_pc_debug;
46
47module_param_named(pc_debug, ds_pc_debug, int, 0644);
48
49#define ds_dbg(lvl, fmt, arg...) do { \
50 if (ds_pc_debug > (lvl)) \
51 printk(KERN_DEBUG "ds: " fmt , ## arg); \
52} while (0)
53#define ds_dev_dbg(lvl, dev, fmt, arg...) do { \
54 if (ds_pc_debug > (lvl)) \
55 dev_printk(KERN_DEBUG, dev, "ds: " fmt , ## arg); \
56} while (0)
57#else
58#define ds_dbg(lvl, fmt, arg...) do { } while (0)
59#define ds_dev_dbg(lvl, dev, fmt, arg...) do { } while (0)
60#endif
61 44
62spinlock_t pcmcia_dev_list_lock; 45spinlock_t pcmcia_dev_list_lock;
63 46
@@ -303,7 +286,7 @@ int pcmcia_register_driver(struct pcmcia_driver *driver)
303 spin_lock_init(&driver->dynids.lock); 286 spin_lock_init(&driver->dynids.lock);
304 INIT_LIST_HEAD(&driver->dynids.list); 287 INIT_LIST_HEAD(&driver->dynids.list);
305 288
306 ds_dbg(3, "registering driver %s\n", driver->drv.name); 289 pr_debug("registering driver %s\n", driver->drv.name);
307 290
308 error = driver_register(&driver->drv); 291 error = driver_register(&driver->drv);
309 if (error < 0) 292 if (error < 0)
@@ -323,7 +306,7 @@ EXPORT_SYMBOL(pcmcia_register_driver);
323 */ 306 */
324void pcmcia_unregister_driver(struct pcmcia_driver *driver) 307void pcmcia_unregister_driver(struct pcmcia_driver *driver)
325{ 308{
326 ds_dbg(3, "unregistering driver %s\n", driver->drv.name); 309 pr_debug("unregistering driver %s\n", driver->drv.name);
327 driver_unregister(&driver->drv); 310 driver_unregister(&driver->drv);
328 pcmcia_free_dynids(driver); 311 pcmcia_free_dynids(driver);
329} 312}
@@ -350,14 +333,14 @@ void pcmcia_put_dev(struct pcmcia_device *p_dev)
350static void pcmcia_release_function(struct kref *ref) 333static void pcmcia_release_function(struct kref *ref)
351{ 334{
352 struct config_t *c = container_of(ref, struct config_t, ref); 335 struct config_t *c = container_of(ref, struct config_t, ref);
353 ds_dbg(1, "releasing config_t\n"); 336 pr_debug("releasing config_t\n");
354 kfree(c); 337 kfree(c);
355} 338}
356 339
357static void pcmcia_release_dev(struct device *dev) 340static void pcmcia_release_dev(struct device *dev)
358{ 341{
359 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 342 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
360 ds_dev_dbg(1, dev, "releasing device\n"); 343 dev_dbg(dev, "releasing device\n");
361 pcmcia_put_socket(p_dev->socket); 344 pcmcia_put_socket(p_dev->socket);
362 kfree(p_dev->devname); 345 kfree(p_dev->devname);
363 kref_put(&p_dev->function_config->ref, pcmcia_release_function); 346 kref_put(&p_dev->function_config->ref, pcmcia_release_function);
@@ -367,7 +350,7 @@ static void pcmcia_release_dev(struct device *dev)
367static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc) 350static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc)
368{ 351{
369 if (!s->pcmcia_state.device_add_pending) { 352 if (!s->pcmcia_state.device_add_pending) {
370 ds_dev_dbg(1, &s->dev, "scheduling to add %s secondary" 353 dev_dbg(&s->dev, "scheduling to add %s secondary"
371 " device to %d\n", mfc ? "mfc" : "pfc", s->sock); 354 " device to %d\n", mfc ? "mfc" : "pfc", s->sock);
372 s->pcmcia_state.device_add_pending = 1; 355 s->pcmcia_state.device_add_pending = 1;
373 s->pcmcia_state.mfc_pfc = mfc; 356 s->pcmcia_state.mfc_pfc = mfc;
@@ -405,7 +388,7 @@ static int pcmcia_device_probe(struct device * dev)
405 */ 388 */
406 did = dev_get_drvdata(&p_dev->dev); 389 did = dev_get_drvdata(&p_dev->dev);
407 390
408 ds_dev_dbg(1, dev, "trying to bind to %s\n", p_drv->drv.name); 391 dev_dbg(dev, "trying to bind to %s\n", p_drv->drv.name);
409 392
410 if ((!p_drv->probe) || (!p_dev->function_config) || 393 if ((!p_drv->probe) || (!p_dev->function_config) ||
411 (!try_module_get(p_drv->owner))) { 394 (!try_module_get(p_drv->owner))) {
@@ -428,7 +411,7 @@ static int pcmcia_device_probe(struct device * dev)
428 411
429 ret = p_drv->probe(p_dev); 412 ret = p_drv->probe(p_dev);
430 if (ret) { 413 if (ret) {
431 ds_dev_dbg(1, dev, "binding to %s failed with %d\n", 414 dev_dbg(dev, "binding to %s failed with %d\n",
432 p_drv->drv.name, ret); 415 p_drv->drv.name, ret);
433 goto put_module; 416 goto put_module;
434 } 417 }
@@ -456,7 +439,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le
456 struct pcmcia_device *tmp; 439 struct pcmcia_device *tmp;
457 unsigned long flags; 440 unsigned long flags;
458 441
459 ds_dev_dbg(2, leftover ? &leftover->dev : &s->dev, 442 dev_dbg(leftover ? &leftover->dev : &s->dev,
460 "pcmcia_card_remove(%d) %s\n", s->sock, 443 "pcmcia_card_remove(%d) %s\n", s->sock,
461 leftover ? leftover->devname : ""); 444 leftover ? leftover->devname : "");
462 445
@@ -475,7 +458,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le
475 p_dev->_removed=1; 458 p_dev->_removed=1;
476 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 459 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
477 460
478 ds_dev_dbg(2, &p_dev->dev, "unregistering device\n"); 461 dev_dbg(&p_dev->dev, "unregistering device\n");
479 device_unregister(&p_dev->dev); 462 device_unregister(&p_dev->dev);
480 } 463 }
481 464
@@ -492,7 +475,7 @@ static int pcmcia_device_remove(struct device * dev)
492 p_dev = to_pcmcia_dev(dev); 475 p_dev = to_pcmcia_dev(dev);
493 p_drv = to_pcmcia_drv(dev->driver); 476 p_drv = to_pcmcia_drv(dev->driver);
494 477
495 ds_dev_dbg(1, dev, "removing device\n"); 478 dev_dbg(dev, "removing device\n");
496 479
497 /* If we're removing the primary module driving a 480 /* If we're removing the primary module driving a
498 * pseudo multi-function card, we need to unbind 481 * pseudo multi-function card, we need to unbind
@@ -572,7 +555,7 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev)
572 } 555 }
573 if (!pccard_read_tuple(p_dev->socket, p_dev->func, 556 if (!pccard_read_tuple(p_dev->socket, p_dev->func,
574 CISTPL_DEVICE_GEO, devgeo)) { 557 CISTPL_DEVICE_GEO, devgeo)) {
575 ds_dev_dbg(0, &p_dev->dev, 558 dev_dbg(&p_dev->dev,
576 "mem device geometry probably means " 559 "mem device geometry probably means "
577 "FUNCID_MEMORY\n"); 560 "FUNCID_MEMORY\n");
578 p_dev->func_id = CISTPL_FUNCID_MEMORY; 561 p_dev->func_id = CISTPL_FUNCID_MEMORY;
@@ -628,7 +611,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
628 611
629 mutex_lock(&device_add_lock); 612 mutex_lock(&device_add_lock);
630 613
631 ds_dbg(3, "adding device to %d, function %d\n", s->sock, function); 614 pr_debug("adding device to %d, function %d\n", s->sock, function);
632 615
633 /* max of 4 devices per card */ 616 /* max of 4 devices per card */
634 if (s->device_count == 4) 617 if (s->device_count == 4)
@@ -654,7 +637,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
654 p_dev->devname = kasprintf(GFP_KERNEL, "pcmcia%s", dev_name(&p_dev->dev)); 637 p_dev->devname = kasprintf(GFP_KERNEL, "pcmcia%s", dev_name(&p_dev->dev));
655 if (!p_dev->devname) 638 if (!p_dev->devname)
656 goto err_free; 639 goto err_free;
657 ds_dev_dbg(3, &p_dev->dev, "devname is %s\n", p_dev->devname); 640 dev_dbg(&p_dev->dev, "devname is %s\n", p_dev->devname);
658 641
659 spin_lock_irqsave(&pcmcia_dev_list_lock, flags); 642 spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
660 643
@@ -677,7 +660,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
677 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 660 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
678 661
679 if (!p_dev->function_config) { 662 if (!p_dev->function_config) {
680 ds_dev_dbg(3, &p_dev->dev, "creating config_t\n"); 663 dev_dbg(&p_dev->dev, "creating config_t\n");
681 p_dev->function_config = kzalloc(sizeof(struct config_t), 664 p_dev->function_config = kzalloc(sizeof(struct config_t),
682 GFP_KERNEL); 665 GFP_KERNEL);
683 if (!p_dev->function_config) 666 if (!p_dev->function_config)
@@ -722,20 +705,20 @@ static int pcmcia_card_add(struct pcmcia_socket *s)
722 int ret = 0; 705 int ret = 0;
723 706
724 if (!(s->resource_setup_done)) { 707 if (!(s->resource_setup_done)) {
725 ds_dev_dbg(3, &s->dev, 708 dev_dbg(&s->dev,
726 "no resources available, delaying card_add\n"); 709 "no resources available, delaying card_add\n");
727 return -EAGAIN; /* try again, but later... */ 710 return -EAGAIN; /* try again, but later... */
728 } 711 }
729 712
730 if (pcmcia_validate_mem(s)) { 713 if (pcmcia_validate_mem(s)) {
731 ds_dev_dbg(3, &s->dev, "validating mem resources failed, " 714 dev_dbg(&s->dev, "validating mem resources failed, "
732 "delaying card_add\n"); 715 "delaying card_add\n");
733 return -EAGAIN; /* try again, but later... */ 716 return -EAGAIN; /* try again, but later... */
734 } 717 }
735 718
736 ret = pccard_validate_cis(s, &no_chains); 719 ret = pccard_validate_cis(s, &no_chains);
737 if (ret || !no_chains) { 720 if (ret || !no_chains) {
738 ds_dev_dbg(0, &s->dev, "invalid CIS or invalid resources\n"); 721 dev_dbg(&s->dev, "invalid CIS or invalid resources\n");
739 return -ENODEV; 722 return -ENODEV;
740 } 723 }
741 724
@@ -756,7 +739,7 @@ static void pcmcia_delayed_add_device(struct work_struct *work)
756{ 739{
757 struct pcmcia_socket *s = 740 struct pcmcia_socket *s =
758 container_of(work, struct pcmcia_socket, device_add); 741 container_of(work, struct pcmcia_socket, device_add);
759 ds_dev_dbg(1, &s->dev, "adding additional device to %d\n", s->sock); 742 dev_dbg(&s->dev, "adding additional device to %d\n", s->sock);
760 pcmcia_device_add(s, s->pcmcia_state.mfc_pfc); 743 pcmcia_device_add(s, s->pcmcia_state.mfc_pfc);
761 s->pcmcia_state.device_add_pending = 0; 744 s->pcmcia_state.device_add_pending = 0;
762 s->pcmcia_state.mfc_pfc = 0; 745 s->pcmcia_state.mfc_pfc = 0;
@@ -766,7 +749,7 @@ static int pcmcia_requery(struct device *dev, void * _data)
766{ 749{
767 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 750 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
768 if (!p_dev->dev.driver) { 751 if (!p_dev->dev.driver) {
769 ds_dev_dbg(1, dev, "update device information\n"); 752 dev_dbg(dev, "update device information\n");
770 pcmcia_device_query(p_dev); 753 pcmcia_device_query(p_dev);
771 } 754 }
772 755
@@ -780,7 +763,7 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt, int new_cis)
780 unsigned long flags; 763 unsigned long flags;
781 764
782 /* must be called with skt_mutex held */ 765 /* must be called with skt_mutex held */
783 ds_dev_dbg(0, &skt->dev, "re-scanning socket %d\n", skt->sock); 766 dev_dbg(&skt->dev, "re-scanning socket %d\n", skt->sock);
784 767
785 spin_lock_irqsave(&pcmcia_dev_list_lock, flags); 768 spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
786 if (list_empty(&skt->devices_list)) 769 if (list_empty(&skt->devices_list))
@@ -835,7 +818,7 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)
835 if (!filename) 818 if (!filename)
836 return -EINVAL; 819 return -EINVAL;
837 820
838 ds_dev_dbg(1, &dev->dev, "trying to load CIS file %s\n", filename); 821 dev_dbg(&dev->dev, "trying to load CIS file %s\n", filename);
839 822
840 if (request_firmware(&fw, filename, &dev->dev) == 0) { 823 if (request_firmware(&fw, filename, &dev->dev) == 0) {
841 if (fw->size >= CISTPL_MAX_CIS_SIZE) { 824 if (fw->size >= CISTPL_MAX_CIS_SIZE) {
@@ -953,14 +936,14 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
953 * after it has re-checked that there is no possible module 936 * after it has re-checked that there is no possible module
954 * with a prod_id/manf_id/card_id match. 937 * with a prod_id/manf_id/card_id match.
955 */ 938 */
956 ds_dev_dbg(0, &dev->dev, 939 dev_dbg(&dev->dev,
957 "skipping FUNC_ID match until userspace interaction\n"); 940 "skipping FUNC_ID match until userspace interaction\n");
958 if (!dev->allow_func_id_match) 941 if (!dev->allow_func_id_match)
959 return 0; 942 return 0;
960 } 943 }
961 944
962 if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { 945 if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) {
963 ds_dev_dbg(0, &dev->dev, "device needs a fake CIS\n"); 946 dev_dbg(&dev->dev, "device needs a fake CIS\n");
964 if (!dev->socket->fake_cis) 947 if (!dev->socket->fake_cis)
965 pcmcia_load_firmware(dev, did->cisfile); 948 pcmcia_load_firmware(dev, did->cisfile);
966 949
@@ -992,9 +975,9 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) {
992 /* match dynamic devices first */ 975 /* match dynamic devices first */
993 spin_lock(&p_drv->dynids.lock); 976 spin_lock(&p_drv->dynids.lock);
994 list_for_each_entry(dynid, &p_drv->dynids.list, node) { 977 list_for_each_entry(dynid, &p_drv->dynids.list, node) {
995 ds_dev_dbg(3, dev, "trying to match to %s\n", drv->name); 978 dev_dbg(dev, "trying to match to %s\n", drv->name);
996 if (pcmcia_devmatch(p_dev, &dynid->id)) { 979 if (pcmcia_devmatch(p_dev, &dynid->id)) {
997 ds_dev_dbg(0, dev, "matched to %s\n", drv->name); 980 dev_dbg(dev, "matched to %s\n", drv->name);
998 spin_unlock(&p_drv->dynids.lock); 981 spin_unlock(&p_drv->dynids.lock);
999 return 1; 982 return 1;
1000 } 983 }
@@ -1004,15 +987,15 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) {
1004#ifdef CONFIG_PCMCIA_IOCTL 987#ifdef CONFIG_PCMCIA_IOCTL
1005 /* matching by cardmgr */ 988 /* matching by cardmgr */
1006 if (p_dev->cardmgr == p_drv) { 989 if (p_dev->cardmgr == p_drv) {
1007 ds_dev_dbg(0, dev, "cardmgr matched to %s\n", drv->name); 990 dev_dbg(dev, "cardmgr matched to %s\n", drv->name);
1008 return 1; 991 return 1;
1009 } 992 }
1010#endif 993#endif
1011 994
1012 while (did && did->match_flags) { 995 while (did && did->match_flags) {
1013 ds_dev_dbg(3, dev, "trying to match to %s\n", drv->name); 996 dev_dbg(dev, "trying to match to %s\n", drv->name);
1014 if (pcmcia_devmatch(p_dev, did)) { 997 if (pcmcia_devmatch(p_dev, did)) {
1015 ds_dev_dbg(0, dev, "matched to %s\n", drv->name); 998 dev_dbg(dev, "matched to %s\n", drv->name);
1016 return 1; 999 return 1;
1017 } 1000 }
1018 did++; 1001 did++;
@@ -1218,7 +1201,7 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state)
1218 if (p_dev->suspended) 1201 if (p_dev->suspended)
1219 return 0; 1202 return 0;
1220 1203
1221 ds_dev_dbg(2, dev, "suspending\n"); 1204 dev_dbg(dev, "suspending\n");
1222 1205
1223 if (dev->driver) 1206 if (dev->driver)
1224 p_drv = to_pcmcia_drv(dev->driver); 1207 p_drv = to_pcmcia_drv(dev->driver);
@@ -1238,7 +1221,7 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state)
1238 } 1221 }
1239 1222
1240 if (p_dev->device_no == p_dev->func) { 1223 if (p_dev->device_no == p_dev->func) {
1241 ds_dev_dbg(2, dev, "releasing configuration\n"); 1224 dev_dbg(dev, "releasing configuration\n");
1242 pcmcia_release_configuration(p_dev); 1225 pcmcia_release_configuration(p_dev);
1243 } 1226 }
1244 1227
@@ -1258,7 +1241,7 @@ static int pcmcia_dev_resume(struct device * dev)
1258 if (!p_dev->suspended) 1241 if (!p_dev->suspended)
1259 return 0; 1242 return 0;
1260 1243
1261 ds_dev_dbg(2, dev, "resuming\n"); 1244 dev_dbg(dev, "resuming\n");
1262 1245
1263 if (dev->driver) 1246 if (dev->driver)
1264 p_drv = to_pcmcia_drv(dev->driver); 1247 p_drv = to_pcmcia_drv(dev->driver);
@@ -1267,7 +1250,7 @@ static int pcmcia_dev_resume(struct device * dev)
1267 goto out; 1250 goto out;
1268 1251
1269 if (p_dev->device_no == p_dev->func) { 1252 if (p_dev->device_no == p_dev->func) {
1270 ds_dev_dbg(2, dev, "requesting configuration\n"); 1253 dev_dbg(dev, "requesting configuration\n");
1271 ret = pcmcia_request_configuration(p_dev, &p_dev->conf); 1254 ret = pcmcia_request_configuration(p_dev, &p_dev->conf);
1272 if (ret) 1255 if (ret)
1273 goto out; 1256 goto out;
@@ -1309,14 +1292,14 @@ static int pcmcia_bus_resume_callback(struct device *dev, void * _data)
1309 1292
1310static int pcmcia_bus_resume(struct pcmcia_socket *skt) 1293static int pcmcia_bus_resume(struct pcmcia_socket *skt)
1311{ 1294{
1312 ds_dev_dbg(2, &skt->dev, "resuming socket %d\n", skt->sock); 1295 dev_dbg(&skt->dev, "resuming socket %d\n", skt->sock);
1313 bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback); 1296 bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback);
1314 return 0; 1297 return 0;
1315} 1298}
1316 1299
1317static int pcmcia_bus_suspend(struct pcmcia_socket *skt) 1300static int pcmcia_bus_suspend(struct pcmcia_socket *skt)
1318{ 1301{
1319 ds_dev_dbg(2, &skt->dev, "suspending socket %d\n", skt->sock); 1302 dev_dbg(&skt->dev, "suspending socket %d\n", skt->sock);
1320 if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt, 1303 if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt,
1321 pcmcia_bus_suspend_callback)) { 1304 pcmcia_bus_suspend_callback)) {
1322 pcmcia_bus_resume(skt); 1305 pcmcia_bus_resume(skt);
@@ -1348,7 +1331,7 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
1348 return -ENODEV; 1331 return -ENODEV;
1349 } 1332 }
1350 1333
1351 ds_dev_dbg(1, &skt->dev, "ds_event(0x%06x, %d, 0x%p)\n", 1334 dev_dbg(&skt->dev, "ds_event(0x%06x, %d, 0x%p)\n",
1352 event, priority, skt); 1335 event, priority, skt);
1353 1336
1354 switch (event) { 1337 switch (event) {
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index 30cf71d2ee23..056fd131c89c 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -58,17 +58,6 @@ typedef struct user_info_t {
58} user_info_t; 58} user_info_t;
59 59
60 60
61#ifdef CONFIG_PCMCIA_DEBUG
62extern int ds_pc_debug;
63
64#define ds_dbg(lvl, fmt, arg...) do { \
65 if (ds_pc_debug >= lvl) \
66 printk(KERN_DEBUG "ds: " fmt , ## arg); \
67} while (0)
68#else
69#define ds_dbg(lvl, fmt, arg...) do { } while (0)
70#endif
71
72static struct pcmcia_device *get_pcmcia_device(struct pcmcia_socket *s, 61static struct pcmcia_device *get_pcmcia_device(struct pcmcia_socket *s,
73 unsigned int function) 62 unsigned int function)
74{ 63{
@@ -431,7 +420,7 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info)
431 if (!s) 420 if (!s)
432 return -EINVAL; 421 return -EINVAL;
433 422
434 ds_dbg(2, "bind_request(%d, '%s')\n", s->sock, 423 pr_debug("bind_request(%d, '%s')\n", s->sock,
435 (char *)bind_info->dev_info); 424 (char *)bind_info->dev_info);
436 425
437 p_drv = get_pcmcia_driver(&bind_info->dev_info); 426 p_drv = get_pcmcia_driver(&bind_info->dev_info);
@@ -623,7 +612,7 @@ static int ds_open(struct inode *inode, struct file *file)
623 static int warning_printed = 0; 612 static int warning_printed = 0;
624 int ret = 0; 613 int ret = 0;
625 614
626 ds_dbg(0, "ds_open(socket %d)\n", i); 615 pr_debug("ds_open(socket %d)\n", i);
627 616
628 lock_kernel(); 617 lock_kernel();
629 s = pcmcia_get_socket_by_nr(i); 618 s = pcmcia_get_socket_by_nr(i);
@@ -685,7 +674,7 @@ static int ds_release(struct inode *inode, struct file *file)
685 struct pcmcia_socket *s; 674 struct pcmcia_socket *s;
686 user_info_t *user, **link; 675 user_info_t *user, **link;
687 676
688 ds_dbg(0, "ds_release(socket %d)\n", iminor(inode)); 677 pr_debug("ds_release(socket %d)\n", iminor(inode));
689 678
690 user = file->private_data; 679 user = file->private_data;
691 if (CHECK_USER(user)) 680 if (CHECK_USER(user))
@@ -719,7 +708,7 @@ static ssize_t ds_read(struct file *file, char __user *buf,
719 user_info_t *user; 708 user_info_t *user;
720 int ret; 709 int ret;
721 710
722 ds_dbg(2, "ds_read(socket %d)\n", iminor(file->f_path.dentry->d_inode)); 711 pr_debug("ds_read(socket %d)\n", iminor(file->f_path.dentry->d_inode));
723 712
724 if (count < 4) 713 if (count < 4)
725 return -EINVAL; 714 return -EINVAL;
@@ -744,7 +733,7 @@ static ssize_t ds_read(struct file *file, char __user *buf,
744static ssize_t ds_write(struct file *file, const char __user *buf, 733static ssize_t ds_write(struct file *file, const char __user *buf,
745 size_t count, loff_t *ppos) 734 size_t count, loff_t *ppos)
746{ 735{
747 ds_dbg(2, "ds_write(socket %d)\n", iminor(file->f_path.dentry->d_inode)); 736 pr_debug("ds_write(socket %d)\n", iminor(file->f_path.dentry->d_inode));
748 737
749 if (count != 4) 738 if (count != 4)
750 return -EINVAL; 739 return -EINVAL;
@@ -762,7 +751,7 @@ static u_int ds_poll(struct file *file, poll_table *wait)
762 struct pcmcia_socket *s; 751 struct pcmcia_socket *s;
763 user_info_t *user; 752 user_info_t *user;
764 753
765 ds_dbg(2, "ds_poll(socket %d)\n", iminor(file->f_path.dentry->d_inode)); 754 pr_debug("ds_poll(socket %d)\n", iminor(file->f_path.dentry->d_inode));
766 755
767 user = file->private_data; 756 user = file->private_data;
768 if (CHECK_USER(user)) 757 if (CHECK_USER(user))
@@ -790,7 +779,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
790 ds_ioctl_arg_t *buf; 779 ds_ioctl_arg_t *buf;
791 user_info_t *user; 780 user_info_t *user;
792 781
793 ds_dbg(2, "ds_ioctl(socket %d, %#x, %#lx)\n", iminor(inode), cmd, arg); 782 pr_debug("ds_ioctl(socket %d, %#x, %#lx)\n", iminor(inode), cmd, arg);
794 783
795 user = file->private_data; 784 user = file->private_data;
796 if (CHECK_USER(user)) 785 if (CHECK_USER(user))
@@ -809,13 +798,13 @@ static int ds_ioctl(struct inode * inode, struct file * file,
809 798
810 if (cmd & IOC_IN) { 799 if (cmd & IOC_IN) {
811 if (!access_ok(VERIFY_READ, uarg, size)) { 800 if (!access_ok(VERIFY_READ, uarg, size)) {
812 ds_dbg(3, "ds_ioctl(): verify_read = %d\n", -EFAULT); 801 pr_debug("ds_ioctl(): verify_read = %d\n", -EFAULT);
813 return -EFAULT; 802 return -EFAULT;
814 } 803 }
815 } 804 }
816 if (cmd & IOC_OUT) { 805 if (cmd & IOC_OUT) {
817 if (!access_ok(VERIFY_WRITE, uarg, size)) { 806 if (!access_ok(VERIFY_WRITE, uarg, size)) {
818 ds_dbg(3, "ds_ioctl(): verify_write = %d\n", -EFAULT); 807 pr_debug("ds_ioctl(): verify_write = %d\n", -EFAULT);
819 return -EFAULT; 808 return -EFAULT;
820 } 809 }
821 } 810 }
@@ -962,7 +951,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
962 } 951 }
963 952
964 if ((err == 0) && (ret != 0)) { 953 if ((err == 0) && (ret != 0)) {
965 ds_dbg(2, "ds_ioctl: ret = %d\n", ret); 954 pr_debug("ds_ioctl: ret = %d\n", ret);
966 switch (ret) { 955 switch (ret) {
967 case -ENODEV: 956 case -ENODEV:
968 case -EINVAL: 957 case -EINVAL:
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 0bfb05aa8f85..349bc5662fff 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -44,21 +44,6 @@ static u8 pcmcia_used_irq[NR_IRQS];
44#endif 44#endif
45 45
46 46
47#ifdef CONFIG_PCMCIA_DEBUG
48extern int ds_pc_debug;
49
50#define ds_dbg(skt, lvl, fmt, arg...) do { \
51 if (ds_pc_debug >= lvl) \
52 dev_printk(KERN_DEBUG, &skt->dev, \
53 "pcmcia_resource: " fmt, \
54 ## arg); \
55} while (0)
56#else
57#define ds_dbg(skt, lvl, fmt, arg...) do { } while (0)
58#endif
59
60
61
62/** alloc_io_space 47/** alloc_io_space
63 * 48 *
64 * Special stuff for managing IO windows, because they are scarce 49 * Special stuff for managing IO windows, because they are scarce
@@ -73,14 +58,14 @@ static int alloc_io_space(struct pcmcia_socket *s, u_int attr,
73 align = (*base) ? (lines ? 1<<lines : 0) : 1; 58 align = (*base) ? (lines ? 1<<lines : 0) : 1;
74 if (align && (align < num)) { 59 if (align && (align < num)) {
75 if (*base) { 60 if (*base) {
76 ds_dbg(s, 0, "odd IO request: num %#x align %#x\n", 61 dev_dbg(&s->dev, "odd IO request: num %#x align %#x\n",
77 num, align); 62 num, align);
78 align = 0; 63 align = 0;
79 } else 64 } else
80 while (align && (align < num)) align <<= 1; 65 while (align && (align < num)) align <<= 1;
81 } 66 }
82 if (*base & ~(align-1)) { 67 if (*base & ~(align-1)) {
83 ds_dbg(s, 0, "odd IO request: base %#x align %#x\n", 68 dev_dbg(&s->dev, "odd IO request: base %#x align %#x\n",
84 *base, align); 69 *base, align);
85 align = 0; 70 align = 0;
86 } 71 }
@@ -253,12 +238,12 @@ int pcmcia_map_mem_page(window_handle_t win, memreq_t *req)
253 return -EINVAL; 238 return -EINVAL;
254 s = win->sock; 239 s = win->sock;
255 if (req->Page != 0) { 240 if (req->Page != 0) {
256 ds_dbg(s, 0, "failure: requested page is zero\n"); 241 dev_dbg(&s->dev, "failure: requested page is zero\n");
257 return -EINVAL; 242 return -EINVAL;
258 } 243 }
259 win->ctl.card_start = req->CardOffset; 244 win->ctl.card_start = req->CardOffset;
260 if (s->ops->set_mem_map(s, &win->ctl) != 0) { 245 if (s->ops->set_mem_map(s, &win->ctl) != 0) {
261 ds_dbg(s, 0, "failed to set_mem_map\n"); 246 dev_dbg(&s->dev, "failed to set_mem_map\n");
262 return -EIO; 247 return -EIO;
263 } 248 }
264 return 0; 249 return 0;
@@ -296,7 +281,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
296 } 281 }
297 282
298 if (mod->Attributes & CONF_VCC_CHANGE_VALID) { 283 if (mod->Attributes & CONF_VCC_CHANGE_VALID) {
299 ds_dbg(s, 0, "changing Vcc is not allowed at this time\n"); 284 dev_dbg(&s->dev, "changing Vcc is not allowed at this time\n");
300 return -EINVAL; 285 return -EINVAL;
301 } 286 }
302 287
@@ -304,7 +289,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
304 if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) && 289 if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) &&
305 (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { 290 (mod->Attributes & CONF_VPP2_CHANGE_VALID)) {
306 if (mod->Vpp1 != mod->Vpp2) { 291 if (mod->Vpp1 != mod->Vpp2) {
307 ds_dbg(s, 0, "Vpp1 and Vpp2 must be the same\n"); 292 dev_dbg(&s->dev, "Vpp1 and Vpp2 must be the same\n");
308 return -EINVAL; 293 return -EINVAL;
309 } 294 }
310 s->socket.Vpp = mod->Vpp1; 295 s->socket.Vpp = mod->Vpp1;
@@ -315,7 +300,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
315 } 300 }
316 } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) || 301 } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) ||
317 (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { 302 (mod->Attributes & CONF_VPP2_CHANGE_VALID)) {
318 ds_dbg(s, 0, "changing Vcc is not allowed at this time\n"); 303 dev_dbg(&s->dev, "changing Vcc is not allowed at this time\n");
319 return -EINVAL; 304 return -EINVAL;
320 } 305 }
321 306
@@ -426,11 +411,11 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
426 if (c->state & CONFIG_LOCKED) 411 if (c->state & CONFIG_LOCKED)
427 return -EACCES; 412 return -EACCES;
428 if (c->irq.Attributes != req->Attributes) { 413 if (c->irq.Attributes != req->Attributes) {
429 ds_dbg(s, 0, "IRQ attributes must match assigned ones\n"); 414 dev_dbg(&s->dev, "IRQ attributes must match assigned ones\n");
430 return -EINVAL; 415 return -EINVAL;
431 } 416 }
432 if (s->irq.AssignedIRQ != req->AssignedIRQ) { 417 if (s->irq.AssignedIRQ != req->AssignedIRQ) {
433 ds_dbg(s, 0, "IRQ must match assigned one\n"); 418 dev_dbg(&s->dev, "IRQ must match assigned one\n");
434 return -EINVAL; 419 return -EINVAL;
435 } 420 }
436 if (--s->irq.Config == 0) { 421 if (--s->irq.Config == 0) {
@@ -493,7 +478,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
493 return -ENODEV; 478 return -ENODEV;
494 479
495 if (req->IntType & INT_CARDBUS) { 480 if (req->IntType & INT_CARDBUS) {
496 ds_dbg(p_dev->socket, 0, "IntType may not be INT_CARDBUS\n"); 481 dev_dbg(&s->dev, "IntType may not be INT_CARDBUS\n");
497 return -EINVAL; 482 return -EINVAL;
498 } 483 }
499 c = p_dev->function_config; 484 c = p_dev->function_config;
@@ -619,31 +604,31 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
619 if (c->state & CONFIG_LOCKED) 604 if (c->state & CONFIG_LOCKED)
620 return -EACCES; 605 return -EACCES;
621 if (c->state & CONFIG_IO_REQ) { 606 if (c->state & CONFIG_IO_REQ) {
622 ds_dbg(s, 0, "IO already configured\n"); 607 dev_dbg(&s->dev, "IO already configured\n");
623 return -EBUSY; 608 return -EBUSY;
624 } 609 }
625 if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) { 610 if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) {
626 ds_dbg(s, 0, "bad attribute setting for IO region 1\n"); 611 dev_dbg(&s->dev, "bad attribute setting for IO region 1\n");
627 return -EINVAL; 612 return -EINVAL;
628 } 613 }
629 if ((req->NumPorts2 > 0) && 614 if ((req->NumPorts2 > 0) &&
630 (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) { 615 (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) {
631 ds_dbg(s, 0, "bad attribute setting for IO region 2\n"); 616 dev_dbg(&s->dev, "bad attribute setting for IO region 2\n");
632 return -EINVAL; 617 return -EINVAL;
633 } 618 }
634 619
635 ds_dbg(s, 1, "trying to allocate resource 1\n"); 620 dev_dbg(&s->dev, "trying to allocate resource 1\n");
636 if (alloc_io_space(s, req->Attributes1, &req->BasePort1, 621 if (alloc_io_space(s, req->Attributes1, &req->BasePort1,
637 req->NumPorts1, req->IOAddrLines)) { 622 req->NumPorts1, req->IOAddrLines)) {
638 ds_dbg(s, 0, "allocation of resource 1 failed\n"); 623 dev_dbg(&s->dev, "allocation of resource 1 failed\n");
639 return -EBUSY; 624 return -EBUSY;
640 } 625 }
641 626
642 if (req->NumPorts2) { 627 if (req->NumPorts2) {
643 ds_dbg(s, 1, "trying to allocate resource 2\n"); 628 dev_dbg(&s->dev, "trying to allocate resource 2\n");
644 if (alloc_io_space(s, req->Attributes2, &req->BasePort2, 629 if (alloc_io_space(s, req->Attributes2, &req->BasePort2,
645 req->NumPorts2, req->IOAddrLines)) { 630 req->NumPorts2, req->IOAddrLines)) {
646 ds_dbg(s, 0, "allocation of resource 2 failed\n"); 631 dev_dbg(&s->dev, "allocation of resource 2 failed\n");
647 release_io_space(s, req->BasePort1, req->NumPorts1); 632 release_io_space(s, req->BasePort1, req->NumPorts1);
648 return -EBUSY; 633 return -EBUSY;
649 } 634 }
@@ -687,7 +672,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
687 if (c->state & CONFIG_LOCKED) 672 if (c->state & CONFIG_LOCKED)
688 return -EACCES; 673 return -EACCES;
689 if (c->state & CONFIG_IRQ_REQ) { 674 if (c->state & CONFIG_IRQ_REQ) {
690 ds_dbg(s, 0, "IRQ already configured\n"); 675 dev_dbg(&s->dev, "IRQ already configured\n");
691 return -EBUSY; 676 return -EBUSY;
692 } 677 }
693 678
@@ -798,7 +783,7 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
798 if (!(s->state & SOCKET_PRESENT)) 783 if (!(s->state & SOCKET_PRESENT))
799 return -ENODEV; 784 return -ENODEV;
800 if (req->Attributes & (WIN_PAGED | WIN_SHARED)) { 785 if (req->Attributes & (WIN_PAGED | WIN_SHARED)) {
801 ds_dbg(s, 0, "bad attribute setting for iomem region\n"); 786 dev_dbg(&s->dev, "bad attribute setting for iomem region\n");
802 return -EINVAL; 787 return -EINVAL;
803 } 788 }
804 789
@@ -809,12 +794,12 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
809 (req->Attributes & WIN_STRICT_ALIGN)) ? 794 (req->Attributes & WIN_STRICT_ALIGN)) ?
810 req->Size : s->map_size); 795 req->Size : s->map_size);
811 if (req->Size & (s->map_size-1)) { 796 if (req->Size & (s->map_size-1)) {
812 ds_dbg(s, 0, "invalid map size\n"); 797 dev_dbg(&s->dev, "invalid map size\n");
813 return -EINVAL; 798 return -EINVAL;
814 } 799 }
815 if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || 800 if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) ||
816 (req->Base & (align-1))) { 801 (req->Base & (align-1))) {
817 ds_dbg(s, 0, "invalid base address\n"); 802 dev_dbg(&s->dev, "invalid base address\n");
818 return -EINVAL; 803 return -EINVAL;
819 } 804 }
820 if (req->Base) 805 if (req->Base)
@@ -824,7 +809,7 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
824 for (w = 0; w < MAX_WIN; w++) 809 for (w = 0; w < MAX_WIN; w++)
825 if (!(s->state & SOCKET_WIN_REQ(w))) break; 810 if (!(s->state & SOCKET_WIN_REQ(w))) break;
826 if (w == MAX_WIN) { 811 if (w == MAX_WIN) {
827 ds_dbg(s, 0, "all windows are used already\n"); 812 dev_dbg(&s->dev, "all windows are used already\n");
828 return -EINVAL; 813 return -EINVAL;
829 } 814 }
830 815
@@ -838,7 +823,7 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
838 win->ctl.res = pcmcia_find_mem_region(req->Base, req->Size, align, 823 win->ctl.res = pcmcia_find_mem_region(req->Base, req->Size, align,
839 (req->Attributes & WIN_MAP_BELOW_1MB), s); 824 (req->Attributes & WIN_MAP_BELOW_1MB), s);
840 if (!win->ctl.res) { 825 if (!win->ctl.res) {
841 ds_dbg(s, 0, "allocating mem region failed\n"); 826 dev_dbg(&s->dev, "allocating mem region failed\n");
842 return -EINVAL; 827 return -EINVAL;
843 } 828 }
844 } 829 }
@@ -858,7 +843,7 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
858 win->ctl.flags |= MAP_USE_WAIT; 843 win->ctl.flags |= MAP_USE_WAIT;
859 win->ctl.card_start = 0; 844 win->ctl.card_start = 0;
860 if (s->ops->set_mem_map(s, &win->ctl) != 0) { 845 if (s->ops->set_mem_map(s, &win->ctl) != 0) {
861 ds_dbg(s, 0, "failed to set memory mapping\n"); 846 dev_dbg(&s->dev, "failed to set memory mapping\n");
862 return -EIO; 847 return -EIO;
863 } 848 }
864 s->state |= SOCKET_WIN_REQ(w); 849 s->state |= SOCKET_WIN_REQ(w);