ChangeSet 1.1500.19.3, 2004/02/04 13:48:53-08:00, greg@kroah.com

[PATCH] Driver core: remove device_unregister_wait() as it's a very bad idea.


 drivers/base/core.c    |   23 -----------------------
 include/linux/device.h |    2 --
 2 files changed, 25 deletions(-)


diff -Nru a/drivers/base/core.c b/drivers/base/core.c
--- a/drivers/base/core.c	Mon Feb  9 15:09:04 2004
+++ b/drivers/base/core.c	Mon Feb  9 15:09:04 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	Mon Feb  9 15:09:04 2004
+++ b/include/linux/device.h	Mon Feb  9 15:09:04 2004
@@ -265,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 */
 
@@ -313,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);
