diff -Nru a/drivers/base/class_simple.c b/drivers/base/class_simple.c --- a/drivers/base/class_simple.c Wed Feb 4 17:02:25 2004 +++ b/drivers/base/class_simple.c Wed Feb 4 17:02:25 2004 @@ -170,6 +170,24 @@ EXPORT_SYMBOL(class_simple_device_add); /** + * class_simple_set_hotplug - set the hotplug callback in the embedded struct class + * @cs: pointer to the struct class_simple to hold the pointer + * @hotplug: function pointer to the hotplug function + * + * Implement and set a hotplug function to add environment variables specific to this + * class on the hotplug event. + */ +int class_simple_set_hotplug(struct class_simple *cs, + int (*hotplug)(struct class_device *dev, char **envp, int num_envp, char *buffer, int buffer_size)) +{ + if ((cs == NULL) || (IS_ERR(cs))) + return -ENODEV; + cs->class.hotplug = hotplug; + return 0; +} +EXPORT_SYMBOL(class_simple_set_hotplug); + +/** * class_simple_device_remove - removes a class device that was created with class_simple_device_add() * @dev: the dev_t of the device that was previously registered. * diff -Nru a/drivers/base/core.c b/drivers/base/core.c --- a/drivers/base/core.c Wed Feb 4 17:02:25 2004 +++ b/drivers/base/core.c Wed Feb 4 17:02:25 2004 @@ -76,7 +76,6 @@ static void device_release(struct kobject * kobj) { struct device * dev = to_dev(kobj); - struct completion * c = dev->complete; if (dev->release) dev->release(dev); @@ -86,8 +85,6 @@ dev->bus_id); WARN_ON(1); } - if (c) - complete(c); } static struct kobj_type ktype_device = { @@ -355,25 +352,6 @@ /** - * device_unregister_wait - Unregister device and wait for it to be freed. - * @dev: Device to unregister. - * - * For the cases where the caller needs to wait for all references to - * be dropped from the device before continuing (e.g. modules with - * statically allocated devices), this function uses a completion struct - * to wait, along with a matching complete() in device_release() above. - */ - -void device_unregister_wait(struct device * dev) -{ - struct completion c; - init_completion(&c); - dev->complete = &c; - device_unregister(dev); - wait_for_completion(&c); -} - -/** * device_for_each_child - device child iterator. * @dev: parent struct device. * @data: data for the callback. @@ -421,7 +399,6 @@ EXPORT_SYMBOL(device_del); EXPORT_SYMBOL(device_unregister); -EXPORT_SYMBOL(device_unregister_wait); EXPORT_SYMBOL(get_device); EXPORT_SYMBOL(put_device); EXPORT_SYMBOL(device_find); diff -Nru a/include/linux/device.h b/include/linux/device.h --- a/include/linux/device.h Wed Feb 4 17:02:25 2004 +++ b/include/linux/device.h Wed Feb 4 17:02:25 2004 @@ -253,6 +253,8 @@ extern void class_simple_destroy(struct class_simple *cs); extern struct class_device *class_simple_device_add(struct class_simple *cs, dev_t dev, struct device *device, const char *fmt, ...) __attribute__((format(printf,4,5))); +extern int class_simple_set_hotplug(struct class_simple *, + int (*hotplug)(struct class_device *dev, char **envp, int num_envp, char *buffer, int buffer_size)); extern void class_simple_device_remove(dev_t dev); @@ -263,7 +265,6 @@ struct list_head children; struct device * parent; - struct completion * complete; /* Notification for freeing device. */ struct kobject kobj; char bus_id[BUS_ID_SIZE]; /* position on parent bus */ @@ -311,7 +312,6 @@ */ extern int device_register(struct device * dev); extern void device_unregister(struct device * dev); -extern void device_unregister_wait(struct device * dev); extern void device_initialize(struct device * dev); extern int device_add(struct device * dev); extern void device_del(struct device * dev); diff -Nru a/lib/kobject.c b/lib/kobject.c --- a/lib/kobject.c Wed Feb 4 17:02:25 2004 +++ b/lib/kobject.c Wed Feb 4 17:02:25 2004 @@ -630,6 +630,9 @@ EXPORT_SYMBOL(kobject_unregister); EXPORT_SYMBOL(kobject_get); EXPORT_SYMBOL(kobject_put); +EXPORT_SYMBOL(kobject_add); +EXPORT_SYMBOL(kobject_del); +EXPORT_SYMBOL(kobject_rename); EXPORT_SYMBOL(kobject_hotplug); EXPORT_SYMBOL(kset_register);