ChangeSet 1.2065.3.16, 2005/03/12 08:24:58-08:00, [EMAIL PROTECTED]
[PATCH] pcmcia: pcmcia_device_remove
Move the removal of a device from a driver (a.k.a. "detach") to a
driver-model conform pcmcia_device_remove() function which is called
within
device_unregister().
Signed-off-by: Dominik Brodowski <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
ds.c | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
diff -Nru a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
--- a/drivers/pcmcia/ds.c 2005-03-12 21:27:54 -08:00
+++ b/drivers/pcmcia/ds.c 2005-03-12 21:27:54 -08:00
@@ -286,6 +286,7 @@
* Registers a PCMCIA driver with the PCMCIA bus core.
*/
static int pcmcia_device_probe(struct device *dev);
+static int pcmcia_device_remove(struct device * dev);
int pcmcia_register_driver(struct pcmcia_driver *driver)
{
@@ -296,6 +297,7 @@
driver->drv.bus = &pcmcia_bus_type;
driver->drv.owner = driver->owner;
driver->drv.probe = pcmcia_device_probe;
+ driver->drv.remove = pcmcia_device_remove;
return driver_register(&driver->drv);
}
@@ -404,6 +406,28 @@
}
+static int pcmcia_device_remove(struct device * dev)
+{
+ struct pcmcia_device *p_dev;
+ struct pcmcia_driver *p_drv;
+
+ /* detach the "instance" */
+ p_dev = to_pcmcia_dev(dev);
+ p_drv = to_pcmcia_drv(dev->driver);
+
+ if (p_drv) {
+ if ((p_drv->detach) && (p_dev->instance)) {
+ p_drv->detach(p_dev->instance);
+ /* from pcmcia_probe_device */
+ put_device(&p_dev->dev);
+ }
+ module_put(p_drv->owner);
+ }
+
+ return 0;
+}
+
+
/*======================================================================
These manage a ring buffer of events pending for one user process
@@ -866,7 +890,6 @@
static int unbind_request(struct pcmcia_bus_socket *s)
{
struct pcmcia_device *p_dev;
- struct pcmcia_driver *p_drv;
unsigned long flags;
ds_dbg(2, "unbind_request(%d)\n", s->parent->sock);
@@ -884,17 +907,6 @@
list_del(&p_dev->socket_device_list);
p_dev->client.state |= CLIENT_STALE;
spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
-
- /* detach the "instance" */
- p_drv = to_pcmcia_drv(p_dev->dev.driver);
- if (p_drv) {
- if ((p_drv->detach) && (p_dev->instance)) {
- p_drv->detach(p_dev->instance);
- /* from pcmcia_probe_device */
- put_device(&p_dev->dev);
- }
- module_put(p_drv->owner);
- }
device_unregister(&p_dev->dev);
}
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html