diff options
| -rw-r--r-- | drivers/base/core.c | 9 | ||||
| -rw-r--r-- | include/linux/device.h | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 93b8a0bb046a..391e0abefaa0 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -96,9 +96,6 @@ void put_device(struct device * dev) DBG("DEV: Unregistering device. ID = '%s', name = '%s'\n", dev->bus_id,dev->name); - /* remove the driverfs directory */ - device_remove_dir(dev); - /* Notify the platform of the removal, in case they * need to do anything... */ @@ -112,6 +109,12 @@ void put_device(struct device * dev) if (dev->driver && dev->driver->remove) dev->driver->remove(dev,REMOVE_FREE_RESOURCES); + /* remove the driverfs directory */ + device_remove_dir(dev); + + if (dev->release) + dev->release(dev); + put_device(dev->parent); } diff --git a/include/linux/device.h b/include/linux/device.h index 96d9cb108139..ccfd221d5dcd 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -92,6 +92,8 @@ struct device { being off. */ unsigned char *saved_state; /* saved device state */ + + void (*release)(struct device * dev); }; static inline struct device * |
