aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/parport/parport_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/parport/parport_cs.c')
-rw-r--r--drivers/parport/parport_cs.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index 4c89853785ed..063d22de9743 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -88,7 +88,7 @@ typedef struct parport_info_t {
88} parport_info_t; 88} parport_info_t;
89 89
90static dev_link_t *parport_attach(void); 90static dev_link_t *parport_attach(void);
91static void parport_detach(dev_link_t *); 91static void parport_detach(struct pcmcia_device *p_dev);
92static void parport_config(dev_link_t *link); 92static void parport_config(dev_link_t *link);
93static void parport_cs_release(dev_link_t *); 93static void parport_cs_release(dev_link_t *);
94static int parport_event(event_t event, int priority, 94static int parport_event(event_t event, int priority,
@@ -137,7 +137,7 @@ static dev_link_t *parport_attach(void)
137 ret = pcmcia_register_client(&link->handle, &client_reg); 137 ret = pcmcia_register_client(&link->handle, &client_reg);
138 if (ret != CS_SUCCESS) { 138 if (ret != CS_SUCCESS) {
139 cs_error(link->handle, RegisterClient, ret); 139 cs_error(link->handle, RegisterClient, ret);
140 parport_detach(link); 140 parport_detach(link->handle);
141 return NULL; 141 return NULL;
142 } 142 }
143 143
@@ -153,13 +153,13 @@ static dev_link_t *parport_attach(void)
153 153
154======================================================================*/ 154======================================================================*/
155 155
156static void parport_detach(dev_link_t *link) 156static void parport_detach(struct pcmcia_device *p_dev)
157{ 157{
158 dev_link_t *link = dev_to_instance(p_dev);
158 dev_link_t **linkp; 159 dev_link_t **linkp;
159 int ret;
160 160
161 DEBUG(0, "parport_detach(0x%p)\n", link); 161 DEBUG(0, "parport_detach(0x%p)\n", link);
162 162
163 /* Locate device structure */ 163 /* Locate device structure */
164 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) 164 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
165 if (*linkp == link) break; 165 if (*linkp == link) break;
@@ -168,17 +168,10 @@ static void parport_detach(dev_link_t *link)
168 168
169 if (link->state & DEV_CONFIG) 169 if (link->state & DEV_CONFIG)
170 parport_cs_release(link); 170 parport_cs_release(link);
171 171
172 if (link->handle) {
173 ret = pcmcia_deregister_client(link->handle);
174 if (ret != CS_SUCCESS)
175 cs_error(link->handle, DeregisterClient, ret);
176 }
177
178 /* Unlink, free device structure */ 172 /* Unlink, free device structure */
179 *linkp = link->next; 173 *linkp = link->next;
180 kfree(link->priv); 174 kfree(link->priv);
181
182} /* parport_detach */ 175} /* parport_detach */
183 176
184/*====================================================================== 177/*======================================================================
@@ -362,11 +355,6 @@ int parport_event(event_t event, int priority,
362 DEBUG(1, "parport_event(0x%06x)\n", event); 355 DEBUG(1, "parport_event(0x%06x)\n", event);
363 356
364 switch (event) { 357 switch (event) {
365 case CS_EVENT_CARD_REMOVAL:
366 link->state &= ~DEV_PRESENT;
367 if (link->state & DEV_CONFIG)
368 parport_cs_release(link);
369 break;
370 case CS_EVENT_CARD_INSERTION: 358 case CS_EVENT_CARD_INSERTION:
371 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 359 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
372 parport_config(link); 360 parport_config(link);
@@ -389,7 +377,7 @@ static struct pcmcia_driver parport_cs_driver = {
389 }, 377 },
390 .attach = parport_attach, 378 .attach = parport_attach,
391 .event = parport_event, 379 .event = parport_event,
392 .detach = parport_detach, 380 .remove = parport_detach,
393 .id_table = parport_ids, 381 .id_table = parport_ids,
394 .suspend = parport_suspend, 382 .suspend = parport_suspend,
395 .resume = parport_resume, 383 .resume = parport_resume,