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