Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xen: Module autoprobing support for frontend drivers

Add module aliases to support autoprobing modules
for xen frontend devices.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Mark McLoughlin and committed by
Ingo Molnar
d2f0c52b 1d78d705

+27 -2
+1
drivers/block/xen-blkfront.c
··· 1015 1015 MODULE_DESCRIPTION("Xen virtual block device frontend"); 1016 1016 MODULE_LICENSE("GPL"); 1017 1017 MODULE_ALIAS_BLOCKDEV_MAJOR(XENVBD_MAJOR); 1018 + MODULE_ALIAS("xen:vbd");
+1
drivers/net/xen-netfront.c
··· 1809 1809 1810 1810 MODULE_DESCRIPTION("Xen virtual network device frontend"); 1811 1811 MODULE_LICENSE("GPL"); 1812 + MODULE_ALIAS("xen:vif");
+25 -2
drivers/xen/xenbus/xenbus_probe.c
··· 88 88 return match_device(drv->ids, to_xenbus_device(_dev)) != NULL; 89 89 } 90 90 91 + static int xenbus_uevent(struct device *_dev, struct kobj_uevent_env *env) 92 + { 93 + struct xenbus_device *dev = to_xenbus_device(_dev); 94 + 95 + if (add_uevent_var(env, "MODALIAS=xen:%s", dev->devicetype)) 96 + return -ENOMEM; 97 + 98 + return 0; 99 + } 100 + 91 101 /* device/<type>/<id> => <type>-<id> */ 92 102 static int frontend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename) 93 103 { ··· 176 166 .bus = { 177 167 .name = "xen", 178 168 .match = xenbus_match, 169 + .uevent = xenbus_uevent, 179 170 .probe = xenbus_dev_probe, 180 171 .remove = xenbus_dev_remove, 181 172 .shutdown = xenbus_dev_shutdown, ··· 449 438 } 450 439 DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL); 451 440 441 + static ssize_t xendev_show_modalias(struct device *dev, 442 + struct device_attribute *attr, char *buf) 443 + { 444 + return sprintf(buf, "xen:%s\n", to_xenbus_device(dev)->devicetype); 445 + } 446 + DEVICE_ATTR(modalias, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_modalias, NULL); 452 447 453 448 int xenbus_probe_node(struct xen_bus_type *bus, 454 449 const char *type, ··· 509 492 510 493 err = device_create_file(&xendev->dev, &dev_attr_devtype); 511 494 if (err) 512 - goto fail_remove_file; 495 + goto fail_remove_nodename; 496 + 497 + err = device_create_file(&xendev->dev, &dev_attr_modalias); 498 + if (err) 499 + goto fail_remove_devtype; 513 500 514 501 return 0; 515 - fail_remove_file: 502 + fail_remove_devtype: 503 + device_remove_file(&xendev->dev, &dev_attr_devtype); 504 + fail_remove_nodename: 516 505 device_remove_file(&xendev->dev, &dev_attr_nodename); 517 506 fail_unregister: 518 507 device_unregister(&xendev->dev);