aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 15:25:51 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 18:03:24 -0500
commitf8cfa618dccbdc6dab5297f75779566a388a98fd (patch)
treeb91e0952038dafc6e03bf8b1d8948b1fdefec031 /drivers/bluetooth
parentb463581154f3f3eecda27cae60df813fefcd84d3 (diff)
[PATCH] pcmcia: unify attach, EVENT_CARD_INSERTION handlers into one probe callback
Unify the EVENT_CARD_INSERTION and "attach" callbacks to one unified probe() callback. As all in-kernel drivers are changed to this new callback, there will be no temporary backwards-compatibility. Inside a probe() function, each driver _must_ set struct pcmcia_device *p_dev->instance and instance->handle correctly. With these patches, the basic driver interface for 16-bit PCMCIA drivers now has the classic four callbacks known also from other buses: int (*probe) (struct pcmcia_device *dev); void (*remove) (struct pcmcia_device *dev); int (*suspend) (struct pcmcia_device *dev); int (*resume) (struct pcmcia_device *dev); Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/bluecard_cs.c46
-rw-r--r--drivers/bluetooth/bt3c_cs.c45
-rw-r--r--drivers/bluetooth/btuart_cs.c46
-rw-r--r--drivers/bluetooth/dtl1_cs.c45
4 files changed, 36 insertions, 146 deletions
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
index bd80535646fa..9888bc151755 100644
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -87,11 +87,7 @@ typedef struct bluecard_info_t {
87 87
88static void bluecard_config(dev_link_t *link); 88static void bluecard_config(dev_link_t *link);
89static void bluecard_release(dev_link_t *link); 89static void bluecard_release(dev_link_t *link);
90static int bluecard_event(event_t event, int priority, event_callback_args_t *args);
91 90
92static dev_info_t dev_info = "bluecard_cs";
93
94static dev_link_t *bluecard_attach(void);
95static void bluecard_detach(struct pcmcia_device *p_dev); 91static void bluecard_detach(struct pcmcia_device *p_dev);
96 92
97 93
@@ -860,17 +856,15 @@ static int bluecard_close(bluecard_info_t *info)
860 return 0; 856 return 0;
861} 857}
862 858
863static dev_link_t *bluecard_attach(void) 859static int bluecard_attach(struct pcmcia_device *p_dev)
864{ 860{
865 bluecard_info_t *info; 861 bluecard_info_t *info;
866 client_reg_t client_reg;
867 dev_link_t *link; 862 dev_link_t *link;
868 int ret;
869 863
870 /* Create new info device */ 864 /* Create new info device */
871 info = kzalloc(sizeof(*info), GFP_KERNEL); 865 info = kzalloc(sizeof(*info), GFP_KERNEL);
872 if (!info) 866 if (!info)
873 return NULL; 867 return -ENOMEM;
874 868
875 link = &info->link; 869 link = &info->link;
876 link->priv = info; 870 link->priv = info;
@@ -887,20 +881,13 @@ static dev_link_t *bluecard_attach(void)
887 link->conf.Vcc = 50; 881 link->conf.Vcc = 50;
888 link->conf.IntType = INT_MEMORY_AND_IO; 882 link->conf.IntType = INT_MEMORY_AND_IO;
889 883
890 /* Register with Card Services */ 884 link->handle = p_dev;
891 link->next = NULL; 885 p_dev->instance = link;
892 client_reg.dev_info = &dev_info; 886
893 client_reg.Version = 0x0210; 887 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
894 client_reg.event_callback_args.client_data = link; 888 bluecard_config(link);
895
896 ret = pcmcia_register_client(&link->handle, &client_reg);
897 if (ret != CS_SUCCESS) {
898 cs_error(link->handle, RegisterClient, ret);
899 bluecard_detach(link->handle);
900 return NULL;
901 }
902 889
903 return link; 890 return 0;
904} 891}
905 892
906 893
@@ -1046,20 +1033,6 @@ static int bluecard_resume(struct pcmcia_device *dev)
1046 return 0; 1033 return 0;
1047} 1034}
1048 1035
1049static int bluecard_event(event_t event, int priority, event_callback_args_t *args)
1050{
1051 dev_link_t *link = args->client_data;
1052
1053 switch (event) {
1054 case CS_EVENT_CARD_INSERTION:
1055 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1056 bluecard_config(link);
1057 break;
1058 }
1059
1060 return 0;
1061}
1062
1063static struct pcmcia_device_id bluecard_ids[] = { 1036static struct pcmcia_device_id bluecard_ids[] = {
1064 PCMCIA_DEVICE_PROD_ID12("BlueCard", "LSE041", 0xbaf16fbf, 0x657cc15e), 1037 PCMCIA_DEVICE_PROD_ID12("BlueCard", "LSE041", 0xbaf16fbf, 0x657cc15e),
1065 PCMCIA_DEVICE_PROD_ID12("BTCFCARD", "LSE139", 0xe3987764, 0x2524b59c), 1038 PCMCIA_DEVICE_PROD_ID12("BTCFCARD", "LSE139", 0xe3987764, 0x2524b59c),
@@ -1073,8 +1046,7 @@ static struct pcmcia_driver bluecard_driver = {
1073 .drv = { 1046 .drv = {
1074 .name = "bluecard_cs", 1047 .name = "bluecard_cs",
1075 }, 1048 },
1076 .attach = bluecard_attach, 1049 .probe = bluecard_attach,
1077 .event = bluecard_event,
1078 .remove = bluecard_detach, 1050 .remove = bluecard_detach,
1079 .id_table = bluecard_ids, 1051 .id_table = bluecard_ids,
1080 .suspend = bluecard_suspend, 1052 .suspend = bluecard_suspend,
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index 50aa52b3cd20..e522d19ad886 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -90,11 +90,7 @@ typedef struct bt3c_info_t {
90 90
91static void bt3c_config(dev_link_t *link); 91static void bt3c_config(dev_link_t *link);
92static void bt3c_release(dev_link_t *link); 92static void bt3c_release(dev_link_t *link);
93static int bt3c_event(event_t event, int priority, event_callback_args_t *args);
94 93
95static dev_info_t dev_info = "bt3c_cs";
96
97static dev_link_t *bt3c_attach(void);
98static void bt3c_detach(struct pcmcia_device *p_dev); 94static void bt3c_detach(struct pcmcia_device *p_dev);
99 95
100 96
@@ -661,17 +657,15 @@ static int bt3c_close(bt3c_info_t *info)
661 return 0; 657 return 0;
662} 658}
663 659
664static dev_link_t *bt3c_attach(void) 660static int bt3c_attach(struct pcmcia_device *p_dev)
665{ 661{
666 bt3c_info_t *info; 662 bt3c_info_t *info;
667 client_reg_t client_reg;
668 dev_link_t *link; 663 dev_link_t *link;
669 int ret;
670 664
671 /* Create new info device */ 665 /* Create new info device */
672 info = kzalloc(sizeof(*info), GFP_KERNEL); 666 info = kzalloc(sizeof(*info), GFP_KERNEL);
673 if (!info) 667 if (!info)
674 return NULL; 668 return -ENOMEM;
675 669
676 link = &info->link; 670 link = &info->link;
677 link->priv = info; 671 link->priv = info;
@@ -688,20 +682,13 @@ static dev_link_t *bt3c_attach(void)
688 link->conf.Vcc = 50; 682 link->conf.Vcc = 50;
689 link->conf.IntType = INT_MEMORY_AND_IO; 683 link->conf.IntType = INT_MEMORY_AND_IO;
690 684
691 /* Register with Card Services */ 685 link->handle = p_dev;
692 link->next = NULL; 686 p_dev->instance = link;
693 client_reg.dev_info = &dev_info;
694 client_reg.Version = 0x0210;
695 client_reg.event_callback_args.client_data = link;
696
697 ret = pcmcia_register_client(&link->handle, &client_reg);
698 if (ret != CS_SUCCESS) {
699 cs_error(link->handle, RegisterClient, ret);
700 bt3c_detach(link->handle);
701 return NULL;
702 }
703 687
704 return link; 688 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
689 bt3c_config(link);
690
691 return 0;
705} 692}
706 693
707 694
@@ -892,19 +879,6 @@ static int bt3c_resume(struct pcmcia_device *dev)
892 return 0; 879 return 0;
893} 880}
894 881
895static int bt3c_event(event_t event, int priority, event_callback_args_t *args)
896{
897 dev_link_t *link = args->client_data;
898
899 switch (event) {
900 case CS_EVENT_CARD_INSERTION:
901 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
902 bt3c_config(link);
903 break;
904 }
905
906 return 0;
907}
908 882
909static struct pcmcia_device_id bt3c_ids[] = { 883static struct pcmcia_device_id bt3c_ids[] = {
910 PCMCIA_DEVICE_PROD_ID13("3COM", "Bluetooth PC Card", 0xefce0a31, 0xd4ce9b02), 884 PCMCIA_DEVICE_PROD_ID13("3COM", "Bluetooth PC Card", 0xefce0a31, 0xd4ce9b02),
@@ -917,8 +891,7 @@ static struct pcmcia_driver bt3c_driver = {
917 .drv = { 891 .drv = {
918 .name = "bt3c_cs", 892 .name = "bt3c_cs",
919 }, 893 },
920 .attach = bt3c_attach, 894 .probe = bt3c_attach,
921 .event = bt3c_event,
922 .remove = bt3c_detach, 895 .remove = bt3c_detach,
923 .id_table = bt3c_ids, 896 .id_table = bt3c_ids,
924 .suspend = bt3c_suspend, 897 .suspend = bt3c_suspend,
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index 7b04f89f7a71..7b4bff4cfa2d 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -86,11 +86,7 @@ typedef struct btuart_info_t {
86 86
87static void btuart_config(dev_link_t *link); 87static void btuart_config(dev_link_t *link);
88static void btuart_release(dev_link_t *link); 88static void btuart_release(dev_link_t *link);
89static int btuart_event(event_t event, int priority, event_callback_args_t *args);
90 89
91static dev_info_t dev_info = "btuart_cs";
92
93static dev_link_t *btuart_attach(void);
94static void btuart_detach(struct pcmcia_device *p_dev); 90static void btuart_detach(struct pcmcia_device *p_dev);
95 91
96 92
@@ -580,17 +576,15 @@ static int btuart_close(btuart_info_t *info)
580 return 0; 576 return 0;
581} 577}
582 578
583static dev_link_t *btuart_attach(void) 579static int btuart_attach(struct pcmcia_device *p_dev)
584{ 580{
585 btuart_info_t *info; 581 btuart_info_t *info;
586 client_reg_t client_reg;
587 dev_link_t *link; 582 dev_link_t *link;
588 int ret;
589 583
590 /* Create new info device */ 584 /* Create new info device */
591 info = kzalloc(sizeof(*info), GFP_KERNEL); 585 info = kzalloc(sizeof(*info), GFP_KERNEL);
592 if (!info) 586 if (!info)
593 return NULL; 587 return -ENOMEM;
594 588
595 link = &info->link; 589 link = &info->link;
596 link->priv = info; 590 link->priv = info;
@@ -607,20 +601,13 @@ static dev_link_t *btuart_attach(void)
607 link->conf.Vcc = 50; 601 link->conf.Vcc = 50;
608 link->conf.IntType = INT_MEMORY_AND_IO; 602 link->conf.IntType = INT_MEMORY_AND_IO;
609 603
610 /* Register with Card Services */ 604 link->handle = p_dev;
611 link->next = NULL; 605 p_dev->instance = link;
612 client_reg.dev_info = &dev_info; 606
613 client_reg.Version = 0x0210; 607 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
614 client_reg.event_callback_args.client_data = link; 608 btuart_config(link);
615
616 ret = pcmcia_register_client(&link->handle, &client_reg);
617 if (ret != CS_SUCCESS) {
618 cs_error(link->handle, RegisterClient, ret);
619 btuart_detach(link->handle);
620 return NULL;
621 }
622 609
623 return link; 610 return 0;
624} 611}
625 612
626 613
@@ -813,20 +800,6 @@ static int btuart_resume(struct pcmcia_device *dev)
813} 800}
814 801
815 802
816static int btuart_event(event_t event, int priority, event_callback_args_t *args)
817{
818 dev_link_t *link = args->client_data;
819
820 switch (event) {
821 case CS_EVENT_CARD_INSERTION:
822 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
823 btuart_config(link);
824 break;
825 }
826
827 return 0;
828}
829
830static struct pcmcia_device_id btuart_ids[] = { 803static struct pcmcia_device_id btuart_ids[] = {
831 /* don't use this driver. Use serial_cs + hci_uart instead */ 804 /* don't use this driver. Use serial_cs + hci_uart instead */
832 PCMCIA_DEVICE_NULL 805 PCMCIA_DEVICE_NULL
@@ -838,8 +811,7 @@ static struct pcmcia_driver btuart_driver = {
838 .drv = { 811 .drv = {
839 .name = "btuart_cs", 812 .name = "btuart_cs",
840 }, 813 },
841 .attach = btuart_attach, 814 .probe = btuart_attach,
842 .event = btuart_event,
843 .remove = btuart_detach, 815 .remove = btuart_detach,
844 .id_table = btuart_ids, 816 .id_table = btuart_ids,
845 .suspend = btuart_suspend, 817 .suspend = btuart_suspend,
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index c39d4576cfff..787c5eb9950e 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -89,11 +89,7 @@ typedef struct dtl1_info_t {
89 89
90static void dtl1_config(dev_link_t *link); 90static void dtl1_config(dev_link_t *link);
91static void dtl1_release(dev_link_t *link); 91static void dtl1_release(dev_link_t *link);
92static int dtl1_event(event_t event, int priority, event_callback_args_t *args);
93 92
94static dev_info_t dev_info = "dtl1_cs";
95
96static dev_link_t *dtl1_attach(void);
97static void dtl1_detach(struct pcmcia_device *p_dev); 93static void dtl1_detach(struct pcmcia_device *p_dev);
98 94
99 95
@@ -559,17 +555,15 @@ static int dtl1_close(dtl1_info_t *info)
559 return 0; 555 return 0;
560} 556}
561 557
562static dev_link_t *dtl1_attach(void) 558static int dtl1_attach(struct pcmcia_device *p_dev)
563{ 559{
564 dtl1_info_t *info; 560 dtl1_info_t *info;
565 client_reg_t client_reg;
566 dev_link_t *link; 561 dev_link_t *link;
567 int ret;
568 562
569 /* Create new info device */ 563 /* Create new info device */
570 info = kzalloc(sizeof(*info), GFP_KERNEL); 564 info = kzalloc(sizeof(*info), GFP_KERNEL);
571 if (!info) 565 if (!info)
572 return NULL; 566 return -ENOMEM;
573 567
574 link = &info->link; 568 link = &info->link;
575 link->priv = info; 569 link->priv = info;
@@ -586,20 +580,13 @@ static dev_link_t *dtl1_attach(void)
586 link->conf.Vcc = 50; 580 link->conf.Vcc = 50;
587 link->conf.IntType = INT_MEMORY_AND_IO; 581 link->conf.IntType = INT_MEMORY_AND_IO;
588 582
589 /* Register with Card Services */ 583 link->handle = p_dev;
590 link->next = NULL; 584 p_dev->instance = link;
591 client_reg.dev_info = &dev_info;
592 client_reg.Version = 0x0210;
593 client_reg.event_callback_args.client_data = link;
594
595 ret = pcmcia_register_client(&link->handle, &client_reg);
596 if (ret != CS_SUCCESS) {
597 cs_error(link->handle, RegisterClient, ret);
598 dtl1_detach(link->handle);
599 return NULL;
600 }
601 585
602 return link; 586 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
587 dtl1_config(link);
588
589 return 0;
603} 590}
604 591
605 592
@@ -764,19 +751,6 @@ static int dtl1_resume(struct pcmcia_device *dev)
764 return 0; 751 return 0;
765} 752}
766 753
767static int dtl1_event(event_t event, int priority, event_callback_args_t *args)
768{
769 dev_link_t *link = args->client_data;
770
771 switch (event) {
772 case CS_EVENT_CARD_INSERTION:
773 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
774 dtl1_config(link);
775 break;
776 }
777
778 return 0;
779}
780 754
781static struct pcmcia_device_id dtl1_ids[] = { 755static struct pcmcia_device_id dtl1_ids[] = {
782 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d), 756 PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d),
@@ -790,8 +764,7 @@ static struct pcmcia_driver dtl1_driver = {
790 .drv = { 764 .drv = {
791 .name = "dtl1_cs", 765 .name = "dtl1_cs",
792 }, 766 },
793 .attach = dtl1_attach, 767 .probe = dtl1_attach,
794 .event = dtl1_event,
795 .remove = dtl1_detach, 768 .remove = dtl1_detach,
796 .id_table = dtl1_ids, 769 .id_table = dtl1_ids,
797 .suspend = dtl1_suspend, 770 .suspend = dtl1_suspend,