aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/Makefile4
-rw-r--r--drivers/pcmcia/cistpl.c3
-rw-r--r--drivers/pcmcia/cs.c22
-rw-r--r--drivers/pcmcia/cs_internal.h10
-rw-r--r--drivers/pcmcia/ds.c137
-rw-r--r--drivers/pcmcia/i82365.c2
-rw-r--r--drivers/pcmcia/m32r_cfc.c4
-rw-r--r--drivers/pcmcia/m32r_pcc.c4
-rw-r--r--drivers/pcmcia/m8xx_pcmcia.c4
-rw-r--r--drivers/pcmcia/o2micro.h10
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c2
-rw-r--r--drivers/pcmcia/pcmcia_resource.c91
-rw-r--r--drivers/pcmcia/rsrc_nonstatic.c33
-rw-r--r--drivers/pcmcia/soc_common.c2
-rw-r--r--drivers/pcmcia/soc_common.h2
-rw-r--r--drivers/pcmcia/tcic.c2
-rw-r--r--drivers/pcmcia/ti113x.h78
-rw-r--r--drivers/pcmcia/yenta_socket.c86
18 files changed, 304 insertions, 192 deletions
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile
index 269a9e913ba2..2ea5d46a4033 100644
--- a/drivers/pcmcia/Makefile
+++ b/drivers/pcmcia/Makefile
@@ -2,10 +2,6 @@
2# Makefile for the kernel pcmcia subsystem (c/o David Hinds) 2# Makefile for the kernel pcmcia subsystem (c/o David Hinds)
3# 3#
4 4
5ifeq ($(CONFIG_PCMCIA_DEBUG),y)
6EXTRA_CFLAGS += -DDEBUG
7endif
8
9pcmcia_core-y += cs.o cistpl.o rsrc_mgr.o socket_sysfs.o 5pcmcia_core-y += cs.o cistpl.o rsrc_mgr.o socket_sysfs.o
10pcmcia_core-$(CONFIG_CARDBUS) += cardbus.o 6pcmcia_core-$(CONFIG_CARDBUS) += cardbus.o
11obj-$(CONFIG_PCCARD) += pcmcia_core.o 7obj-$(CONFIG_PCCARD) += pcmcia_core.o
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 11c473c865a5..fe789e0e7ada 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -92,7 +92,8 @@ set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flag
92 if (!(s->features & SS_CAP_STATIC_MAP) && (mem->res == NULL)) { 92 if (!(s->features & SS_CAP_STATIC_MAP) && (mem->res == NULL)) {
93 mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s); 93 mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s);
94 if (mem->res == NULL) { 94 if (mem->res == NULL) {
95 printk(KERN_NOTICE "cs: unable to map card memory!\n"); 95 dev_printk(KERN_NOTICE, &s->dev,
96 "cs: unable to map card memory!\n");
96 return NULL; 97 return NULL;
97 } 98 }
98 s->cis_virt = NULL; 99 s->cis_virt = NULL;
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index d1207393fc3e..ccdbbe4936fd 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -61,7 +61,7 @@ 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 DEBUG 64#ifdef CONFIG_PCMCIA_DEBUG
65static int pc_debug; 65static int pc_debug;
66 66
67module_param(pc_debug, int, 0644); 67module_param(pc_debug, int, 0644);
@@ -247,7 +247,8 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
247 247
248 wait_for_completion(&socket->thread_done); 248 wait_for_completion(&socket->thread_done);
249 if (!socket->thread) { 249 if (!socket->thread) {
250 printk(KERN_WARNING "PCMCIA: warning: socket thread for socket %p did not start\n", socket); 250 dev_printk(KERN_WARNING, &socket->dev,
251 "PCMCIA: warning: socket thread did not start\n");
251 return -EIO; 252 return -EIO;
252 } 253 }
253 254
@@ -412,7 +413,8 @@ static void socket_shutdown(struct pcmcia_socket *s)
412 413
413 s->ops->get_status(s, &status); 414 s->ops->get_status(s, &status);
414 if (status & SS_POWERON) { 415 if (status & SS_POWERON) {
415 printk(KERN_ERR "PCMCIA: socket %p: *** DANGER *** unable to remove socket power\n", s); 416 dev_printk(KERN_ERR, &s->dev,
417 "*** DANGER *** unable to remove socket power\n");
416 } 418 }
417 419
418 cs_socket_put(s); 420 cs_socket_put(s);
@@ -508,9 +510,10 @@ static int socket_insert(struct pcmcia_socket *skt)
508 if (ret == CS_SUCCESS) { 510 if (ret == CS_SUCCESS) {
509 skt->state |= SOCKET_PRESENT; 511 skt->state |= SOCKET_PRESENT;
510 512
511 printk(KERN_NOTICE "pccard: %s card inserted into slot %d\n", 513 dev_printk(KERN_NOTICE, &skt->dev,
512 (skt->state & SOCKET_CARDBUS) ? "CardBus" : "PCMCIA", 514 "pccard: %s card inserted into slot %d\n",
513 skt->sock); 515 (skt->state & SOCKET_CARDBUS) ? "CardBus" : "PCMCIA",
516 skt->sock);
514 517
515#ifdef CONFIG_CARDBUS 518#ifdef CONFIG_CARDBUS
516 if (skt->state & SOCKET_CARDBUS) { 519 if (skt->state & SOCKET_CARDBUS) {
@@ -595,7 +598,8 @@ static int socket_resume(struct pcmcia_socket *skt)
595 598
596static void socket_remove(struct pcmcia_socket *skt) 599static void socket_remove(struct pcmcia_socket *skt)
597{ 600{
598 printk(KERN_NOTICE "pccard: card ejected from slot %d\n", skt->sock); 601 dev_printk(KERN_NOTICE, &skt->dev,
602 "pccard: card ejected from slot %d\n", skt->sock);
599 socket_shutdown(skt); 603 socket_shutdown(skt);
600} 604}
601 605
@@ -641,8 +645,8 @@ static int pccardd(void *__skt)
641 /* register with the device core */ 645 /* register with the device core */
642 ret = device_register(&skt->dev); 646 ret = device_register(&skt->dev);
643 if (ret) { 647 if (ret) {
644 printk(KERN_WARNING "PCMCIA: unable to register socket 0x%p\n", 648 dev_printk(KERN_WARNING, &skt->dev,
645 skt); 649 "PCMCIA: unable to register socket\n");
646 skt->thread = NULL; 650 skt->thread = NULL;
647 complete(&skt->thread_done); 651 complete(&skt->thread_done);
648 return 0; 652 return 0;
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h
index 63dc1a28bda2..481a823c94b4 100644
--- a/drivers/pcmcia/cs_internal.h
+++ b/drivers/pcmcia/cs_internal.h
@@ -130,15 +130,13 @@ struct pcmcia_callback{
130 130
131int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); 131int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c);
132 132
133#define cs_socket_name(skt) ((skt)->dev.bus_id) 133#ifdef CONFIG_PCMCIA_DEBUG
134
135#ifdef DEBUG
136extern int cs_debug_level(int); 134extern int cs_debug_level(int);
137 135
138#define cs_dbg(skt, lvl, fmt, arg...) do { \ 136#define cs_dbg(skt, lvl, fmt, arg...) do { \
139 if (cs_debug_level(lvl)) \ 137 if (cs_debug_level(lvl)) \
140 printk(KERN_DEBUG "cs: %s: " fmt, \ 138 dev_printk(KERN_DEBUG, &skt->dev, \
141 cs_socket_name(skt) , ## arg); \ 139 "cs: " fmt, ## arg); \
142} while (0) 140} while (0)
143 141
144#else 142#else
@@ -146,6 +144,6 @@ extern int cs_debug_level(int);
146#endif 144#endif
147 145
148#define cs_err(skt, fmt, arg...) \ 146#define cs_err(skt, fmt, arg...) \
149 printk(KERN_ERR "cs: %s: " fmt, (skt)->dev.bus_id , ## arg) 147 dev_printk(KERN_ERR, &skt->dev, "cs: " fmt, ## arg)
150 148
151#endif /* _LINUX_CS_INTERNAL_H */ 149#endif /* _LINUX_CS_INTERNAL_H */
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 2382341975e5..a393501554ac 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -42,17 +42,22 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
42MODULE_DESCRIPTION("PCMCIA Driver Services"); 42MODULE_DESCRIPTION("PCMCIA Driver Services");
43MODULE_LICENSE("GPL"); 43MODULE_LICENSE("GPL");
44 44
45#ifdef DEBUG 45#ifdef CONFIG_PCMCIA_DEBUG
46int ds_pc_debug; 46int ds_pc_debug;
47 47
48module_param_named(pc_debug, ds_pc_debug, int, 0644); 48module_param_named(pc_debug, ds_pc_debug, int, 0644);
49 49
50#define ds_dbg(lvl, fmt, arg...) do { \ 50#define ds_dbg(lvl, fmt, arg...) do { \
51 if (ds_pc_debug > (lvl)) \ 51 if (ds_pc_debug > (lvl)) \
52 printk(KERN_DEBUG "ds: " fmt , ## arg); \ 52 printk(KERN_DEBUG "ds: " fmt , ## arg); \
53} while (0) 53} while (0)
54#define ds_dev_dbg(lvl, dev, fmt, arg...) do { \
55 if (ds_pc_debug > (lvl)) \
56 dev_printk(KERN_DEBUG, dev, "ds: " fmt , ## arg); \
57} while (0)
54#else 58#else
55#define ds_dbg(lvl, fmt, arg...) do { } while (0) 59#define ds_dbg(lvl, fmt, arg...) do { } while (0)
60#define ds_dev_dbg(lvl, dev, fmt, arg...) do { } while (0)
56#endif 61#endif
57 62
58spinlock_t pcmcia_dev_list_lock; 63spinlock_t pcmcia_dev_list_lock;
@@ -391,7 +396,7 @@ static void pcmcia_release_function(struct kref *ref)
391static void pcmcia_release_dev(struct device *dev) 396static void pcmcia_release_dev(struct device *dev)
392{ 397{
393 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 398 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
394 ds_dbg(1, "releasing device %s\n", p_dev->dev.bus_id); 399 ds_dev_dbg(1, dev, "releasing device\n");
395 pcmcia_put_socket(p_dev->socket); 400 pcmcia_put_socket(p_dev->socket);
396 kfree(p_dev->devname); 401 kfree(p_dev->devname);
397 kref_put(&p_dev->function_config->ref, pcmcia_release_function); 402 kref_put(&p_dev->function_config->ref, pcmcia_release_function);
@@ -401,7 +406,7 @@ static void pcmcia_release_dev(struct device *dev)
401static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc) 406static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc)
402{ 407{
403 if (!s->pcmcia_state.device_add_pending) { 408 if (!s->pcmcia_state.device_add_pending) {
404 ds_dbg(1, "scheduling to add %s secondary" 409 ds_dev_dbg(1, &s->dev, "scheduling to add %s secondary"
405 " device to %d\n", mfc ? "mfc" : "pfc", s->sock); 410 " device to %d\n", mfc ? "mfc" : "pfc", s->sock);
406 s->pcmcia_state.device_add_pending = 1; 411 s->pcmcia_state.device_add_pending = 1;
407 s->pcmcia_state.mfc_pfc = mfc; 412 s->pcmcia_state.mfc_pfc = mfc;
@@ -427,8 +432,7 @@ static int pcmcia_device_probe(struct device * dev)
427 p_drv = to_pcmcia_drv(dev->driver); 432 p_drv = to_pcmcia_drv(dev->driver);
428 s = p_dev->socket; 433 s = p_dev->socket;
429 434
430 ds_dbg(1, "trying to bind %s to %s\n", p_dev->dev.bus_id, 435 ds_dev_dbg(1, dev, "trying to bind to %s\n", p_drv->drv.name);
431 p_drv->drv.name);
432 436
433 if ((!p_drv->probe) || (!p_dev->function_config) || 437 if ((!p_drv->probe) || (!p_dev->function_config) ||
434 (!try_module_get(p_drv->owner))) { 438 (!try_module_get(p_drv->owner))) {
@@ -443,15 +447,16 @@ static int pcmcia_device_probe(struct device * dev)
443 p_dev->conf.ConfigBase = cis_config.base; 447 p_dev->conf.ConfigBase = cis_config.base;
444 p_dev->conf.Present = cis_config.rmask[0]; 448 p_dev->conf.Present = cis_config.rmask[0];
445 } else { 449 } else {
446 printk(KERN_INFO "pcmcia: could not parse base and rmask0 of CIS\n"); 450 dev_printk(KERN_INFO, dev,
451 "pcmcia: could not parse base and rmask0 of CIS\n");
447 p_dev->conf.ConfigBase = 0; 452 p_dev->conf.ConfigBase = 0;
448 p_dev->conf.Present = 0; 453 p_dev->conf.Present = 0;
449 } 454 }
450 455
451 ret = p_drv->probe(p_dev); 456 ret = p_drv->probe(p_dev);
452 if (ret) { 457 if (ret) {
453 ds_dbg(1, "binding %s to %s failed with %d\n", 458 ds_dev_dbg(1, dev, "binding to %s failed with %d\n",
454 p_dev->dev.bus_id, p_drv->drv.name, ret); 459 p_drv->drv.name, ret);
455 goto put_module; 460 goto put_module;
456 } 461 }
457 462
@@ -485,8 +490,9 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le
485 struct pcmcia_device *tmp; 490 struct pcmcia_device *tmp;
486 unsigned long flags; 491 unsigned long flags;
487 492
488 ds_dbg(2, "pcmcia_card_remove(%d) %s\n", s->sock, 493 ds_dev_dbg(2, leftover ? &leftover->dev : &s->dev,
489 leftover ? leftover->devname : ""); 494 "pcmcia_card_remove(%d) %s\n", s->sock,
495 leftover ? leftover->devname : "");
490 496
491 if (!leftover) 497 if (!leftover)
492 s->device_count = 0; 498 s->device_count = 0;
@@ -503,7 +509,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le
503 p_dev->_removed=1; 509 p_dev->_removed=1;
504 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 510 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
505 511
506 ds_dbg(2, "unregistering device %s\n", p_dev->dev.bus_id); 512 ds_dev_dbg(2, &p_dev->dev, "unregistering device\n");
507 device_unregister(&p_dev->dev); 513 device_unregister(&p_dev->dev);
508 } 514 }
509 515
@@ -520,7 +526,7 @@ static int pcmcia_device_remove(struct device * dev)
520 p_dev = to_pcmcia_dev(dev); 526 p_dev = to_pcmcia_dev(dev);
521 p_drv = to_pcmcia_drv(dev->driver); 527 p_drv = to_pcmcia_drv(dev->driver);
522 528
523 ds_dbg(1, "removing device %s\n", p_dev->dev.bus_id); 529 ds_dev_dbg(1, dev, "removing device\n");
524 530
525 /* If we're removing the primary module driving a 531 /* If we're removing the primary module driving a
526 * pseudo multi-function card, we need to unbind 532 * pseudo multi-function card, we need to unbind
@@ -543,13 +549,15 @@ static int pcmcia_device_remove(struct device * dev)
543 549
544 /* check for proper unloading */ 550 /* check for proper unloading */
545 if (p_dev->_irq || p_dev->_io || p_dev->_locked) 551 if (p_dev->_irq || p_dev->_io || p_dev->_locked)
546 printk(KERN_INFO "pcmcia: driver %s did not release config properly\n", 552 dev_printk(KERN_INFO, dev,
547 p_drv->drv.name); 553 "pcmcia: driver %s did not release config properly\n",
554 p_drv->drv.name);
548 555
549 for (i = 0; i < MAX_WIN; i++) 556 for (i = 0; i < MAX_WIN; i++)
550 if (p_dev->_win & CLIENT_WIN_REQ(i)) 557 if (p_dev->_win & CLIENT_WIN_REQ(i))
551 printk(KERN_INFO "pcmcia: driver %s did not release windows properly\n", 558 dev_printk(KERN_INFO, dev,
552 p_drv->drv.name); 559 "pcmcia: driver %s did not release window properly\n",
560 p_drv->drv.name);
553 561
554 /* references from pcmcia_probe_device */ 562 /* references from pcmcia_probe_device */
555 pcmcia_put_dev(p_dev); 563 pcmcia_put_dev(p_dev);
@@ -598,8 +606,9 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev)
598 } 606 }
599 if (!pccard_read_tuple(p_dev->socket, p_dev->func, 607 if (!pccard_read_tuple(p_dev->socket, p_dev->func,
600 CISTPL_DEVICE_GEO, devgeo)) { 608 CISTPL_DEVICE_GEO, devgeo)) {
601 ds_dbg(0, "mem device geometry probably means " 609 ds_dev_dbg(0, &p_dev->dev,
602 "FUNCID_MEMORY\n"); 610 "mem device geometry probably means "
611 "FUNCID_MEMORY\n");
603 p_dev->func_id = CISTPL_FUNCID_MEMORY; 612 p_dev->func_id = CISTPL_FUNCID_MEMORY;
604 p_dev->has_func_id = 1; 613 p_dev->has_func_id = 1;
605 } 614 }
@@ -680,7 +689,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
680 if (!p_dev->devname) 689 if (!p_dev->devname)
681 goto err_free; 690 goto err_free;
682 sprintf (p_dev->devname, "pcmcia%s", p_dev->dev.bus_id); 691 sprintf (p_dev->devname, "pcmcia%s", p_dev->dev.bus_id);
683 ds_dbg(3, "devname is %s\n", p_dev->devname); 692 ds_dev_dbg(3, &p_dev->dev, "devname is %s\n", p_dev->devname);
684 693
685 spin_lock_irqsave(&pcmcia_dev_list_lock, flags); 694 spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
686 695
@@ -701,7 +710,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
701 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 710 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
702 711
703 if (!p_dev->function_config) { 712 if (!p_dev->function_config) {
704 ds_dbg(3, "creating config_t for %s\n", p_dev->dev.bus_id); 713 ds_dev_dbg(3, &p_dev->dev, "creating config_t\n");
705 p_dev->function_config = kzalloc(sizeof(struct config_t), 714 p_dev->function_config = kzalloc(sizeof(struct config_t),
706 GFP_KERNEL); 715 GFP_KERNEL);
707 if (!p_dev->function_config) 716 if (!p_dev->function_config)
@@ -709,8 +718,9 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
709 kref_init(&p_dev->function_config->ref); 718 kref_init(&p_dev->function_config->ref);
710 } 719 }
711 720
712 printk(KERN_NOTICE "pcmcia: registering new device %s\n", 721 dev_printk(KERN_NOTICE, &p_dev->dev,
713 p_dev->devname); 722 "pcmcia: registering new device %s\n",
723 p_dev->devname);
714 724
715 pcmcia_device_query(p_dev); 725 pcmcia_device_query(p_dev);
716 726
@@ -745,19 +755,20 @@ static int pcmcia_card_add(struct pcmcia_socket *s)
745 int ret = 0; 755 int ret = 0;
746 756
747 if (!(s->resource_setup_done)) { 757 if (!(s->resource_setup_done)) {
748 ds_dbg(3, "no resources available, delaying card_add\n"); 758 ds_dev_dbg(3, &s->dev,
759 "no resources available, delaying card_add\n");
749 return -EAGAIN; /* try again, but later... */ 760 return -EAGAIN; /* try again, but later... */
750 } 761 }
751 762
752 if (pcmcia_validate_mem(s)) { 763 if (pcmcia_validate_mem(s)) {
753 ds_dbg(3, "validating mem resources failed, " 764 ds_dev_dbg(3, &s->dev, "validating mem resources failed, "
754 "delaying card_add\n"); 765 "delaying card_add\n");
755 return -EAGAIN; /* try again, but later... */ 766 return -EAGAIN; /* try again, but later... */
756 } 767 }
757 768
758 ret = pccard_validate_cis(s, BIND_FN_ALL, &no_chains); 769 ret = pccard_validate_cis(s, BIND_FN_ALL, &no_chains);
759 if (ret || !no_chains) { 770 if (ret || !no_chains) {
760 ds_dbg(0, "invalid CIS or invalid resources\n"); 771 ds_dev_dbg(0, &s->dev, "invalid CIS or invalid resources\n");
761 return -ENODEV; 772 return -ENODEV;
762 } 773 }
763 774
@@ -778,7 +789,7 @@ static void pcmcia_delayed_add_device(struct work_struct *work)
778{ 789{
779 struct pcmcia_socket *s = 790 struct pcmcia_socket *s =
780 container_of(work, struct pcmcia_socket, device_add); 791 container_of(work, struct pcmcia_socket, device_add);
781 ds_dbg(1, "adding additional device to %d\n", s->sock); 792 ds_dev_dbg(1, &s->dev, "adding additional device to %d\n", s->sock);
782 pcmcia_device_add(s, s->pcmcia_state.mfc_pfc); 793 pcmcia_device_add(s, s->pcmcia_state.mfc_pfc);
783 s->pcmcia_state.device_add_pending = 0; 794 s->pcmcia_state.device_add_pending = 0;
784 s->pcmcia_state.mfc_pfc = 0; 795 s->pcmcia_state.mfc_pfc = 0;
@@ -788,8 +799,7 @@ static int pcmcia_requery(struct device *dev, void * _data)
788{ 799{
789 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 800 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
790 if (!p_dev->dev.driver) { 801 if (!p_dev->dev.driver) {
791 ds_dbg(1, "update device information for %s\n", 802 ds_dev_dbg(1, dev, "update device information\n");
792 p_dev->dev.bus_id);
793 pcmcia_device_query(p_dev); 803 pcmcia_device_query(p_dev);
794 } 804 }
795 805
@@ -803,7 +813,7 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt, int new_cis)
803 unsigned long flags; 813 unsigned long flags;
804 814
805 /* must be called with skt_mutex held */ 815 /* must be called with skt_mutex held */
806 ds_dbg(0, "re-scanning socket %d\n", skt->sock); 816 ds_dev_dbg(0, &skt->dev, "re-scanning socket %d\n", skt->sock);
807 817
808 spin_lock_irqsave(&pcmcia_dev_list_lock, flags); 818 spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
809 if (list_empty(&skt->devices_list)) 819 if (list_empty(&skt->devices_list))
@@ -859,11 +869,12 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)
859 if (!filename) 869 if (!filename)
860 return -EINVAL; 870 return -EINVAL;
861 871
862 ds_dbg(1, "trying to load CIS file %s\n", filename); 872 ds_dev_dbg(1, &dev->dev, "trying to load CIS file %s\n", filename);
863 873
864 if (strlen(filename) > (FIRMWARE_NAME_MAX - 1)) { 874 if (strlen(filename) > (FIRMWARE_NAME_MAX - 1)) {
865 printk(KERN_WARNING "pcmcia: CIS filename is too long [%s]\n", 875 dev_printk(KERN_WARNING, &dev->dev,
866 filename); 876 "pcmcia: CIS filename is too long [%s]\n",
877 filename);
867 return -EINVAL; 878 return -EINVAL;
868 } 879 }
869 880
@@ -872,14 +883,16 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)
872 if (request_firmware(&fw, path, &dev->dev) == 0) { 883 if (request_firmware(&fw, path, &dev->dev) == 0) {
873 if (fw->size >= CISTPL_MAX_CIS_SIZE) { 884 if (fw->size >= CISTPL_MAX_CIS_SIZE) {
874 ret = -EINVAL; 885 ret = -EINVAL;
875 printk(KERN_ERR "pcmcia: CIS override is too big\n"); 886 dev_printk(KERN_ERR, &dev->dev,
887 "pcmcia: CIS override is too big\n");
876 goto release; 888 goto release;
877 } 889 }
878 890
879 if (!pcmcia_replace_cis(s, fw->data, fw->size)) 891 if (!pcmcia_replace_cis(s, fw->data, fw->size))
880 ret = 0; 892 ret = 0;
881 else { 893 else {
882 printk(KERN_ERR "pcmcia: CIS override failed\n"); 894 dev_printk(KERN_ERR, &dev->dev,
895 "pcmcia: CIS override failed\n");
883 goto release; 896 goto release;
884 } 897 }
885 898
@@ -983,14 +996,14 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
983 * after it has re-checked that there is no possible module 996 * after it has re-checked that there is no possible module
984 * with a prod_id/manf_id/card_id match. 997 * with a prod_id/manf_id/card_id match.
985 */ 998 */
986 ds_dbg(0, "skipping FUNC_ID match for %s until userspace " 999 ds_dev_dbg(0, &dev->dev,
987 "interaction\n", dev->dev.bus_id); 1000 "skipping FUNC_ID match until userspace interaction\n");
988 if (!dev->allow_func_id_match) 1001 if (!dev->allow_func_id_match)
989 return 0; 1002 return 0;
990 } 1003 }
991 1004
992 if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { 1005 if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) {
993 ds_dbg(0, "device %s needs a fake CIS\n", dev->dev.bus_id); 1006 ds_dev_dbg(0, &dev->dev, "device needs a fake CIS\n");
994 if (!dev->socket->fake_cis) 1007 if (!dev->socket->fake_cis)
995 pcmcia_load_firmware(dev, did->cisfile); 1008 pcmcia_load_firmware(dev, did->cisfile);
996 1009
@@ -1022,11 +1035,9 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) {
1022 /* match dynamic devices first */ 1035 /* match dynamic devices first */
1023 spin_lock(&p_drv->dynids.lock); 1036 spin_lock(&p_drv->dynids.lock);
1024 list_for_each_entry(dynid, &p_drv->dynids.list, node) { 1037 list_for_each_entry(dynid, &p_drv->dynids.list, node) {
1025 ds_dbg(3, "trying to match %s to %s\n", dev->bus_id, 1038 ds_dev_dbg(3, dev, "trying to match to %s\n", drv->name);
1026 drv->name);
1027 if (pcmcia_devmatch(p_dev, &dynid->id)) { 1039 if (pcmcia_devmatch(p_dev, &dynid->id)) {
1028 ds_dbg(0, "matched %s to %s\n", dev->bus_id, 1040 ds_dev_dbg(0, dev, "matched to %s\n", drv->name);
1029 drv->name);
1030 spin_unlock(&p_drv->dynids.lock); 1041 spin_unlock(&p_drv->dynids.lock);
1031 return 1; 1042 return 1;
1032 } 1043 }
@@ -1036,18 +1047,15 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) {
1036#ifdef CONFIG_PCMCIA_IOCTL 1047#ifdef CONFIG_PCMCIA_IOCTL
1037 /* matching by cardmgr */ 1048 /* matching by cardmgr */
1038 if (p_dev->cardmgr == p_drv) { 1049 if (p_dev->cardmgr == p_drv) {
1039 ds_dbg(0, "cardmgr matched %s to %s\n", dev->bus_id, 1050 ds_dev_dbg(0, dev, "cardmgr matched to %s\n", drv->name);
1040 drv->name);
1041 return 1; 1051 return 1;
1042 } 1052 }
1043#endif 1053#endif
1044 1054
1045 while (did && did->match_flags) { 1055 while (did && did->match_flags) {
1046 ds_dbg(3, "trying to match %s to %s\n", dev->bus_id, 1056 ds_dev_dbg(3, dev, "trying to match to %s\n", drv->name);
1047 drv->name);
1048 if (pcmcia_devmatch(p_dev, did)) { 1057 if (pcmcia_devmatch(p_dev, did)) {
1049 ds_dbg(0, "matched %s to %s\n", dev->bus_id, 1058 ds_dev_dbg(0, dev, "matched to %s\n", drv->name);
1050 drv->name);
1051 return 1; 1059 return 1;
1052 } 1060 }
1053 did++; 1061 did++;
@@ -1253,7 +1261,7 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state)
1253 if (p_dev->suspended) 1261 if (p_dev->suspended)
1254 return 0; 1262 return 0;
1255 1263
1256 ds_dbg(2, "suspending %s\n", dev->bus_id); 1264 ds_dev_dbg(2, dev, "suspending\n");
1257 1265
1258 if (dev->driver) 1266 if (dev->driver)
1259 p_drv = to_pcmcia_drv(dev->driver); 1267 p_drv = to_pcmcia_drv(dev->driver);
@@ -1264,15 +1272,16 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state)
1264 if (p_drv->suspend) { 1272 if (p_drv->suspend) {
1265 ret = p_drv->suspend(p_dev); 1273 ret = p_drv->suspend(p_dev);
1266 if (ret) { 1274 if (ret) {
1267 printk(KERN_ERR "pcmcia: device %s (driver %s) did " 1275 dev_printk(KERN_ERR, dev,
1268 "not want to go to sleep (%d)\n", 1276 "pcmcia: device %s (driver %s) did "
1269 p_dev->devname, p_drv->drv.name, ret); 1277 "not want to go to sleep (%d)\n",
1278 p_dev->devname, p_drv->drv.name, ret);
1270 goto out; 1279 goto out;
1271 } 1280 }
1272 } 1281 }
1273 1282
1274 if (p_dev->device_no == p_dev->func) { 1283 if (p_dev->device_no == p_dev->func) {
1275 ds_dbg(2, "releasing configuration for %s\n", dev->bus_id); 1284 ds_dev_dbg(2, dev, "releasing configuration\n");
1276 pcmcia_release_configuration(p_dev); 1285 pcmcia_release_configuration(p_dev);
1277 } 1286 }
1278 1287
@@ -1292,7 +1301,7 @@ static int pcmcia_dev_resume(struct device * dev)
1292 if (!p_dev->suspended) 1301 if (!p_dev->suspended)
1293 return 0; 1302 return 0;
1294 1303
1295 ds_dbg(2, "resuming %s\n", dev->bus_id); 1304 ds_dev_dbg(2, dev, "resuming\n");
1296 1305
1297 if (dev->driver) 1306 if (dev->driver)
1298 p_drv = to_pcmcia_drv(dev->driver); 1307 p_drv = to_pcmcia_drv(dev->driver);
@@ -1301,7 +1310,7 @@ static int pcmcia_dev_resume(struct device * dev)
1301 goto out; 1310 goto out;
1302 1311
1303 if (p_dev->device_no == p_dev->func) { 1312 if (p_dev->device_no == p_dev->func) {
1304 ds_dbg(2, "requesting configuration for %s\n", dev->bus_id); 1313 ds_dev_dbg(2, dev, "requesting configuration\n");
1305 ret = pcmcia_request_configuration(p_dev, &p_dev->conf); 1314 ret = pcmcia_request_configuration(p_dev, &p_dev->conf);
1306 if (ret) 1315 if (ret)
1307 goto out; 1316 goto out;
@@ -1343,14 +1352,14 @@ static int pcmcia_bus_resume_callback(struct device *dev, void * _data)
1343 1352
1344static int pcmcia_bus_resume(struct pcmcia_socket *skt) 1353static int pcmcia_bus_resume(struct pcmcia_socket *skt)
1345{ 1354{
1346 ds_dbg(2, "resuming socket %d\n", skt->sock); 1355 ds_dev_dbg(2, &skt->dev, "resuming socket %d\n", skt->sock);
1347 bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback); 1356 bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback);
1348 return 0; 1357 return 0;
1349} 1358}
1350 1359
1351static int pcmcia_bus_suspend(struct pcmcia_socket *skt) 1360static int pcmcia_bus_suspend(struct pcmcia_socket *skt)
1352{ 1361{
1353 ds_dbg(2, "suspending socket %d\n", skt->sock); 1362 ds_dev_dbg(2, &skt->dev, "suspending socket %d\n", skt->sock);
1354 if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt, 1363 if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt,
1355 pcmcia_bus_suspend_callback)) { 1364 pcmcia_bus_suspend_callback)) {
1356 pcmcia_bus_resume(skt); 1365 pcmcia_bus_resume(skt);
@@ -1376,13 +1385,14 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
1376 struct pcmcia_socket *s = pcmcia_get_socket(skt); 1385 struct pcmcia_socket *s = pcmcia_get_socket(skt);
1377 1386
1378 if (!s) { 1387 if (!s) {
1379 printk(KERN_ERR "PCMCIA obtaining reference to socket %p " \ 1388 dev_printk(KERN_ERR, &skt->dev,
1380 "failed, event 0x%x lost!\n", skt, event); 1389 "PCMCIA obtaining reference to socket " \
1390 "failed, event 0x%x lost!\n", event);
1381 return -ENODEV; 1391 return -ENODEV;
1382 } 1392 }
1383 1393
1384 ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n", 1394 ds_dev_dbg(1, &skt->dev, "ds_event(0x%06x, %d, 0x%p)\n",
1385 event, priority, skt); 1395 event, priority, skt);
1386 1396
1387 switch (event) { 1397 switch (event) {
1388 case CS_EVENT_CARD_REMOVAL: 1398 case CS_EVENT_CARD_REMOVAL:
@@ -1457,7 +1467,8 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev,
1457 1467
1458 socket = pcmcia_get_socket(socket); 1468 socket = pcmcia_get_socket(socket);
1459 if (!socket) { 1469 if (!socket) {
1460 printk(KERN_ERR "PCMCIA obtaining reference to socket %p failed\n", socket); 1470 dev_printk(KERN_ERR, dev,
1471 "PCMCIA obtaining reference to socket failed\n");
1461 return -ENODEV; 1472 return -ENODEV;
1462 } 1473 }
1463 1474
@@ -1477,7 +1488,7 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev,
1477 1488
1478 ret = pccard_register_pcmcia(socket, &pcmcia_bus_callback); 1489 ret = pccard_register_pcmcia(socket, &pcmcia_bus_callback);
1479 if (ret) { 1490 if (ret) {
1480 printk(KERN_ERR "PCMCIA registration PCCard core failed for socket %p\n", socket); 1491 dev_printk(KERN_ERR, dev, "PCMCIA registration failed\n");
1481 pcmcia_put_socket(socket); 1492 pcmcia_put_socket(socket);
1482 return (ret); 1493 return (ret);
1483 } 1494 }
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c
index 68f6b2702bc4..71653ab84890 100644
--- a/drivers/pcmcia/i82365.c
+++ b/drivers/pcmcia/i82365.c
@@ -63,7 +63,7 @@
63#include "vg468.h" 63#include "vg468.h"
64#include "ricoh.h" 64#include "ricoh.h"
65 65
66#ifdef DEBUG 66#ifdef CONFIG_PCMCIA_DEBUG
67static const char version[] = 67static const char version[] =
68"i82365.c 1.265 1999/11/10 18:36:21 (David Hinds)"; 68"i82365.c 1.265 1999/11/10 18:36:21 (David Hinds)";
69 69
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c
index 3616da227152..2ab4f22c21de 100644
--- a/drivers/pcmcia/m32r_cfc.c
+++ b/drivers/pcmcia/m32r_cfc.c
@@ -38,7 +38,7 @@
38 38
39#include "m32r_cfc.h" 39#include "m32r_cfc.h"
40 40
41#ifdef DEBUG 41#ifdef CONFIG_PCMCIA_DEBUG
42static int m32r_cfc_debug; 42static int m32r_cfc_debug;
43module_param(m32r_cfc_debug, int, 0644); 43module_param(m32r_cfc_debug, int, 0644);
44#define debug(lvl, fmt, arg...) do { \ 44#define debug(lvl, fmt, arg...) do { \
@@ -505,7 +505,7 @@ static int _pcc_set_socket(u_short sock, socket_state_t *state)
505 pcc_set(sock,(unsigned int)PLD_CFBUFCR,1); 505 pcc_set(sock,(unsigned int)PLD_CFBUFCR,1);
506 } 506 }
507 507
508#ifdef DEBUG 508#ifdef CONFIG_PCMCIA_DEBUG
509 if(state->flags & SS_IOCARD){ 509 if(state->flags & SS_IOCARD){
510 debug(3, ":IOCARD"); 510 debug(3, ":IOCARD");
511 } 511 }
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c
index 2b42b7155e34..2f108c23dbd9 100644
--- a/drivers/pcmcia/m32r_pcc.c
+++ b/drivers/pcmcia/m32r_pcc.c
@@ -45,7 +45,7 @@
45 45
46#define PCC_DEBUG_DBEX 46#define PCC_DEBUG_DBEX
47 47
48#ifdef DEBUG 48#ifdef CONFIG_PCMCIA_DEBUG
49static int m32r_pcc_debug; 49static int m32r_pcc_debug;
50module_param(m32r_pcc_debug, int, 0644); 50module_param(m32r_pcc_debug, int, 0644);
51#define debug(lvl, fmt, arg...) do { \ 51#define debug(lvl, fmt, arg...) do { \
@@ -460,7 +460,7 @@ static int _pcc_set_socket(u_short sock, socket_state_t *state)
460 460
461 pcc_set(sock,PCCSIGCR,reg); 461 pcc_set(sock,PCCSIGCR,reg);
462 462
463#ifdef DEBUG 463#ifdef CONFIG_PCMCIA_DEBUG
464 if(state->flags & SS_IOCARD){ 464 if(state->flags & SS_IOCARD){
465 debug(3, ":IOCARD"); 465 debug(3, ":IOCARD");
466 } 466 }
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index ff66604e90d4..d1ad0966392d 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -64,8 +64,8 @@
64#include <pcmcia/cs.h> 64#include <pcmcia/cs.h>
65#include <pcmcia/ss.h> 65#include <pcmcia/ss.h>
66 66
67#ifdef PCMCIA_DEBUG 67#ifdef CONFIG_PCMCIA_DEBUG
68static int pc_debug = PCMCIA_DEBUG; 68static int pc_debug;
69module_param(pc_debug, int, 0); 69module_param(pc_debug, int, 0);
70#define dprintk(args...) printk(KERN_DEBUG "m8xx_pcmcia: " args); 70#define dprintk(args...) printk(KERN_DEBUG "m8xx_pcmcia: " args);
71#else 71#else
diff --git a/drivers/pcmcia/o2micro.h b/drivers/pcmcia/o2micro.h
index a234ce1967a3..5554015a7813 100644
--- a/drivers/pcmcia/o2micro.h
+++ b/drivers/pcmcia/o2micro.h
@@ -140,7 +140,8 @@ static int o2micro_override(struct yenta_socket *socket)
140 a = config_readb(socket, O2_RESERVED1); 140 a = config_readb(socket, O2_RESERVED1);
141 b = config_readb(socket, O2_RESERVED2); 141 b = config_readb(socket, O2_RESERVED2);
142 142
143 printk(KERN_INFO "Yenta O2: res at 0x94/0xD4: %02x/%02x\n", a, b); 143 dev_printk(KERN_INFO, &socket->dev->dev,
144 "O2: res at 0x94/0xD4: %02x/%02x\n", a, b);
144 145
145 switch (socket->dev->device) { 146 switch (socket->dev->device) {
146 /* 147 /*
@@ -153,7 +154,9 @@ static int o2micro_override(struct yenta_socket *socket)
153 case PCI_DEVICE_ID_O2_6812: 154 case PCI_DEVICE_ID_O2_6812:
154 case PCI_DEVICE_ID_O2_6832: 155 case PCI_DEVICE_ID_O2_6832:
155 case PCI_DEVICE_ID_O2_6836: 156 case PCI_DEVICE_ID_O2_6836:
156 printk(KERN_INFO "Yenta O2: old bridge, disabling read prefetch/write burst\n"); 157 dev_printk(KERN_INFO, &socket->dev->dev,
158 "Yenta O2: old bridge, disabling read "
159 "prefetch/write burst\n");
157 config_writeb(socket, O2_RESERVED1, 160 config_writeb(socket, O2_RESERVED1,
158 a & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST)); 161 a & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST));
159 config_writeb(socket, O2_RESERVED2, 162 config_writeb(socket, O2_RESERVED2,
@@ -161,7 +164,8 @@ static int o2micro_override(struct yenta_socket *socket)
161 break; 164 break;
162 165
163 default: 166 default:
164 printk(KERN_INFO "Yenta O2: enabling read prefetch/write burst\n"); 167 dev_printk(KERN_INFO , &socket->dev->dev,
168 "O2: enabling read prefetch/write burst\n");
165 config_writeb(socket, O2_RESERVED1, 169 config_writeb(socket, O2_RESERVED1,
166 a | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST); 170 a | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST);
167 config_writeb(socket, O2_RESERVED2, 171 config_writeb(socket, O2_RESERVED2,
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index 6c086ffea448..f555a505214f 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -58,7 +58,7 @@ typedef struct user_info_t {
58} user_info_t; 58} user_info_t;
59 59
60 60
61#ifdef DEBUG 61#ifdef CONFIG_PCMCIA_DEBUG
62extern int ds_pc_debug; 62extern int ds_pc_debug;
63 63
64#define ds_dbg(lvl, fmt, arg...) do { \ 64#define ds_dbg(lvl, fmt, arg...) do { \
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 4884a18cf9e6..9afe420c41f4 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -44,16 +44,17 @@ static u8 pcmcia_used_irq[NR_IRQS];
44#endif 44#endif
45 45
46 46
47#ifdef DEBUG 47#ifdef CONFIG_PCMCIA_DEBUG
48extern int ds_pc_debug; 48extern int ds_pc_debug;
49 49
50#define ds_dbg(skt, lvl, fmt, arg...) do { \ 50#define ds_dbg(skt, lvl, fmt, arg...) do { \
51 if (ds_pc_debug >= lvl) \ 51 if (ds_pc_debug >= lvl) \
52 printk(KERN_DEBUG "pcmcia_resource: %s: " fmt, \ 52 dev_printk(KERN_DEBUG, &skt->dev, \
53 cs_socket_name(skt) , ## arg); \ 53 "pcmcia_resource: " fmt, \
54 ## arg); \
54} while (0) 55} while (0)
55#else 56#else
56#define ds_dbg(lvl, fmt, arg...) do { } while (0) 57#define ds_dbg(skt, lvl, fmt, arg...) do { } while (0)
57#endif 58#endif
58 59
59 60
@@ -802,8 +803,10 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
802 /* Make sure the fact the request type was overridden is passed back */ 803 /* Make sure the fact the request type was overridden is passed back */
803 if (type == IRQF_SHARED && !(req->Attributes & IRQ_TYPE_DYNAMIC_SHARING)) { 804 if (type == IRQF_SHARED && !(req->Attributes & IRQ_TYPE_DYNAMIC_SHARING)) {
804 req->Attributes |= IRQ_TYPE_DYNAMIC_SHARING; 805 req->Attributes |= IRQ_TYPE_DYNAMIC_SHARING;
805 printk(KERN_WARNING "pcmcia: request for exclusive IRQ could not be fulfilled.\n"); 806 dev_printk(KERN_WARNING, &p_dev->dev, "pcmcia: "
806 printk(KERN_WARNING "pcmcia: the driver needs updating to supported shared IRQ lines.\n"); 807 "request for exclusive IRQ could not be fulfilled.\n");
808 dev_printk(KERN_WARNING, &p_dev->dev, "pcmcia: the driver "
809 "needs updating to supported shared IRQ lines.\n");
807 } 810 }
808 c->irq.Attributes = req->Attributes; 811 c->irq.Attributes = req->Attributes;
809 s->irq.AssignedIRQ = req->AssignedIRQ = irq; 812 s->irq.AssignedIRQ = req->AssignedIRQ = irq;
@@ -909,3 +912,79 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev) {
909 pcmcia_release_window(p_dev->win); 912 pcmcia_release_window(p_dev->win);
910} 913}
911EXPORT_SYMBOL(pcmcia_disable_device); 914EXPORT_SYMBOL(pcmcia_disable_device);
915
916
917struct pcmcia_cfg_mem {
918 tuple_t tuple;
919 cisparse_t parse;
920 u8 buf[256];
921 cistpl_cftable_entry_t dflt;
922};
923
924/**
925 * pcmcia_loop_config() - loop over configuration options
926 * @p_dev: the struct pcmcia_device which we need to loop for.
927 * @conf_check: function to call for each configuration option.
928 * It gets passed the struct pcmcia_device, the CIS data
929 * describing the configuration option, and private data
930 * being passed to pcmcia_loop_config()
931 * @priv_data: private data to be passed to the conf_check function.
932 *
933 * pcmcia_loop_config() loops over all configuration options, and calls
934 * the driver-specific conf_check() for each one, checking whether
935 * it is a valid one.
936 */
937int pcmcia_loop_config(struct pcmcia_device *p_dev,
938 int (*conf_check) (struct pcmcia_device *p_dev,
939 cistpl_cftable_entry_t *cfg,
940 cistpl_cftable_entry_t *dflt,
941 unsigned int vcc,
942 void *priv_data),
943 void *priv_data)
944{
945 struct pcmcia_cfg_mem *cfg_mem;
946
947 tuple_t *tuple;
948 int ret = -ENODEV;
949 unsigned int vcc;
950
951 cfg_mem = kzalloc(sizeof(struct pcmcia_cfg_mem), GFP_KERNEL);
952 if (cfg_mem == NULL)
953 return -ENOMEM;
954
955 /* get the current Vcc setting */
956 vcc = p_dev->socket->socket.Vcc;
957
958 tuple = &cfg_mem->tuple;
959 tuple->TupleData = cfg_mem->buf;
960 tuple->TupleDataMax = 255;
961 tuple->TupleOffset = 0;
962 tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY;
963 tuple->Attributes = 0;
964
965 ret = pcmcia_get_first_tuple(p_dev, tuple);
966 while (!ret) {
967 cistpl_cftable_entry_t *cfg = &cfg_mem->parse.cftable_entry;
968
969 if (pcmcia_get_tuple_data(p_dev, tuple))
970 goto next_entry;
971
972 if (pcmcia_parse_tuple(p_dev, tuple, &cfg_mem->parse))
973 goto next_entry;
974
975 /* default values */
976 p_dev->conf.ConfigIndex = cfg->index;
977 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
978 cfg_mem->dflt = *cfg;
979
980 ret = conf_check(p_dev, cfg, &cfg_mem->dflt, vcc, priv_data);
981 if (!ret)
982 break;
983
984next_entry:
985 ret = pcmcia_get_next_tuple(p_dev, tuple);
986 }
987
988 return ret;
989}
990EXPORT_SYMBOL(pcmcia_loop_config);
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index d0c1d63d1891..00aacbe731dc 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -194,13 +194,14 @@ static void do_io_probe(struct pcmcia_socket *s, unsigned int base,
194 int any; 194 int any;
195 u_char *b, hole, most; 195 u_char *b, hole, most;
196 196
197 printk(KERN_INFO "cs: IO port probe %#x-%#x:", 197 dev_printk(KERN_INFO, &s->dev, "cs: IO port probe %#x-%#x:",
198 base, base+num-1); 198 base, base+num-1);
199 199
200 /* First, what does a floating port look like? */ 200 /* First, what does a floating port look like? */
201 b = kzalloc(256, GFP_KERNEL); 201 b = kzalloc(256, GFP_KERNEL);
202 if (!b) { 202 if (!b) {
203 printk(KERN_ERR "do_io_probe: unable to kmalloc 256 bytes"); 203 dev_printk(KERN_ERR, &s->dev,
204 "do_io_probe: unable to kmalloc 256 bytes");
204 return; 205 return;
205 } 206 }
206 for (i = base, most = 0; i < base+num; i += 8) { 207 for (i = base, most = 0; i < base+num; i += 8) {
@@ -366,8 +367,8 @@ static int do_mem_probe(u_long base, u_long num, struct pcmcia_socket *s)
366 struct socket_data *s_data = s->resource_data; 367 struct socket_data *s_data = s->resource_data;
367 u_long i, j, bad, fail, step; 368 u_long i, j, bad, fail, step;
368 369
369 printk(KERN_INFO "cs: memory probe 0x%06lx-0x%06lx:", 370 dev_printk(KERN_INFO, &s->dev, "cs: memory probe 0x%06lx-0x%06lx:",
370 base, base+num-1); 371 base, base+num-1);
371 bad = fail = 0; 372 bad = fail = 0;
372 step = (num < 0x20000) ? 0x2000 : ((num>>4) & ~0x1fff); 373 step = (num < 0x20000) ? 0x2000 : ((num>>4) & ~0x1fff);
373 /* don't allow too large steps */ 374 /* don't allow too large steps */
@@ -431,8 +432,8 @@ static int validate_mem(struct pcmcia_socket *s, unsigned int probe_mask)
431 if (probe_mask & MEM_PROBE_HIGH) { 432 if (probe_mask & MEM_PROBE_HIGH) {
432 if (inv_probe(s_data->mem_db.next, s) > 0) 433 if (inv_probe(s_data->mem_db.next, s) > 0)
433 return 0; 434 return 0;
434 printk(KERN_NOTICE "cs: warning: no high memory space " 435 dev_printk(KERN_NOTICE, &s->dev,
435 "available!\n"); 436 "cs: warning: no high memory space available!\n");
436 return -ENODEV; 437 return -ENODEV;
437 } 438 }
438 439
@@ -794,10 +795,11 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s)
794 if (res->flags & IORESOURCE_IO) { 795 if (res->flags & IORESOURCE_IO) {
795 if (res == &ioport_resource) 796 if (res == &ioport_resource)
796 continue; 797 continue;
797 printk(KERN_INFO "pcmcia: parent PCI bridge I/O " 798 dev_printk(KERN_INFO, &s->cb_dev->dev,
798 "window: 0x%llx - 0x%llx\n", 799 "pcmcia: parent PCI bridge I/O "
799 (unsigned long long)res->start, 800 "window: 0x%llx - 0x%llx\n",
800 (unsigned long long)res->end); 801 (unsigned long long)res->start,
802 (unsigned long long)res->end);
801 if (!adjust_io(s, ADD_MANAGED_RESOURCE, res->start, res->end)) 803 if (!adjust_io(s, ADD_MANAGED_RESOURCE, res->start, res->end))
802 done |= IORESOURCE_IO; 804 done |= IORESOURCE_IO;
803 805
@@ -806,10 +808,11 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s)
806 if (res->flags & IORESOURCE_MEM) { 808 if (res->flags & IORESOURCE_MEM) {
807 if (res == &iomem_resource) 809 if (res == &iomem_resource)
808 continue; 810 continue;
809 printk(KERN_INFO "pcmcia: parent PCI bridge Memory " 811 dev_printk(KERN_INFO, &s->cb_dev->dev,
810 "window: 0x%llx - 0x%llx\n", 812 "pcmcia: parent PCI bridge Memory "
811 (unsigned long long)res->start, 813 "window: 0x%llx - 0x%llx\n",
812 (unsigned long long)res->end); 814 (unsigned long long)res->start,
815 (unsigned long long)res->end);
813 if (!adjust_memory(s, ADD_MANAGED_RESOURCE, res->start, res->end)) 816 if (!adjust_memory(s, ADD_MANAGED_RESOURCE, res->start, res->end))
814 done |= IORESOURCE_MEM; 817 done |= IORESOURCE_MEM;
815 } 818 }
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index 8c21446996f2..89edcbc3bfd2 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -54,7 +54,7 @@
54#include <asm/arch/pxa-regs.h> 54#include <asm/arch/pxa-regs.h>
55#endif 55#endif
56 56
57#ifdef DEBUG 57#ifdef CONFIG_PCMCIA_DEBUG
58 58
59static int pc_debug; 59static int pc_debug;
60module_param(pc_debug, int, 0644); 60module_param(pc_debug, int, 0644);
diff --git a/drivers/pcmcia/soc_common.h b/drivers/pcmcia/soc_common.h
index 91ef6a0da3ab..8e4cc92bbe73 100644
--- a/drivers/pcmcia/soc_common.h
+++ b/drivers/pcmcia/soc_common.h
@@ -137,7 +137,7 @@ extern int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_lev
137extern int soc_common_drv_pcmcia_remove(struct device *dev); 137extern int soc_common_drv_pcmcia_remove(struct device *dev);
138 138
139 139
140#ifdef DEBUG 140#ifdef CONFIG_PCMCIA_DEBUG
141 141
142extern void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func, 142extern void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func,
143 int lvl, const char *fmt, ...); 143 int lvl, const char *fmt, ...);
diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c
index 5792bd5c54f9..2a613e920fd4 100644
--- a/drivers/pcmcia/tcic.c
+++ b/drivers/pcmcia/tcic.c
@@ -55,7 +55,7 @@
55#include <pcmcia/ss.h> 55#include <pcmcia/ss.h>
56#include "tcic.h" 56#include "tcic.h"
57 57
58#ifdef DEBUG 58#ifdef CONFIG_PCMCIA_DEBUG
59static int pc_debug; 59static int pc_debug;
60 60
61module_param(pc_debug, int, 0644); 61module_param(pc_debug, int, 0644);
diff --git a/drivers/pcmcia/ti113x.h b/drivers/pcmcia/ti113x.h
index 129db7bd06c3..aaa70227bfb0 100644
--- a/drivers/pcmcia/ti113x.h
+++ b/drivers/pcmcia/ti113x.h
@@ -339,8 +339,8 @@ static void ti12xx_irqroute_func0(struct yenta_socket *socket)
339 339
340 mfunc = mfunc_old = config_readl(socket, TI122X_MFUNC); 340 mfunc = mfunc_old = config_readl(socket, TI122X_MFUNC);
341 devctl = config_readb(socket, TI113X_DEVICE_CONTROL); 341 devctl = config_readb(socket, TI113X_DEVICE_CONTROL);
342 printk(KERN_INFO "Yenta TI: socket %s, mfunc 0x%08x, devctl 0x%02x\n", 342 dev_printk(KERN_INFO, &socket->dev->dev,
343 pci_name(socket->dev), mfunc, devctl); 343 "TI: mfunc 0x%08x, devctl 0x%02x\n", mfunc, devctl);
344 344
345 /* make sure PCI interrupts are enabled before probing */ 345 /* make sure PCI interrupts are enabled before probing */
346 ti_init(socket); 346 ti_init(socket);
@@ -354,8 +354,8 @@ static void ti12xx_irqroute_func0(struct yenta_socket *socket)
354 * We're here which means PCI interrupts are _not_ delivered. try to 354 * We're here which means PCI interrupts are _not_ delivered. try to
355 * find the right setting (all serial or parallel) 355 * find the right setting (all serial or parallel)
356 */ 356 */
357 printk(KERN_INFO "Yenta TI: socket %s probing PCI interrupt failed, trying to fix\n", 357 dev_printk(KERN_INFO, &socket->dev->dev,
358 pci_name(socket->dev)); 358 "TI: probing PCI interrupt failed, trying to fix\n");
359 359
360 /* for serial PCI make sure MFUNC3 is set to IRQSER */ 360 /* for serial PCI make sure MFUNC3 is set to IRQSER */
361 if ((devctl & TI113X_DCR_IMODE_MASK) == TI12XX_DCR_IMODE_ALL_SERIAL) { 361 if ((devctl & TI113X_DCR_IMODE_MASK) == TI12XX_DCR_IMODE_ALL_SERIAL) {
@@ -379,8 +379,8 @@ static void ti12xx_irqroute_func0(struct yenta_socket *socket)
379 379
380 pci_irq_status = yenta_probe_cb_irq(socket); 380 pci_irq_status = yenta_probe_cb_irq(socket);
381 if (pci_irq_status == 1) { 381 if (pci_irq_status == 1) {
382 printk(KERN_INFO "Yenta TI: socket %s all-serial interrupts ok\n", 382 dev_printk(KERN_INFO, &socket->dev->dev,
383 pci_name(socket->dev)); 383 "TI: all-serial interrupts ok\n");
384 mfunc_old = mfunc; 384 mfunc_old = mfunc;
385 goto out; 385 goto out;
386 } 386 }
@@ -395,8 +395,8 @@ static void ti12xx_irqroute_func0(struct yenta_socket *socket)
395 } 395 }
396 396
397 /* serial PCI interrupts not working fall back to parallel */ 397 /* serial PCI interrupts not working fall back to parallel */
398 printk(KERN_INFO "Yenta TI: socket %s falling back to parallel PCI interrupts\n", 398 dev_printk(KERN_INFO, &socket->dev->dev,
399 pci_name(socket->dev)); 399 "TI: falling back to parallel PCI interrupts\n");
400 devctl &= ~TI113X_DCR_IMODE_MASK; 400 devctl &= ~TI113X_DCR_IMODE_MASK;
401 devctl |= TI113X_DCR_IMODE_SERIAL; /* serial ISA could be right */ 401 devctl |= TI113X_DCR_IMODE_SERIAL; /* serial ISA could be right */
402 config_writeb(socket, TI113X_DEVICE_CONTROL, devctl); 402 config_writeb(socket, TI113X_DEVICE_CONTROL, devctl);
@@ -427,8 +427,8 @@ static void ti12xx_irqroute_func0(struct yenta_socket *socket)
427 pci_irq_status = yenta_probe_cb_irq(socket); 427 pci_irq_status = yenta_probe_cb_irq(socket);
428 if (pci_irq_status == 1) { 428 if (pci_irq_status == 1) {
429 mfunc_old = mfunc; 429 mfunc_old = mfunc;
430 printk(KERN_INFO "Yenta TI: socket %s parallel PCI interrupts ok\n", 430 dev_printk(KERN_INFO, &socket->dev->dev,
431 pci_name(socket->dev)); 431 "TI: parallel PCI interrupts ok\n");
432 } else { 432 } else {
433 /* not working, back to old value */ 433 /* not working, back to old value */
434 mfunc = mfunc_old; 434 mfunc = mfunc_old;
@@ -440,8 +440,9 @@ static void ti12xx_irqroute_func0(struct yenta_socket *socket)
440out: 440out:
441 if (pci_irq_status < 1) { 441 if (pci_irq_status < 1) {
442 socket->cb_irq = 0; 442 socket->cb_irq = 0;
443 printk(KERN_INFO "Yenta TI: socket %s no PCI interrupts. Fish. Please report.\n", 443 dev_printk(KERN_INFO, &socket->dev->dev,
444 pci_name(socket->dev)); 444 "Yenta TI: no PCI interrupts. Fish. "
445 "Please report.\n");
445 } 446 }
446} 447}
447 448
@@ -513,8 +514,9 @@ static void ti12xx_irqroute_func1(struct yenta_socket *socket)
513 514
514 mfunc = mfunc_old = config_readl(socket, TI122X_MFUNC); 515 mfunc = mfunc_old = config_readl(socket, TI122X_MFUNC);
515 devctl = config_readb(socket, TI113X_DEVICE_CONTROL); 516 devctl = config_readb(socket, TI113X_DEVICE_CONTROL);
516 printk(KERN_INFO "Yenta TI: socket %s, mfunc 0x%08x, devctl 0x%02x\n", 517 dev_printk(KERN_INFO, &socket->dev->dev,
517 pci_name(socket->dev), mfunc, devctl); 518 "TI: mfunc 0x%08x, devctl 0x%02x\n",
519 mfunc, devctl);
518 520
519 /* if IRQs are configured as tied, align irq of func1 with func0 */ 521 /* if IRQs are configured as tied, align irq of func1 with func0 */
520 sysctl = config_readl(socket, TI113X_SYSTEM_CONTROL); 522 sysctl = config_readl(socket, TI113X_SYSTEM_CONTROL);
@@ -533,9 +535,8 @@ static void ti12xx_irqroute_func1(struct yenta_socket *socket)
533 * We're here which means PCI interrupts are _not_ delivered. try to 535 * We're here which means PCI interrupts are _not_ delivered. try to
534 * find the right setting 536 * find the right setting
535 */ 537 */
536 printk(KERN_INFO "Yenta TI: socket %s probing PCI interrupt failed, trying to fix\n", 538 dev_printk(KERN_INFO, &socket->dev->dev,
537 pci_name(socket->dev)); 539 "TI: probing PCI interrupt failed, trying to fix\n");
538
539 540
540 /* if all serial: set INTRTIE, probe again */ 541 /* if all serial: set INTRTIE, probe again */
541 if ((devctl & TI113X_DCR_IMODE_MASK) == TI12XX_DCR_IMODE_ALL_SERIAL) { 542 if ((devctl & TI113X_DCR_IMODE_MASK) == TI12XX_DCR_IMODE_ALL_SERIAL) {
@@ -544,8 +545,8 @@ static void ti12xx_irqroute_func1(struct yenta_socket *socket)
544 if (ti12xx_tie_interrupts(socket, &old_irq)) { 545 if (ti12xx_tie_interrupts(socket, &old_irq)) {
545 pci_irq_status = yenta_probe_cb_irq(socket); 546 pci_irq_status = yenta_probe_cb_irq(socket);
546 if (pci_irq_status == 1) { 547 if (pci_irq_status == 1) {
547 printk(KERN_INFO "Yenta TI: socket %s all-serial interrupts, tied ok\n", 548 dev_printk(KERN_INFO, &socket->dev->dev,
548 pci_name(socket->dev)); 549 "TI: all-serial interrupts, tied ok\n");
549 goto out; 550 goto out;
550 } 551 }
551 552
@@ -582,8 +583,8 @@ static void ti12xx_irqroute_func1(struct yenta_socket *socket)
582 583
583 pci_irq_status = yenta_probe_cb_irq(socket); 584 pci_irq_status = yenta_probe_cb_irq(socket);
584 if (pci_irq_status == 1) { 585 if (pci_irq_status == 1) {
585 printk(KERN_INFO "Yenta TI: socket %s parallel PCI interrupts ok\n", 586 dev_printk(KERN_INFO, &socket->dev->dev,
586 pci_name(socket->dev)); 587 "TI: parallel PCI interrupts ok\n");
587 goto out; 588 goto out;
588 } 589 }
589 590
@@ -593,13 +594,13 @@ static void ti12xx_irqroute_func1(struct yenta_socket *socket)
593 if (pci_irq_status == -1) 594 if (pci_irq_status == -1)
594 goto out; 595 goto out;
595 } 596 }
596 597
597 /* still nothing: set INTRTIE */ 598 /* still nothing: set INTRTIE */
598 if (ti12xx_tie_interrupts(socket, &old_irq)) { 599 if (ti12xx_tie_interrupts(socket, &old_irq)) {
599 pci_irq_status = yenta_probe_cb_irq(socket); 600 pci_irq_status = yenta_probe_cb_irq(socket);
600 if (pci_irq_status == 1) { 601 if (pci_irq_status == 1) {
601 printk(KERN_INFO "Yenta TI: socket %s parallel PCI interrupts, tied ok\n", 602 dev_printk(KERN_INFO, &socket->dev->dev,
602 pci_name(socket->dev)); 603 "TI: parallel PCI interrupts, tied ok\n");
603 goto out; 604 goto out;
604 } 605 }
605 606
@@ -610,8 +611,8 @@ static void ti12xx_irqroute_func1(struct yenta_socket *socket)
610out: 611out:
611 if (pci_irq_status < 1) { 612 if (pci_irq_status < 1) {
612 socket->cb_irq = 0; 613 socket->cb_irq = 0;
613 printk(KERN_INFO "Yenta TI: socket %s no PCI interrupts. Fish. Please report.\n", 614 dev_printk(KERN_INFO, &socket->dev->dev,
614 pci_name(socket->dev)); 615 "TI: no PCI interrupts. Fish. Please report.\n");
615 } 616 }
616} 617}
617 618
@@ -815,11 +816,13 @@ static int ti12xx_override(struct yenta_socket *socket)
815 /* make sure that memory burst is active */ 816 /* make sure that memory burst is active */
816 val_orig = val = config_readl(socket, TI113X_SYSTEM_CONTROL); 817 val_orig = val = config_readl(socket, TI113X_SYSTEM_CONTROL);
817 if (disable_clkrun && PCI_FUNC(socket->dev->devfn) == 0) { 818 if (disable_clkrun && PCI_FUNC(socket->dev->devfn) == 0) {
818 printk(KERN_INFO "Yenta: Disabling CLKRUN feature\n"); 819 dev_printk(KERN_INFO, &socket->dev->dev,
820 "Disabling CLKRUN feature\n");
819 val |= TI113X_SCR_KEEPCLK; 821 val |= TI113X_SCR_KEEPCLK;
820 } 822 }
821 if (!(val & TI122X_SCR_MRBURSTUP)) { 823 if (!(val & TI122X_SCR_MRBURSTUP)) {
822 printk(KERN_INFO "Yenta: Enabling burst memory read transactions\n"); 824 dev_printk(KERN_INFO, &socket->dev->dev,
825 "Enabling burst memory read transactions\n");
823 val |= TI122X_SCR_MRBURSTUP; 826 val |= TI122X_SCR_MRBURSTUP;
824 } 827 }
825 if (val_orig != val) 828 if (val_orig != val)
@@ -830,10 +833,12 @@ static int ti12xx_override(struct yenta_socket *socket)
830 * CSC interrupts to PCI rather than INTVAL. 833 * CSC interrupts to PCI rather than INTVAL.
831 */ 834 */
832 val = config_readb(socket, TI1250_DIAGNOSTIC); 835 val = config_readb(socket, TI1250_DIAGNOSTIC);
833 printk(KERN_INFO "Yenta: Using %s to route CSC interrupts to PCI\n", 836 dev_printk(KERN_INFO, &socket->dev->dev,
834 (val & TI1250_DIAG_PCI_CSC) ? "CSCINT" : "INTVAL"); 837 "Using %s to route CSC interrupts to PCI\n",
835 printk(KERN_INFO "Yenta: Routing CardBus interrupts to %s\n", 838 (val & TI1250_DIAG_PCI_CSC) ? "CSCINT" : "INTVAL");
836 (val & TI1250_DIAG_PCI_IREQ) ? "PCI" : "ISA"); 839 dev_printk(KERN_INFO, &socket->dev->dev,
840 "Routing CardBus interrupts to %s\n",
841 (val & TI1250_DIAG_PCI_IREQ) ? "PCI" : "ISA");
837 842
838 /* do irqrouting, depending on function */ 843 /* do irqrouting, depending on function */
839 if (PCI_FUNC(socket->dev->devfn) == 0) 844 if (PCI_FUNC(socket->dev->devfn) == 0)
@@ -858,8 +863,9 @@ static int ti1250_override(struct yenta_socket *socket)
858 diag |= TI1250_DIAG_PCI_CSC | TI1250_DIAG_PCI_IREQ; 863 diag |= TI1250_DIAG_PCI_CSC | TI1250_DIAG_PCI_IREQ;
859 864
860 if (diag != old) { 865 if (diag != old) {
861 printk(KERN_INFO "Yenta: adjusting diagnostic: %02x -> %02x\n", 866 dev_printk(KERN_INFO, &socket->dev->dev,
862 old, diag); 867 "adjusting diagnostic: %02x -> %02x\n",
868 old, diag);
863 config_writeb(socket, TI1250_DIAGNOSTIC, diag); 869 config_writeb(socket, TI1250_DIAGNOSTIC, diag);
864 } 870 }
865 871
@@ -924,7 +930,9 @@ static void ene_tune_bridge(struct pcmcia_socket *sock, struct pci_bus *bus)
924 /* default to clear TLTEnable bit, old behaviour */ 930 /* default to clear TLTEnable bit, old behaviour */
925 test_c9 &= ~ENE_TEST_C9_TLTENABLE; 931 test_c9 &= ~ENE_TEST_C9_TLTENABLE;
926 932
927 printk(KERN_INFO "yenta EnE: chaning testregister 0xC9, %02x -> %02x\n", old_c9, test_c9); 933 dev_printk(KERN_INFO, &socket->dev->dev,
934 "EnE: chaning testregister 0xC9, %02x -> %02x\n",
935 old_c9, test_c9);
928 config_writeb(socket, ENE_TEST_C9, test_c9); 936 config_writeb(socket, ENE_TEST_C9, test_c9);
929} 937}
930 938
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 0ab1fb65cdc3..3ecd7c99d8eb 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -38,11 +38,7 @@ static int pwr_irqs_off;
38module_param(pwr_irqs_off, bool, 0644); 38module_param(pwr_irqs_off, bool, 0644);
39MODULE_PARM_DESC(pwr_irqs_off, "Force IRQs off during power-on of slot. Use only when seeing IRQ storms!"); 39MODULE_PARM_DESC(pwr_irqs_off, "Force IRQs off during power-on of slot. Use only when seeing IRQ storms!");
40 40
41#if 0 41#define debug(x, s, args...) dev_dbg(&s->dev->dev, x, ##args)
42#define debug(x,args...) printk(KERN_DEBUG "%s: " x, __func__ , ##args)
43#else
44#define debug(x,args...)
45#endif
46 42
47/* Don't ask.. */ 43/* Don't ask.. */
48#define to_cycles(ns) ((ns)/120) 44#define to_cycles(ns) ((ns)/120)
@@ -69,13 +65,13 @@ MODULE_PARM_DESC (override_bios, "yenta ignore bios resource allocation");
69static inline u32 cb_readl(struct yenta_socket *socket, unsigned reg) 65static inline u32 cb_readl(struct yenta_socket *socket, unsigned reg)
70{ 66{
71 u32 val = readl(socket->base + reg); 67 u32 val = readl(socket->base + reg);
72 debug("%p %04x %08x\n", socket, reg, val); 68 debug("%04x %08x\n", socket, reg, val);
73 return val; 69 return val;
74} 70}
75 71
76static inline void cb_writel(struct yenta_socket *socket, unsigned reg, u32 val) 72static inline void cb_writel(struct yenta_socket *socket, unsigned reg, u32 val)
77{ 73{
78 debug("%p %04x %08x\n", socket, reg, val); 74 debug("%04x %08x\n", socket, reg, val);
79 writel(val, socket->base + reg); 75 writel(val, socket->base + reg);
80 readl(socket->base + reg); /* avoid problems with PCI write posting */ 76 readl(socket->base + reg); /* avoid problems with PCI write posting */
81} 77}
@@ -84,7 +80,7 @@ static inline u8 config_readb(struct yenta_socket *socket, unsigned offset)
84{ 80{
85 u8 val; 81 u8 val;
86 pci_read_config_byte(socket->dev, offset, &val); 82 pci_read_config_byte(socket->dev, offset, &val);
87 debug("%p %04x %02x\n", socket, offset, val); 83 debug("%04x %02x\n", socket, offset, val);
88 return val; 84 return val;
89} 85}
90 86
@@ -92,7 +88,7 @@ static inline u16 config_readw(struct yenta_socket *socket, unsigned offset)
92{ 88{
93 u16 val; 89 u16 val;
94 pci_read_config_word(socket->dev, offset, &val); 90 pci_read_config_word(socket->dev, offset, &val);
95 debug("%p %04x %04x\n", socket, offset, val); 91 debug("%04x %04x\n", socket, offset, val);
96 return val; 92 return val;
97} 93}
98 94
@@ -100,32 +96,32 @@ static inline u32 config_readl(struct yenta_socket *socket, unsigned offset)
100{ 96{
101 u32 val; 97 u32 val;
102 pci_read_config_dword(socket->dev, offset, &val); 98 pci_read_config_dword(socket->dev, offset, &val);
103 debug("%p %04x %08x\n", socket, offset, val); 99 debug("%04x %08x\n", socket, offset, val);
104 return val; 100 return val;
105} 101}
106 102
107static inline void config_writeb(struct yenta_socket *socket, unsigned offset, u8 val) 103static inline void config_writeb(struct yenta_socket *socket, unsigned offset, u8 val)
108{ 104{
109 debug("%p %04x %02x\n", socket, offset, val); 105 debug("%04x %02x\n", socket, offset, val);
110 pci_write_config_byte(socket->dev, offset, val); 106 pci_write_config_byte(socket->dev, offset, val);
111} 107}
112 108
113static inline void config_writew(struct yenta_socket *socket, unsigned offset, u16 val) 109static inline void config_writew(struct yenta_socket *socket, unsigned offset, u16 val)
114{ 110{
115 debug("%p %04x %04x\n", socket, offset, val); 111 debug("%04x %04x\n", socket, offset, val);
116 pci_write_config_word(socket->dev, offset, val); 112 pci_write_config_word(socket->dev, offset, val);
117} 113}
118 114
119static inline void config_writel(struct yenta_socket *socket, unsigned offset, u32 val) 115static inline void config_writel(struct yenta_socket *socket, unsigned offset, u32 val)
120{ 116{
121 debug("%p %04x %08x\n", socket, offset, val); 117 debug("%04x %08x\n", socket, offset, val);
122 pci_write_config_dword(socket->dev, offset, val); 118 pci_write_config_dword(socket->dev, offset, val);
123} 119}
124 120
125static inline u8 exca_readb(struct yenta_socket *socket, unsigned reg) 121static inline u8 exca_readb(struct yenta_socket *socket, unsigned reg)
126{ 122{
127 u8 val = readb(socket->base + 0x800 + reg); 123 u8 val = readb(socket->base + 0x800 + reg);
128 debug("%p %04x %02x\n", socket, reg, val); 124 debug("%04x %02x\n", socket, reg, val);
129 return val; 125 return val;
130} 126}
131 127
@@ -134,20 +130,20 @@ static inline u8 exca_readw(struct yenta_socket *socket, unsigned reg)
134 u16 val; 130 u16 val;
135 val = readb(socket->base + 0x800 + reg); 131 val = readb(socket->base + 0x800 + reg);
136 val |= readb(socket->base + 0x800 + reg + 1) << 8; 132 val |= readb(socket->base + 0x800 + reg + 1) << 8;
137 debug("%p %04x %04x\n", socket, reg, val); 133 debug("%04x %04x\n", socket, reg, val);
138 return val; 134 return val;
139} 135}
140 136
141static inline void exca_writeb(struct yenta_socket *socket, unsigned reg, u8 val) 137static inline void exca_writeb(struct yenta_socket *socket, unsigned reg, u8 val)
142{ 138{
143 debug("%p %04x %02x\n", socket, reg, val); 139 debug("%04x %02x\n", socket, reg, val);
144 writeb(val, socket->base + 0x800 + reg); 140 writeb(val, socket->base + 0x800 + reg);
145 readb(socket->base + 0x800 + reg); /* PCI write posting... */ 141 readb(socket->base + 0x800 + reg); /* PCI write posting... */
146} 142}
147 143
148static void exca_writew(struct yenta_socket *socket, unsigned reg, u16 val) 144static void exca_writew(struct yenta_socket *socket, unsigned reg, u16 val)
149{ 145{
150 debug("%p %04x %04x\n", socket, reg, val); 146 debug("%04x %04x\n", socket, reg, val);
151 writeb(val, socket->base + 0x800 + reg); 147 writeb(val, socket->base + 0x800 + reg);
152 writeb(val >> 8, socket->base + 0x800 + reg + 1); 148 writeb(val >> 8, socket->base + 0x800 + reg + 1);
153 149
@@ -207,7 +203,7 @@ static int yenta_get_status(struct pcmcia_socket *sock, unsigned int *value)
207 203
208 204
209 if (state & CB_CBCARD) { 205 if (state & CB_CBCARD) {
210 val |= SS_CARDBUS; 206 val |= SS_CARDBUS;
211 val |= (state & CB_CARDSTS) ? SS_STSCHG : 0; 207 val |= (state & CB_CARDSTS) ? SS_STSCHG : 0;
212 val |= (state & (CB_CDETECT1 | CB_CDETECT2)) ? 0 : SS_DETECT; 208 val |= (state & (CB_CDETECT1 | CB_CDETECT2)) ? 0 : SS_DETECT;
213 val |= (state & CB_PWRCYCLE) ? SS_POWERON | SS_READY : 0; 209 val |= (state & CB_PWRCYCLE) ? SS_POWERON | SS_READY : 0;
@@ -650,8 +646,10 @@ static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type
650 root = pci_find_parent_resource(socket->dev, res); 646 root = pci_find_parent_resource(socket->dev, res);
651 if (root && (request_resource(root, res) == 0)) 647 if (root && (request_resource(root, res) == 0))
652 return 0; 648 return 0;
653 printk(KERN_INFO "yenta %s: Preassigned resource %d busy or not available, reconfiguring...\n", 649 dev_printk(KERN_INFO, &socket->dev->dev,
654 pci_name(socket->dev), nr); 650 "Preassigned resource %d busy or not available, "
651 "reconfiguring...\n",
652 nr);
655 } 653 }
656 654
657 if (type & IORESOURCE_IO) { 655 if (type & IORESOURCE_IO) {
@@ -674,8 +672,9 @@ static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type
674 return 1; 672 return 1;
675 } 673 }
676 674
677 printk(KERN_INFO "yenta %s: no resource of type %x available, trying to continue...\n", 675 dev_printk(KERN_INFO, &socket->dev->dev,
678 pci_name(socket->dev), type); 676 "no resource of type %x available, trying to continue...\n",
677 type);
679 res->start = res->end = res->flags = 0; 678 res->start = res->end = res->flags = 0;
680 return 0; 679 return 0;
681} 680}
@@ -923,7 +922,8 @@ static int yenta_probe_cb_irq(struct yenta_socket *socket)
923 socket->probe_status = 0; 922 socket->probe_status = 0;
924 923
925 if (request_irq(socket->cb_irq, yenta_probe_handler, IRQF_SHARED, "yenta", socket)) { 924 if (request_irq(socket->cb_irq, yenta_probe_handler, IRQF_SHARED, "yenta", socket)) {
926 printk(KERN_WARNING "Yenta: request_irq() in yenta_probe_cb_irq() failed!\n"); 925 dev_printk(KERN_WARNING, &socket->dev->dev,
926 "request_irq() in yenta_probe_cb_irq() failed!\n");
927 return -1; 927 return -1;
928 } 928 }
929 929
@@ -960,8 +960,9 @@ static void yenta_get_socket_capabilities(struct yenta_socket *socket, u32 isa_i
960 else 960 else
961 socket->socket.irq_mask = 0; 961 socket->socket.irq_mask = 0;
962 962
963 printk(KERN_INFO "Yenta: ISA IRQ mask 0x%04x, PCI irq %d\n", 963 dev_printk(KERN_INFO, &socket->dev->dev,
964 socket->socket.irq_mask, socket->cb_irq); 964 "ISA IRQ mask 0x%04x, PCI irq %d\n",
965 socket->socket.irq_mask, socket->cb_irq);
965} 966}
966 967
967/* 968/*
@@ -1051,8 +1052,9 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge)
1051 1052
1052 /* Show that the wanted subordinate number is not possible: */ 1053 /* Show that the wanted subordinate number is not possible: */
1053 if (cardbus_bridge->subordinate > upper_limit) 1054 if (cardbus_bridge->subordinate > upper_limit)
1054 printk(KERN_WARNING "Yenta: Upper limit for fixing this " 1055 dev_printk(KERN_WARNING, &cardbus_bridge->dev,
1055 "bridge's parent bridge: #%02x\n", upper_limit); 1056 "Upper limit for fixing this "
1057 "bridge's parent bridge: #%02x\n", upper_limit);
1056 1058
1057 /* If we have room to increase the bridge's subordinate number, */ 1059 /* If we have room to increase the bridge's subordinate number, */
1058 if (bridge_to_fix->subordinate < upper_limit) { 1060 if (bridge_to_fix->subordinate < upper_limit) {
@@ -1061,10 +1063,11 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge)
1061 unsigned char subordinate_to_assign = 1063 unsigned char subordinate_to_assign =
1062 min(cardbus_bridge->subordinate, upper_limit); 1064 min(cardbus_bridge->subordinate, upper_limit);
1063 1065
1064 printk(KERN_INFO "Yenta: Raising subordinate bus# of parent " 1066 dev_printk(KERN_INFO, &bridge_to_fix->dev,
1065 "bus (#%02x) from #%02x to #%02x\n", 1067 "Raising subordinate bus# of parent "
1066 bridge_to_fix->number, 1068 "bus (#%02x) from #%02x to #%02x\n",
1067 bridge_to_fix->subordinate, subordinate_to_assign); 1069 bridge_to_fix->number,
1070 bridge_to_fix->subordinate, subordinate_to_assign);
1068 1071
1069 /* Save the new subordinate in the bus struct of the bridge */ 1072 /* Save the new subordinate in the bus struct of the bridge */
1070 bridge_to_fix->subordinate = subordinate_to_assign; 1073 bridge_to_fix->subordinate = subordinate_to_assign;
@@ -1091,8 +1094,8 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1091 * Bail out if so. 1094 * Bail out if so.
1092 */ 1095 */
1093 if (!dev->subordinate) { 1096 if (!dev->subordinate) {
1094 printk(KERN_ERR "Yenta: no bus associated with %s! " 1097 dev_printk(KERN_ERR, &dev->dev, "no bus associated! "
1095 "(try 'pci=assign-busses')\n", pci_name(dev)); 1098 "(try 'pci=assign-busses')\n");
1096 return -ENODEV; 1099 return -ENODEV;
1097 } 1100 }
1098 1101
@@ -1127,7 +1130,7 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1127 goto disable; 1130 goto disable;
1128 1131
1129 if (!pci_resource_start(dev, 0)) { 1132 if (!pci_resource_start(dev, 0)) {
1130 printk(KERN_ERR "No cardbus resource!\n"); 1133 dev_printk(KERN_ERR, &dev->dev, "No cardbus resource!\n");
1131 ret = -ENODEV; 1134 ret = -ENODEV;
1132 goto release; 1135 goto release;
1133 } 1136 }
@@ -1146,8 +1149,8 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1146 * report the subsystem vendor and device for help debugging 1149 * report the subsystem vendor and device for help debugging
1147 * the irq stuff... 1150 * the irq stuff...
1148 */ 1151 */
1149 printk(KERN_INFO "Yenta: CardBus bridge found at %s [%04x:%04x]\n", 1152 dev_printk(KERN_INFO, &dev->dev, "CardBus bridge found [%04x:%04x]\n",
1150 pci_name(dev), dev->subsystem_vendor, dev->subsystem_device); 1153 dev->subsystem_vendor, dev->subsystem_device);
1151 1154
1152 yenta_config_init(socket); 1155 yenta_config_init(socket);
1153 1156
@@ -1179,8 +1182,12 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1179 socket->poll_timer.data = (unsigned long)socket; 1182 socket->poll_timer.data = (unsigned long)socket;
1180 socket->poll_timer.expires = jiffies + HZ; 1183 socket->poll_timer.expires = jiffies + HZ;
1181 add_timer(&socket->poll_timer); 1184 add_timer(&socket->poll_timer);
1182 printk(KERN_INFO "Yenta: no PCI IRQ, CardBus support disabled for this socket.\n" 1185 dev_printk(KERN_INFO, &dev->dev,
1183 KERN_INFO "Yenta: check your BIOS CardBus, BIOS IRQ or ACPI settings.\n"); 1186 "no PCI IRQ, CardBus support disabled for this "
1187 "socket.\n");
1188 dev_printk(KERN_INFO, &dev->dev,
1189 "check your BIOS CardBus, BIOS IRQ or ACPI "
1190 "settings.\n");
1184 } else { 1191 } else {
1185 socket->socket.features |= SS_CAP_CARDBUS; 1192 socket->socket.features |= SS_CAP_CARDBUS;
1186 } 1193 }
@@ -1188,7 +1195,8 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1188 /* Figure out what the dang thing can do for the PCMCIA layer... */ 1195 /* Figure out what the dang thing can do for the PCMCIA layer... */
1189 yenta_interrogate(socket); 1196 yenta_interrogate(socket);
1190 yenta_get_socket_capabilities(socket, isa_interrupts); 1197 yenta_get_socket_capabilities(socket, isa_interrupts);
1191 printk(KERN_INFO "Socket status: %08x\n", cb_readl(socket, CB_SOCKET_STATE)); 1198 dev_printk(KERN_INFO, &dev->dev,
1199 "Socket status: %08x\n", cb_readl(socket, CB_SOCKET_STATE));
1192 1200
1193 yenta_fixup_parent_bridge(dev->subordinate); 1201 yenta_fixup_parent_bridge(dev->subordinate);
1194 1202