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