Driver core: add name to device_type

If "name" of a device_type is specified, the uevent will
contain the device_type name in the DEVTYPE variable.
This helps userspace to distingiush between different types
of devices, belonging to the same subsystem.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

diff --git a/drivers/base/core.c b/drivers/base/core.c
index bb2cc37..bffb69e 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -157,6 +157,11 @@
 			       "MINOR=%u", MINOR(dev->devt));
 	}
 
+	if (dev->type && dev->type->name)
+		add_uevent_var(envp, num_envp, &i,
+			       buffer, buffer_size, &length,
+			       "DEVTYPE=%s", dev->type->name);
+
 	if (dev->driver)
 		add_uevent_var(envp, num_envp, &i,
 			       buffer, buffer_size, &length,