diff options
author | Mark McLoughlin <markmc@redhat.com> | 2008-04-02 13:54:05 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-24 17:57:33 -0400 |
commit | d2f0c52bec954460e72dee48f3a29c6f310d76be (patch) | |
tree | 9793e3f539f9eacd37b3183c8becd3190df535c4 | |
parent | 1d78d7055629e3f6300d6b8d7028259ee2bffc0e (diff) |
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>
-rw-r--r-- | drivers/block/xen-blkfront.c | 1 | ||||
-rw-r--r-- | drivers/net/xen-netfront.c | 1 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.c | 27 |
3 files changed, 27 insertions, 2 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index dfe61afe676a..ffa0b436129b 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -1015,3 +1015,4 @@ module_exit(xlblk_exit); | |||
1015 | MODULE_DESCRIPTION("Xen virtual block device frontend"); | 1015 | MODULE_DESCRIPTION("Xen virtual block device frontend"); |
1016 | MODULE_LICENSE("GPL"); | 1016 | MODULE_LICENSE("GPL"); |
1017 | MODULE_ALIAS_BLOCKDEV_MAJOR(XENVBD_MAJOR); | 1017 | MODULE_ALIAS_BLOCKDEV_MAJOR(XENVBD_MAJOR); |
1018 | MODULE_ALIAS("xen:vbd"); | ||
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 7483d45bc5bc..b3fa27e6c78a 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -1809,3 +1809,4 @@ module_exit(netif_exit); | |||
1809 | 1809 | ||
1810 | MODULE_DESCRIPTION("Xen virtual network device frontend"); | 1810 | MODULE_DESCRIPTION("Xen virtual network device frontend"); |
1811 | MODULE_LICENSE("GPL"); | 1811 | MODULE_LICENSE("GPL"); |
1812 | MODULE_ALIAS("xen:vif"); | ||
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 88fc5ec665f5..57ceb5346b74 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c | |||
@@ -88,6 +88,16 @@ int xenbus_match(struct device *_dev, struct device_driver *_drv) | |||
88 | return match_device(drv->ids, to_xenbus_device(_dev)) != NULL; | 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 | /* device/<type>/<id> => <type>-<id> */ | 101 | /* device/<type>/<id> => <type>-<id> */ |
92 | static int frontend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename) | 102 | static int frontend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename) |
93 | { | 103 | { |
@@ -166,6 +176,7 @@ static struct xen_bus_type xenbus_frontend = { | |||
166 | .bus = { | 176 | .bus = { |
167 | .name = "xen", | 177 | .name = "xen", |
168 | .match = xenbus_match, | 178 | .match = xenbus_match, |
179 | .uevent = xenbus_uevent, | ||
169 | .probe = xenbus_dev_probe, | 180 | .probe = xenbus_dev_probe, |
170 | .remove = xenbus_dev_remove, | 181 | .remove = xenbus_dev_remove, |
171 | .shutdown = xenbus_dev_shutdown, | 182 | .shutdown = xenbus_dev_shutdown, |
@@ -438,6 +449,12 @@ static ssize_t xendev_show_devtype(struct device *dev, | |||
438 | } | 449 | } |
439 | DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL); | 450 | DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL); |
440 | 451 | ||
452 | static ssize_t xendev_show_modalias(struct device *dev, | ||
453 | struct device_attribute *attr, char *buf) | ||
454 | { | ||
455 | return sprintf(buf, "xen:%s\n", to_xenbus_device(dev)->devicetype); | ||
456 | } | ||
457 | DEVICE_ATTR(modalias, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_modalias, NULL); | ||
441 | 458 | ||
442 | int xenbus_probe_node(struct xen_bus_type *bus, | 459 | int xenbus_probe_node(struct xen_bus_type *bus, |
443 | const char *type, | 460 | const char *type, |
@@ -492,10 +509,16 @@ int xenbus_probe_node(struct xen_bus_type *bus, | |||
492 | 509 | ||
493 | err = device_create_file(&xendev->dev, &dev_attr_devtype); | 510 | err = device_create_file(&xendev->dev, &dev_attr_devtype); |
494 | if (err) | 511 | if (err) |
495 | goto fail_remove_file; | 512 | goto fail_remove_nodename; |
513 | |||
514 | err = device_create_file(&xendev->dev, &dev_attr_modalias); | ||
515 | if (err) | ||
516 | goto fail_remove_devtype; | ||
496 | 517 | ||
497 | return 0; | 518 | return 0; |
498 | fail_remove_file: | 519 | fail_remove_devtype: |
520 | device_remove_file(&xendev->dev, &dev_attr_devtype); | ||
521 | fail_remove_nodename: | ||
499 | device_remove_file(&xendev->dev, &dev_attr_nodename); | 522 | device_remove_file(&xendev->dev, &dev_attr_nodename); |
500 | fail_unregister: | 523 | fail_unregister: |
501 | device_unregister(&xendev->dev); | 524 | device_unregister(&xendev->dev); |