aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hardware
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/hardware')
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c56
1 files changed, 12 insertions, 44 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index 0a8c1da10b4b..2a2b03ff096b 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -53,8 +53,6 @@ MODULE_LICENSE("GPL");
53 53
54static void avmcs_config(dev_link_t *link); 54static void avmcs_config(dev_link_t *link);
55static void avmcs_release(dev_link_t *link); 55static void avmcs_release(dev_link_t *link);
56static int avmcs_event(event_t event, int priority,
57 event_callback_args_t *args);
58 56
59/* 57/*
60 The attach() and detach() entry points are used to create and destroy 58 The attach() and detach() entry points are used to create and destroy
@@ -62,18 +60,9 @@ static int avmcs_event(event_t event, int priority,
62 needed to manage one actual PCMCIA card. 60 needed to manage one actual PCMCIA card.
63*/ 61*/
64 62
65static dev_link_t *avmcs_attach(void);
66static void avmcs_detach(struct pcmcia_device *p_dev); 63static void avmcs_detach(struct pcmcia_device *p_dev);
67 64
68/* 65/*
69 The dev_info variable is the "key" that is used to match up this
70 device driver with appropriate cards, through the card configuration
71 database.
72*/
73
74static dev_info_t dev_info = "avm_cs";
75
76/*
77 A linked list of "instances" of the skeleton device. Each actual 66 A linked list of "instances" of the skeleton device. Each actual
78 PCMCIA card corresponds to one device instance, and is described 67 PCMCIA card corresponds to one device instance, and is described
79 by one dev_link_t structure (defined in ds.h). 68 by one dev_link_t structure (defined in ds.h).
@@ -110,13 +99,11 @@ typedef struct local_info_t {
110 99
111======================================================================*/ 100======================================================================*/
112 101
113static dev_link_t *avmcs_attach(void) 102static int avmcs_attach(struct pcmcia_device *p_dev)
114{ 103{
115 client_reg_t client_reg;
116 dev_link_t *link; 104 dev_link_t *link;
117 local_info_t *local; 105 local_info_t *local;
118 int ret; 106
119
120 /* Initialize the dev_link_t structure */ 107 /* Initialize the dev_link_t structure */
121 link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); 108 link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
122 if (!link) 109 if (!link)
@@ -147,24 +134,19 @@ static dev_link_t *avmcs_attach(void)
147 goto err_kfree; 134 goto err_kfree;
148 memset(local, 0, sizeof(local_info_t)); 135 memset(local, 0, sizeof(local_info_t));
149 link->priv = local; 136 link->priv = local;
150 137
151 /* Register with Card Services */ 138 link->handle = p_dev;
152 link->next = NULL; 139 p_dev->instance = link;
153 client_reg.dev_info = &dev_info; 140
154 client_reg.Version = 0x0210; 141 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
155 client_reg.event_callback_args.client_data = link; 142 avmcs_config(link);
156 ret = pcmcia_register_client(&link->handle, &client_reg); 143
157 if (ret != 0) { 144 return 0;
158 cs_error(link->handle, RegisterClient, ret);
159 avmcs_detach(link->handle);
160 goto err;
161 }
162 return link;
163 145
164 err_kfree: 146 err_kfree:
165 kfree(link); 147 kfree(link);
166 err: 148 err:
167 return NULL; 149 return -EINVAL;
168} /* avmcs_attach */ 150} /* avmcs_attach */
169 151
170/*====================================================================== 152/*======================================================================
@@ -433,19 +415,6 @@ static int avmcs_resume(struct pcmcia_device *dev)
433 415
434======================================================================*/ 416======================================================================*/
435 417
436static int avmcs_event(event_t event, int priority,
437 event_callback_args_t *args)
438{
439 dev_link_t *link = args->client_data;
440
441 switch (event) {
442 case CS_EVENT_CARD_INSERTION:
443 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
444 avmcs_config(link);
445 break;
446 }
447 return 0;
448} /* avmcs_event */
449 418
450static struct pcmcia_device_id avmcs_ids[] = { 419static struct pcmcia_device_id avmcs_ids[] = {
451 PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN-Controller B1", 0x95d42008, 0x845dc335), 420 PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN-Controller B1", 0x95d42008, 0x845dc335),
@@ -460,8 +429,7 @@ static struct pcmcia_driver avmcs_driver = {
460 .drv = { 429 .drv = {
461 .name = "avm_cs", 430 .name = "avm_cs",
462 }, 431 },
463 .attach = avmcs_attach, 432 .probe = avmcs_attach,
464 .event = avmcs_event,
465 .remove = avmcs_detach, 433 .remove = avmcs_detach,
466 .id_table = avmcs_ids, 434 .id_table = avmcs_ids,
467 .suspend= avmcs_suspend, 435 .suspend= avmcs_suspend,