aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pcmcia/ds.c77
1 files changed, 17 insertions, 60 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,