xen: Add module alias to autoload backend drivers
authorBastian Blank <waldi@debian.org>
Wed, 29 Jun 2011 12:40:08 +0000 (14:40 +0200)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 30 Jun 2011 16:15:33 +0000 (12:15 -0400)
All the Xen backend drivers are assigned to a special bus type
xen-backend. This patch exports xen-backend:* names through modalias and
uevent to autoload them.

Signed-off-by: Bastian Blank <waldi@debian.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/xen/xenbus/xenbus_probe.c
drivers/xen/xenbus/xenbus_probe_backend.c

index 2ed0b045c69a0e66097c06284f7c266db9df69db..bd2f90c9ac8b8131ff12a2e0f9a26be28af745ee 100644 (file)
@@ -393,7 +393,8 @@ static ssize_t devtype_show(struct device *dev,
 static ssize_t modalias_show(struct device *dev,
                             struct device_attribute *attr, char *buf)
 {
-       return sprintf(buf, "xen:%s\n", to_xenbus_device(dev)->devicetype);
+       return sprintf(buf, "%s:%s\n", dev->bus->name,
+                      to_xenbus_device(dev)->devicetype);
 }
 
 struct device_attribute xenbus_dev_attrs[] = {
index ec510e56282022f7e9f752dc1008b78ced79d79f..60adf919d78ddd46a4e6e2cadad27bd053bfa392 100644 (file)
@@ -107,6 +107,9 @@ static int xenbus_uevent_backend(struct device *dev,
        if (xdev == NULL)
                return -ENODEV;
 
+       if (add_uevent_var(env, "MODALIAS=xen-backend:%s", xdev->devicetype))
+               return -ENOMEM;
+
        /* stuff we want to pass to /sbin/hotplug */
        if (add_uevent_var(env, "XENBUS_TYPE=%s", xdev->devicetype))
                return -ENOMEM;