aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth/bt3c_cs.c
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/bt3c_cs.c
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/bt3c_cs.c')
-rw-r--r--drivers/bluetooth/bt3c_cs.c45
1 files changed, 9 insertions, 36 deletions
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,