diff options
-rw-r--r-- | drivers/pcmcia/ds.c | 135 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_resource.c | 13 |
2 files changed, 81 insertions, 67 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 4174d9656e35..57e462e1c592 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -48,11 +48,16 @@ int ds_pc_debug; | |||
48 | module_param_named(pc_debug, ds_pc_debug, int, 0644); | 48 | module_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 | ||
58 | spinlock_t pcmcia_dev_list_lock; | 63 | spinlock_t pcmcia_dev_list_lock; |
@@ -391,7 +396,7 @@ static void pcmcia_release_function(struct kref *ref) | |||
391 | static void pcmcia_release_dev(struct device *dev) | 396 | static 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) | |||
401 | static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc) | 406 | static 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)) |
@@ -860,11 +870,12 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | |||
860 | if (!filename) | 870 | if (!filename) |
861 | return -EINVAL; | 871 | return -EINVAL; |
862 | 872 | ||
863 | ds_dbg(1, "trying to load CIS file %s\n", filename); | 873 | ds_dev_dbg(1, &dev->dev, "trying to load CIS file %s\n", filename); |
864 | 874 | ||
865 | if (strlen(filename) > (FIRMWARE_NAME_MAX - 1)) { | 875 | if (strlen(filename) > (FIRMWARE_NAME_MAX - 1)) { |
866 | printk(KERN_WARNING "pcmcia: CIS filename is too long [%s]\n", | 876 | dev_printk(KERN_WARNING, &dev->dev, |
867 | filename); | 877 | "pcmcia: CIS filename is too long [%s]\n", |
878 | filename); | ||
868 | return -EINVAL; | 879 | return -EINVAL; |
869 | } | 880 | } |
870 | 881 | ||
@@ -873,7 +884,8 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | |||
873 | if (request_firmware(&fw, path, &dev->dev) == 0) { | 884 | if (request_firmware(&fw, path, &dev->dev) == 0) { |
874 | if (fw->size >= CISTPL_MAX_CIS_SIZE) { | 885 | if (fw->size >= CISTPL_MAX_CIS_SIZE) { |
875 | ret = -EINVAL; | 886 | ret = -EINVAL; |
876 | printk(KERN_ERR "pcmcia: CIS override is too big\n"); | 887 | dev_printk(KERN_ERR, &dev->dev, |
888 | "pcmcia: CIS override is too big\n"); | ||
877 | goto release; | 889 | goto release; |
878 | } | 890 | } |
879 | 891 | ||
@@ -889,7 +901,8 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | |||
889 | if (!pcmcia_replace_cis(s, cis)) | 901 | if (!pcmcia_replace_cis(s, cis)) |
890 | ret = 0; | 902 | ret = 0; |
891 | else { | 903 | else { |
892 | printk(KERN_ERR "pcmcia: CIS override failed\n"); | 904 | dev_printk(KERN_ERR, &dev->dev, |
905 | "pcmcia: CIS override failed\n"); | ||
893 | goto release; | 906 | goto release; |
894 | } | 907 | } |
895 | 908 | ||
@@ -993,14 +1006,14 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev, | |||
993 | * after it has re-checked that there is no possible module | 1006 | * after it has re-checked that there is no possible module |
994 | * with a prod_id/manf_id/card_id match. | 1007 | * with a prod_id/manf_id/card_id match. |
995 | */ | 1008 | */ |
996 | ds_dbg(0, "skipping FUNC_ID match for %s until userspace " | 1009 | ds_dev_dbg(0, &dev->dev, |
997 | "interaction\n", dev->dev.bus_id); | 1010 | "skipping FUNC_ID match until userspace interaction\n"); |
998 | if (!dev->allow_func_id_match) | 1011 | if (!dev->allow_func_id_match) |
999 | return 0; | 1012 | return 0; |
1000 | } | 1013 | } |
1001 | 1014 | ||
1002 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { | 1015 | 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); | 1016 | ds_dev_dbg(0, &dev->dev, "device needs a fake CIS\n"); |
1004 | if (!dev->socket->fake_cis) | 1017 | if (!dev->socket->fake_cis) |
1005 | pcmcia_load_firmware(dev, did->cisfile); | 1018 | pcmcia_load_firmware(dev, did->cisfile); |
1006 | 1019 | ||
@@ -1032,11 +1045,9 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) { | |||
1032 | /* match dynamic devices first */ | 1045 | /* match dynamic devices first */ |
1033 | spin_lock(&p_drv->dynids.lock); | 1046 | spin_lock(&p_drv->dynids.lock); |
1034 | list_for_each_entry(dynid, &p_drv->dynids.list, node) { | 1047 | list_for_each_entry(dynid, &p_drv->dynids.list, node) { |
1035 | ds_dbg(3, "trying to match %s to %s\n", dev->bus_id, | 1048 | ds_dev_dbg(3, dev, "trying to match to %s\n", drv->name); |
1036 | drv->name); | ||
1037 | if (pcmcia_devmatch(p_dev, &dynid->id)) { | 1049 | if (pcmcia_devmatch(p_dev, &dynid->id)) { |
1038 | ds_dbg(0, "matched %s to %s\n", dev->bus_id, | 1050 | ds_dev_dbg(0, dev, "matched to %s\n", drv->name); |
1039 | drv->name); | ||
1040 | spin_unlock(&p_drv->dynids.lock); | 1051 | spin_unlock(&p_drv->dynids.lock); |
1041 | return 1; | 1052 | return 1; |
1042 | } | 1053 | } |
@@ -1046,18 +1057,15 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) { | |||
1046 | #ifdef CONFIG_PCMCIA_IOCTL | 1057 | #ifdef CONFIG_PCMCIA_IOCTL |
1047 | /* matching by cardmgr */ | 1058 | /* matching by cardmgr */ |
1048 | if (p_dev->cardmgr == p_drv) { | 1059 | if (p_dev->cardmgr == p_drv) { |
1049 | ds_dbg(0, "cardmgr matched %s to %s\n", dev->bus_id, | 1060 | ds_dev_dbg(0, dev, "cardmgr matched to %s\n", drv->name); |
1050 | drv->name); | ||
1051 | return 1; | 1061 | return 1; |
1052 | } | 1062 | } |
1053 | #endif | 1063 | #endif |
1054 | 1064 | ||
1055 | while (did && did->match_flags) { | 1065 | while (did && did->match_flags) { |
1056 | ds_dbg(3, "trying to match %s to %s\n", dev->bus_id, | 1066 | ds_dev_dbg(3, dev, "trying to match to %s\n", drv->name); |
1057 | drv->name); | ||
1058 | if (pcmcia_devmatch(p_dev, did)) { | 1067 | if (pcmcia_devmatch(p_dev, did)) { |
1059 | ds_dbg(0, "matched %s to %s\n", dev->bus_id, | 1068 | ds_dev_dbg(0, dev, "matched to %s\n", drv->name); |
1060 | drv->name); | ||
1061 | return 1; | 1069 | return 1; |
1062 | } | 1070 | } |
1063 | did++; | 1071 | did++; |
@@ -1263,7 +1271,7 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) | |||
1263 | if (p_dev->suspended) | 1271 | if (p_dev->suspended) |
1264 | return 0; | 1272 | return 0; |
1265 | 1273 | ||
1266 | ds_dbg(2, "suspending %s\n", dev->bus_id); | 1274 | ds_dev_dbg(2, dev, "suspending\n"); |
1267 | 1275 | ||
1268 | if (dev->driver) | 1276 | if (dev->driver) |
1269 | p_drv = to_pcmcia_drv(dev->driver); | 1277 | p_drv = to_pcmcia_drv(dev->driver); |
@@ -1274,15 +1282,16 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) | |||
1274 | if (p_drv->suspend) { | 1282 | if (p_drv->suspend) { |
1275 | ret = p_drv->suspend(p_dev); | 1283 | ret = p_drv->suspend(p_dev); |
1276 | if (ret) { | 1284 | if (ret) { |
1277 | printk(KERN_ERR "pcmcia: device %s (driver %s) did " | 1285 | dev_printk(KERN_ERR, dev, |
1278 | "not want to go to sleep (%d)\n", | 1286 | "pcmcia: device %s (driver %s) did " |
1279 | p_dev->devname, p_drv->drv.name, ret); | 1287 | "not want to go to sleep (%d)\n", |
1288 | p_dev->devname, p_drv->drv.name, ret); | ||
1280 | goto out; | 1289 | goto out; |
1281 | } | 1290 | } |
1282 | } | 1291 | } |
1283 | 1292 | ||
1284 | if (p_dev->device_no == p_dev->func) { | 1293 | if (p_dev->device_no == p_dev->func) { |
1285 | ds_dbg(2, "releasing configuration for %s\n", dev->bus_id); | 1294 | ds_dev_dbg(2, dev, "releasing configuration\n"); |
1286 | pcmcia_release_configuration(p_dev); | 1295 | pcmcia_release_configuration(p_dev); |
1287 | } | 1296 | } |
1288 | 1297 | ||
@@ -1302,7 +1311,7 @@ static int pcmcia_dev_resume(struct device * dev) | |||
1302 | if (!p_dev->suspended) | 1311 | if (!p_dev->suspended) |
1303 | return 0; | 1312 | return 0; |
1304 | 1313 | ||
1305 | ds_dbg(2, "resuming %s\n", dev->bus_id); | 1314 | ds_dev_dbg(2, dev, "resuming\n"); |
1306 | 1315 | ||
1307 | if (dev->driver) | 1316 | if (dev->driver) |
1308 | p_drv = to_pcmcia_drv(dev->driver); | 1317 | p_drv = to_pcmcia_drv(dev->driver); |
@@ -1311,7 +1320,7 @@ static int pcmcia_dev_resume(struct device * dev) | |||
1311 | goto out; | 1320 | goto out; |
1312 | 1321 | ||
1313 | if (p_dev->device_no == p_dev->func) { | 1322 | if (p_dev->device_no == p_dev->func) { |
1314 | ds_dbg(2, "requesting configuration for %s\n", dev->bus_id); | 1323 | ds_dev_dbg(2, dev, "requesting configuration\n"); |
1315 | ret = pcmcia_request_configuration(p_dev, &p_dev->conf); | 1324 | ret = pcmcia_request_configuration(p_dev, &p_dev->conf); |
1316 | if (ret) | 1325 | if (ret) |
1317 | goto out; | 1326 | goto out; |
@@ -1353,14 +1362,14 @@ static int pcmcia_bus_resume_callback(struct device *dev, void * _data) | |||
1353 | 1362 | ||
1354 | static int pcmcia_bus_resume(struct pcmcia_socket *skt) | 1363 | static int pcmcia_bus_resume(struct pcmcia_socket *skt) |
1355 | { | 1364 | { |
1356 | ds_dbg(2, "resuming socket %d\n", skt->sock); | 1365 | 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); | 1366 | bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback); |
1358 | return 0; | 1367 | return 0; |
1359 | } | 1368 | } |
1360 | 1369 | ||
1361 | static int pcmcia_bus_suspend(struct pcmcia_socket *skt) | 1370 | static int pcmcia_bus_suspend(struct pcmcia_socket *skt) |
1362 | { | 1371 | { |
1363 | ds_dbg(2, "suspending socket %d\n", skt->sock); | 1372 | ds_dev_dbg(2, &skt->dev, "suspending socket %d\n", skt->sock); |
1364 | if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt, | 1373 | if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt, |
1365 | pcmcia_bus_suspend_callback)) { | 1374 | pcmcia_bus_suspend_callback)) { |
1366 | pcmcia_bus_resume(skt); | 1375 | pcmcia_bus_resume(skt); |
@@ -1386,13 +1395,14 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) | |||
1386 | struct pcmcia_socket *s = pcmcia_get_socket(skt); | 1395 | struct pcmcia_socket *s = pcmcia_get_socket(skt); |
1387 | 1396 | ||
1388 | if (!s) { | 1397 | if (!s) { |
1389 | printk(KERN_ERR "PCMCIA obtaining reference to socket %p " \ | 1398 | dev_printk(KERN_ERR, &skt->dev, |
1390 | "failed, event 0x%x lost!\n", skt, event); | 1399 | "PCMCIA obtaining reference to socket " \ |
1400 | "failed, event 0x%x lost!\n", event); | ||
1391 | return -ENODEV; | 1401 | return -ENODEV; |
1392 | } | 1402 | } |
1393 | 1403 | ||
1394 | ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n", | 1404 | ds_dev_dbg(1, &skt->dev, "ds_event(0x%06x, %d, 0x%p)\n", |
1395 | event, priority, skt); | 1405 | event, priority, skt); |
1396 | 1406 | ||
1397 | switch (event) { | 1407 | switch (event) { |
1398 | case CS_EVENT_CARD_REMOVAL: | 1408 | case CS_EVENT_CARD_REMOVAL: |
@@ -1467,7 +1477,8 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev, | |||
1467 | 1477 | ||
1468 | socket = pcmcia_get_socket(socket); | 1478 | socket = pcmcia_get_socket(socket); |
1469 | if (!socket) { | 1479 | if (!socket) { |
1470 | printk(KERN_ERR "PCMCIA obtaining reference to socket %p failed\n", socket); | 1480 | dev_printk(KERN_ERR, dev, |
1481 | "PCMCIA obtaining reference to socket failed\n"); | ||
1471 | return -ENODEV; | 1482 | return -ENODEV; |
1472 | } | 1483 | } |
1473 | 1484 | ||
@@ -1487,7 +1498,7 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev, | |||
1487 | 1498 | ||
1488 | ret = pccard_register_pcmcia(socket, &pcmcia_bus_callback); | 1499 | ret = pccard_register_pcmcia(socket, &pcmcia_bus_callback); |
1489 | if (ret) { | 1500 | if (ret) { |
1490 | printk(KERN_ERR "PCMCIA registration PCCard core failed for socket %p\n", socket); | 1501 | dev_printk(KERN_ERR, dev, "PCMCIA registration failed\n"); |
1491 | pcmcia_put_socket(socket); | 1502 | pcmcia_put_socket(socket); |
1492 | return (ret); | 1503 | return (ret); |
1493 | } | 1504 | } |
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 4884a18cf9e6..79058825c6f2 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -49,11 +49,12 @@ extern 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; |