aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth/bluecard_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/bluecard_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/bluecard_cs.c')
-rw-r--r--drivers/bluetooth/bluecard_cs.c46
1 files changed, 9 insertions, 37 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,