aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pcmcia/ds.c77
-rw-r--r--include/pcmcia/cs.h1
-rw-r--r--include/pcmcia/ds.h1
3 files changed, 17 insertions, 62 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 32b4d6baa917..8eff55b6c9e9 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -402,43 +402,29 @@ static int pcmcia_device_remove(struct device * dev)
402 /* detach the "instance" */ 402 /* detach the "instance" */
403 p_dev = to_pcmcia_dev(dev); 403 p_dev = to_pcmcia_dev(dev);
404 p_drv = to_pcmcia_drv(dev->driver); 404 p_drv = to_pcmcia_drv(dev->driver);
405 if (!p_drv)
406 return 0;
405 407
406 /* the likely, new path */ 408 if (p_drv->remove)
407 if (p_drv && p_drv->remove) {
408 p_drv->remove(p_dev); 409 p_drv->remove(p_dev);
409 410
410 /* check for proper unloading */ 411 /* check for proper unloading */
411 if (p_dev->state & (CLIENT_IRQ_REQ|CLIENT_IO_REQ|CLIENT_CONFIG_LOCKED)) 412 if (p_dev->state & (CLIENT_IRQ_REQ|CLIENT_IO_REQ|CLIENT_CONFIG_LOCKED))
412 printk(KERN_INFO "pcmcia: driver %s did not release config properly\n", 413 printk(KERN_INFO "pcmcia: driver %s did not release config properly\n",
413 p_drv->drv.name); 414 p_drv->drv.name);
414
415 for (i = 0; i < MAX_WIN; i++)
416 if (p_dev->state & CLIENT_WIN_REQ(i))
417 printk(KERN_INFO "pcmcia: driver %s did not release windows properly\n",
418 p_drv->drv.name);
419
420 /* undo pcmcia_register_client */
421 p_dev->state = CLIENT_UNBOUND;
422 pcmcia_put_dev(p_dev);
423
424 /* references from pcmcia_probe_device */
425 pcmcia_put_dev(p_dev);
426 module_put(p_drv->owner);
427 415
428 return 0; 416 for (i = 0; i < MAX_WIN; i++)
429 } 417 if (p_dev->state & CLIENT_WIN_REQ(i))
418 printk(KERN_INFO "pcmcia: driver %s did not release windows properly\n",
419 p_drv->drv.name);
430 420
431 /* old path */ 421 /* undo pcmcia_register_client */
432 if (p_drv) { 422 p_dev->state = CLIENT_UNBOUND;
433 if ((p_drv->detach) && (p_dev->instance)) { 423 pcmcia_put_dev(p_dev);
434 printk(KERN_INFO "pcmcia: using deprecated detach mechanism. Fix the driver!\n");
435 424
436 p_drv->detach(p_dev->instance); 425 /* references from pcmcia_probe_device */
437 /* from pcmcia_probe_device */ 426 pcmcia_put_dev(p_dev);
438 put_device(&p_dev->dev); 427 module_put(p_drv->owner);
439 }
440 module_put(p_drv->owner);
441 }
442 428
443 return 0; 429 return 0;
444} 430}
@@ -1234,35 +1220,6 @@ int pcmcia_register_client(struct pcmcia_device **handle, client_reg_t *req)
1234EXPORT_SYMBOL(pcmcia_register_client); 1220EXPORT_SYMBOL(pcmcia_register_client);
1235 1221
1236 1222
1237int pcmcia_deregister_client(struct pcmcia_device *p_dev)
1238{
1239 struct pcmcia_socket *s;
1240 int i;
1241
1242 s = p_dev->socket;
1243 ds_dbg(1, "deregister_client(%p)\n", p_dev);
1244
1245 if (p_dev->state & (CLIENT_IRQ_REQ|CLIENT_IO_REQ|CLIENT_CONFIG_LOCKED))
1246 goto warn_out;
1247 for (i = 0; i < MAX_WIN; i++)
1248 if (p_dev->state & CLIENT_WIN_REQ(i))
1249 goto warn_out;
1250
1251 if (p_dev->state & CLIENT_STALE) {
1252 p_dev->state &= ~CLIENT_STALE;
1253 pcmcia_put_dev(p_dev);
1254 } else {
1255 p_dev->state = CLIENT_UNBOUND;
1256 }
1257
1258 return CS_SUCCESS;
1259 warn_out:
1260 printk(KERN_WARNING "ds: deregister_client was called too early.\n");
1261 return CS_IN_USE;
1262} /* deregister_client */
1263EXPORT_SYMBOL(pcmcia_deregister_client);
1264
1265
1266static struct pcmcia_callback pcmcia_bus_callback = { 1223static struct pcmcia_callback pcmcia_bus_callback = {
1267 .owner = THIS_MODULE, 1224 .owner = THIS_MODULE,
1268 .event = ds_event, 1225 .event = ds_event,
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h
index 2cab39f49eb2..a751251efdc8 100644
--- a/include/pcmcia/cs.h
+++ b/include/pcmcia/cs.h
@@ -382,7 +382,6 @@ enum service {
382struct pcmcia_socket; 382struct pcmcia_socket;
383 383
384int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg); 384int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg);
385int pcmcia_deregister_client(struct pcmcia_device *p_dev);
386int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config); 385int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config);
387int pcmcia_get_first_window(window_handle_t *win, win_req_t *req); 386int pcmcia_get_first_window(window_handle_t *win, win_req_t *req);
388int pcmcia_get_next_window(window_handle_t *win, win_req_t *req); 387int pcmcia_get_next_window(window_handle_t *win, win_req_t *req);
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index 2869283acd1d..c53a0604e441 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -136,7 +136,6 @@ struct pcmcia_driver {
136 dev_link_t *(*attach)(void); 136 dev_link_t *(*attach)(void);
137 int (*event) (event_t event, int priority, 137 int (*event) (event_t event, int priority,
138 event_callback_args_t *); 138 event_callback_args_t *);
139 void (*detach)(dev_link_t *);
140 139
141 void (*remove) (struct pcmcia_device *dev); 140 void (*remove) (struct pcmcia_device *dev);
142 141