Browse Source

Driver core: allow to delay the uevent at device creation time

For the block subsystem, we want to delay all uevents until the
disk has been scanned and allpartitons are already created before
the first event is sent out.

Signed-off-by: Kay Sievers <kay.sievers@novell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Kay Sievers 18 years ago
parent
commit
b7a3e813fb
2 changed files with 4 additions and 2 deletions
  1. 2 1
      drivers/base/core.c
  2. 2 1
      include/linux/device.h

+ 2 - 1
drivers/base/core.c

@@ -589,7 +589,8 @@ int device_add(struct device *dev)
 		goto PMError;
 		goto PMError;
 	if ((error = bus_add_device(dev)))
 	if ((error = bus_add_device(dev)))
 		goto BusError;
 		goto BusError;
-	kobject_uevent(&dev->kobj, KOBJ_ADD);
+	if (!dev->uevent_suppress)
+		kobject_uevent(&dev->kobj, KOBJ_ADD);
 	if ((error = bus_attach_device(dev)))
 	if ((error = bus_attach_device(dev)))
 		goto AttachError;
 		goto AttachError;
 	if (parent)
 	if (parent)

+ 2 - 1
include/linux/device.h

@@ -399,9 +399,10 @@ struct device {
 
 
 	/* class_device migration path */
 	/* class_device migration path */
 	struct list_head	node;
 	struct list_head	node;
-	struct class		*class;		/* optional*/
+	struct class		*class;
 	dev_t			devt;		/* dev_t, creates the sysfs "dev" */
 	dev_t			devt;		/* dev_t, creates the sysfs "dev" */
 	struct attribute_group	**groups;	/* optional groups */
 	struct attribute_group	**groups;	/* optional groups */
+	int			uevent_suppress;
 
 
 	void	(*release)(struct device * dev);
 	void	(*release)(struct device * dev);
 };
 };