aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/ds.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/ds.c')
-rw-r--r--drivers/pcmcia/ds.c149
1 files changed, 75 insertions, 74 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 4174d9656e35..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))
@@ -854,17 +864,17 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)
854 int ret = -ENOMEM; 864 int ret = -ENOMEM;
855 int no_funcs; 865 int no_funcs;
856 int old_funcs; 866 int old_funcs;
857 cisdump_t *cis;
858 cistpl_longlink_mfc_t mfc; 867 cistpl_longlink_mfc_t mfc;
859 868
860 if (!filename) 869 if (!filename)
861 return -EINVAL; 870 return -EINVAL;
862 871
863 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);
864 873
865 if (strlen(filename) > (FIRMWARE_NAME_MAX - 1)) { 874 if (strlen(filename) > (FIRMWARE_NAME_MAX - 1)) {
866 printk(KERN_WARNING "pcmcia: CIS filename is too long [%s]\n", 875 dev_printk(KERN_WARNING, &dev->dev,
867 filename); 876 "pcmcia: CIS filename is too long [%s]\n",
877 filename);
868 return -EINVAL; 878 return -EINVAL;
869 } 879 }
870 880
@@ -873,23 +883,16 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)
873 if (request_firmware(&fw, path, &dev->dev) == 0) { 883 if (request_firmware(&fw, path, &dev->dev) == 0) {
874 if (fw->size >= CISTPL_MAX_CIS_SIZE) { 884 if (fw->size >= CISTPL_MAX_CIS_SIZE) {
875 ret = -EINVAL; 885 ret = -EINVAL;
876 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");
877 goto release; 888 goto release;
878 } 889 }
879 890
880 cis = kzalloc(sizeof(cisdump_t), GFP_KERNEL); 891 if (!pcmcia_replace_cis(s, fw->data, fw->size))
881 if (!cis) {
882 ret = -ENOMEM;
883 goto release;
884 }
885
886 cis->Length = fw->size + 1;
887 memcpy(cis->Data, fw->data, fw->size);
888
889 if (!pcmcia_replace_cis(s, cis))
890 ret = 0; 892 ret = 0;
891 else { 893 else {
892 printk(KERN_ERR "pcmcia: CIS override failed\n"); 894 dev_printk(KERN_ERR, &dev->dev,
895 "pcmcia: CIS override failed\n");
893 goto release; 896 goto release;
894 } 897 }
895 898
@@ -993,14 +996,14 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
993 * after it has re-checked that there is no possible module 996 * after it has re-checked that there is no possible module
994 * with a prod_id/manf_id/card_id match. 997 * with a prod_id/manf_id/card_id match.
995 */ 998 */
996 ds_dbg(0, "skipping FUNC_ID match for %s until userspace " 999 ds_dev_dbg(0, &dev->dev,
997 "interaction\n", dev->dev.bus_id); 1000 "skipping FUNC_ID match until userspace interaction\n");
998 if (!dev->allow_func_id_match) 1001 if (!dev->allow_func_id_match)
999 return 0; 1002 return 0;
1000 } 1003 }
1001 1004
1002 if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { 1005 if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) {
1003 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");
1004 if (!dev->socket->fake_cis) 1007 if (!dev->socket->fake_cis)
1005 pcmcia_load_firmware(dev, did->cisfile); 1008 pcmcia_load_firmware(dev, did->cisfile);
1006 1009
@@ -1032,11 +1035,9 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) {
1032 /* match dynamic devices first */ 1035 /* match dynamic devices first */
1033 spin_lock(&p_drv->dynids.lock); 1036 spin_lock(&p_drv->dynids.lock);
1034 list_for_each_entry(dynid, &p_drv->dynids.list, node) { 1037 list_for_each_entry(dynid, &p_drv->dynids.list, node) {
1035 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);
1036 drv->name);
1037 if (pcmcia_devmatch(p_dev, &dynid->id)) { 1039 if (pcmcia_devmatch(p_dev, &dynid->id)) {
1038 ds_dbg(0, "matched %s to %s\n", dev->bus_id, 1040 ds_dev_dbg(0, dev, "matched to %s\n", drv->name);
1039 drv->name);
1040 spin_unlock(&p_drv->dynids.lock); 1041 spin_unlock(&p_drv->dynids.lock);
1041 return 1; 1042 return 1;
1042 } 1043 }
@@ -1046,18 +1047,15 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) {
1046#ifdef CONFIG_PCMCIA_IOCTL 1047#ifdef CONFIG_PCMCIA_IOCTL
1047 /* matching by cardmgr */ 1048 /* matching by cardmgr */
1048 if (p_dev->cardmgr == p_drv) { 1049 if (p_dev->cardmgr == p_drv) {
1049 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);
1050 drv->name);
1051 return 1; 1051 return 1;
1052 } 1052 }
1053#endif 1053#endif
1054 1054
1055 while (did && did->match_flags) { 1055 while (did && did->match_flags) {
1056 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);
1057 drv->name);
1058 if (pcmcia_devmatch(p_dev, did)) { 1057 if (pcmcia_devmatch(p_dev, did)) {
1059 ds_dbg(0, "matched %s to %s\n", dev->bus_id, 1058 ds_dev_dbg(0, dev, "matched to %s\n", drv->name);
1060 drv->name);
1061 return 1; 1059 return 1;
1062 } 1060 }
1063 did++; 1061 did++;
@@ -1263,7 +1261,7 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state)
1263 if (p_dev->suspended) 1261 if (p_dev->suspended)
1264 return 0; 1262 return 0;
1265 1263
1266 ds_dbg(2, "suspending %s\n", dev->bus_id); 1264 ds_dev_dbg(2, dev, "suspending\n");
1267 1265
1268 if (dev->driver) 1266 if (dev->driver)
1269 p_drv = to_pcmcia_drv(dev->driver); 1267 p_drv = to_pcmcia_drv(dev->driver);
@@ -1274,15 +1272,16 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state)
1274 if (p_drv->suspend) { 1272 if (p_drv->suspend) {
1275 ret = p_drv->suspend(p_dev); 1273 ret = p_drv->suspend(p_dev);
1276 if (ret) { 1274 if (ret) {
1277 printk(KERN_ERR "pcmcia: device %s (driver %s) did " 1275 dev_printk(KERN_ERR, dev,
1278 "not want to go to sleep (%d)\n", 1276 "pcmcia: device %s (driver %s) did "
1279 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);
1280 goto out; 1279 goto out;
1281 } 1280 }
1282 } 1281 }
1283 1282
1284 if (p_dev->device_no == p_dev->func) { 1283 if (p_dev->device_no == p_dev->func) {
1285 ds_dbg(2, "releasing configuration for %s\n", dev->bus_id); 1284 ds_dev_dbg(2, dev, "releasing configuration\n");
1286 pcmcia_release_configuration(p_dev); 1285 pcmcia_release_configuration(p_dev);
1287 } 1286 }
1288 1287
@@ -1302,7 +1301,7 @@ static int pcmcia_dev_resume(struct device * dev)
1302 if (!p_dev->suspended) 1301 if (!p_dev->suspended)
1303 return 0; 1302 return 0;
1304 1303
1305 ds_dbg(2, "resuming %s\n", dev->bus_id); 1304 ds_dev_dbg(2, dev, "resuming\n");
1306 1305
1307 if (dev->driver) 1306 if (dev->driver)
1308 p_drv = to_pcmcia_drv(dev->driver); 1307 p_drv = to_pcmcia_drv(dev->driver);
@@ -1311,7 +1310,7 @@ static int pcmcia_dev_resume(struct device * dev)
1311 goto out; 1310 goto out;
1312 1311
1313 if (p_dev->device_no == p_dev->func) { 1312 if (p_dev->device_no == p_dev->func) {
1314 ds_dbg(2, "requesting configuration for %s\n", dev->bus_id); 1313 ds_dev_dbg(2, dev, "requesting configuration\n");
1315 ret = pcmcia_request_configuration(p_dev, &p_dev->conf); 1314 ret = pcmcia_request_configuration(p_dev, &p_dev->conf);
1316 if (ret) 1315 if (ret)
1317 goto out; 1316 goto out;
@@ -1353,14 +1352,14 @@ static int pcmcia_bus_resume_callback(struct device *dev, void * _data)
1353 1352
1354static int pcmcia_bus_resume(struct pcmcia_socket *skt) 1353static int pcmcia_bus_resume(struct pcmcia_socket *skt)
1355{ 1354{
1356 ds_dbg(2, "resuming socket %d\n", skt->sock); 1355 ds_dev_dbg(2, &skt->dev, "resuming socket %d\n", skt->sock);
1357 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);
1358 return 0; 1357 return 0;
1359} 1358}
1360 1359
1361static int pcmcia_bus_suspend(struct pcmcia_socket *skt) 1360static int pcmcia_bus_suspend(struct pcmcia_socket *skt)
1362{ 1361{
1363 ds_dbg(2, "suspending socket %d\n", skt->sock); 1362 ds_dev_dbg(2, &skt->dev, "suspending socket %d\n", skt->sock);
1364 if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt, 1363 if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt,
1365 pcmcia_bus_suspend_callback)) { 1364 pcmcia_bus_suspend_callback)) {
1366 pcmcia_bus_resume(skt); 1365 pcmcia_bus_resume(skt);
@@ -1386,13 +1385,14 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
1386 struct pcmcia_socket *s = pcmcia_get_socket(skt); 1385 struct pcmcia_socket *s = pcmcia_get_socket(skt);
1387 1386
1388 if (!s) { 1387 if (!s) {
1389 printk(KERN_ERR "PCMCIA obtaining reference to socket %p " \ 1388 dev_printk(KERN_ERR, &skt->dev,
1390 "failed, event 0x%x lost!\n", skt, event); 1389 "PCMCIA obtaining reference to socket " \
1390 "failed, event 0x%x lost!\n", event);
1391 return -ENODEV; 1391 return -ENODEV;
1392 } 1392 }
1393 1393
1394 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",
1395 event, priority, skt); 1395 event, priority, skt);
1396 1396
1397 switch (event) { 1397 switch (event) {
1398 case CS_EVENT_CARD_REMOVAL: 1398 case CS_EVENT_CARD_REMOVAL:
@@ -1467,7 +1467,8 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev,
1467 1467
1468 socket = pcmcia_get_socket(socket); 1468 socket = pcmcia_get_socket(socket);
1469 if (!socket) { 1469 if (!socket) {
1470 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");
1471 return -ENODEV; 1472 return -ENODEV;
1472 } 1473 }
1473 1474
@@ -1487,7 +1488,7 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev,
1487 1488
1488 ret = pccard_register_pcmcia(socket, &pcmcia_bus_callback); 1489 ret = pccard_register_pcmcia(socket, &pcmcia_bus_callback);
1489 if (ret) { 1490 if (ret) {
1490 printk(KERN_ERR "PCMCIA registration PCCard core failed for socket %p\n", socket); 1491 dev_printk(KERN_ERR, dev, "PCMCIA registration failed\n");
1491 pcmcia_put_socket(socket); 1492 pcmcia_put_socket(socket);
1492 return (ret); 1493 return (ret);
1493 } 1494 }