diff options
Diffstat (limited to 'drivers/pcmcia/ds.c')
-rw-r--r-- | drivers/pcmcia/ds.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 34e634aa48e4..8c87343707cf 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -390,8 +390,6 @@ static int pcmcia_device_probe(struct device * dev) | |||
390 | goto put_dev; | 390 | goto put_dev; |
391 | } | 391 | } |
392 | 392 | ||
393 | p_dev->p_state &= ~CLIENT_UNBOUND; | ||
394 | |||
395 | ret = p_drv->probe(p_dev); | 393 | ret = p_drv->probe(p_dev); |
396 | if (ret) | 394 | if (ret) |
397 | goto put_module; | 395 | goto put_module; |
@@ -433,17 +431,16 @@ static int pcmcia_device_remove(struct device * dev) | |||
433 | p_drv->remove(p_dev); | 431 | p_drv->remove(p_dev); |
434 | 432 | ||
435 | /* check for proper unloading */ | 433 | /* check for proper unloading */ |
436 | if (p_dev->p_state & (CLIENT_IRQ_REQ|CLIENT_IO_REQ|CLIENT_CONFIG_LOCKED)) | 434 | if (p_dev->_irq || p_dev->_io || p_dev->_locked) |
437 | printk(KERN_INFO "pcmcia: driver %s did not release config properly\n", | 435 | printk(KERN_INFO "pcmcia: driver %s did not release config properly\n", |
438 | p_drv->drv.name); | 436 | p_drv->drv.name); |
439 | 437 | ||
440 | for (i = 0; i < MAX_WIN; i++) | 438 | for (i = 0; i < MAX_WIN; i++) |
441 | if (p_dev->p_state & CLIENT_WIN_REQ(i)) | 439 | if (p_dev->_win & CLIENT_WIN_REQ(i)) |
442 | printk(KERN_INFO "pcmcia: driver %s did not release windows properly\n", | 440 | printk(KERN_INFO "pcmcia: driver %s did not release windows properly\n", |
443 | p_drv->drv.name); | 441 | p_drv->drv.name); |
444 | 442 | ||
445 | /* references from pcmcia_probe_device */ | 443 | /* references from pcmcia_probe_device */ |
446 | p_dev->p_state = CLIENT_UNBOUND; | ||
447 | pcmcia_put_dev(p_dev); | 444 | pcmcia_put_dev(p_dev); |
448 | module_put(p_drv->owner); | 445 | module_put(p_drv->owner); |
449 | 446 | ||
@@ -472,7 +469,6 @@ static void pcmcia_card_remove(struct pcmcia_socket *s) | |||
472 | } | 469 | } |
473 | p_dev = list_entry((&s->devices_list)->next, struct pcmcia_device, socket_device_list); | 470 | p_dev = list_entry((&s->devices_list)->next, struct pcmcia_device, socket_device_list); |
474 | list_del(&p_dev->socket_device_list); | 471 | list_del(&p_dev->socket_device_list); |
475 | p_dev->p_state |= CLIENT_STALE; | ||
476 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 472 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
477 | 473 | ||
478 | device_unregister(&p_dev->dev); | 474 | device_unregister(&p_dev->dev); |
@@ -602,9 +598,6 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
602 | sprintf (p_dev->devname, "pcmcia%s", p_dev->dev.bus_id); | 598 | sprintf (p_dev->devname, "pcmcia%s", p_dev->dev.bus_id); |
603 | 599 | ||
604 | /* compat */ | 600 | /* compat */ |
605 | p_dev->p_state = CLIENT_UNBOUND; | ||
606 | |||
607 | |||
608 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); | 601 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); |
609 | 602 | ||
610 | /* | 603 | /* |
@@ -1033,15 +1026,18 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) | |||
1033 | if (dev->driver) | 1026 | if (dev->driver) |
1034 | p_drv = to_pcmcia_drv(dev->driver); | 1027 | p_drv = to_pcmcia_drv(dev->driver); |
1035 | 1028 | ||
1036 | if (p_drv && p_drv->suspend) { | 1029 | if (!p_drv) |
1030 | goto out; | ||
1031 | |||
1032 | if (p_drv->suspend) { | ||
1037 | ret = p_drv->suspend(p_dev); | 1033 | ret = p_drv->suspend(p_dev); |
1038 | if (ret) | 1034 | if (ret) |
1039 | goto out; | 1035 | goto out; |
1040 | if ((p_dev->state & DEV_CONFIG) && | ||
1041 | !(p_dev->state & DEV_SUSPEND_NORELEASE)) | ||
1042 | pcmcia_release_configuration(p_dev); | ||
1043 | } | 1036 | } |
1044 | 1037 | ||
1038 | if (p_dev->device_no == p_dev->func) | ||
1039 | pcmcia_release_configuration(p_dev); | ||
1040 | |||
1045 | out: | 1041 | out: |
1046 | if (!ret) | 1042 | if (!ret) |
1047 | p_dev->suspended = 1; | 1043 | p_dev->suspended = 1; |
@@ -1058,17 +1054,18 @@ static int pcmcia_dev_resume(struct device * dev) | |||
1058 | if (dev->driver) | 1054 | if (dev->driver) |
1059 | p_drv = to_pcmcia_drv(dev->driver); | 1055 | p_drv = to_pcmcia_drv(dev->driver); |
1060 | 1056 | ||
1061 | if (p_drv && p_drv->resume) { | 1057 | if (!p_drv) |
1062 | if ((p_dev->state & DEV_CONFIG) && | 1058 | goto out; |
1063 | !(p_dev->state & DEV_SUSPEND_NORELEASE)){ | 1059 | |
1064 | ret = pcmcia_request_configuration(p_dev, | 1060 | if (p_dev->device_no == p_dev->func) { |
1065 | &p_dev->conf); | 1061 | ret = pcmcia_request_configuration(p_dev, &p_dev->conf); |
1066 | if (ret) | 1062 | if (ret) |
1067 | goto out; | 1063 | goto out; |
1068 | } | ||
1069 | ret = p_drv->resume(p_dev); | ||
1070 | } | 1064 | } |
1071 | 1065 | ||
1066 | if (p_drv->resume) | ||
1067 | ret = p_drv->resume(p_dev); | ||
1068 | |||
1072 | out: | 1069 | out: |
1073 | if (!ret) | 1070 | if (!ret) |
1074 | p_dev->suspended = 0; | 1071 | p_dev->suspended = 0; |