Magellan Linux

Contents of /trunk/kernel26-xen/patches-2.6.25-r1/1007-2.6.25-xen-Module-autoprobing-support-for-frontend-drivers.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 606 - (show annotations) (download)
Thu May 22 23:13:13 2008 UTC (15 years, 11 months ago) by niro
File size: 3288 byte(s)
-ver bump to 2.6.25-magellan-r1:
- linux-2.6.25.4
- fbcondecor-0.9.4
- squashfs-3.3
- unionfs-2.3.3
- tuxonice-3.0-rc7
- linux-phc-0.3.0
- acpi-dstd-0.9a
- reiser4
- xen-3.2.0
. ipw3945-1.2.2

1 From 24dca326fef5b02ebdaec5f7325cb2ac09ffa946 Mon Sep 17 00:00:00 2001
2 From: Mark McLoughlin <markmc@redhat.com>
3 Date: Fri, 22 Feb 2008 12:42:52 +0000
4 Subject: [PATCH] xen: Module autoprobing support for frontend drivers
5
6 Add module aliases to support autoprobing modules
7 for xen frontend devices.
8
9 Signed-off-by: Mark McLoughlin <markmc@redhat.com>
10 ---
11 drivers/block/xen-blkfront.c | 1 +
12 drivers/net/xen-netfront.c | 1 +
13 drivers/xen/xenbus/xenbus_probe.c | 27 +++++++++++++++++++++++++--
14 3 files changed, 27 insertions(+), 2 deletions(-)
15
16 diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
17 index 2e7c81e..0c47c02 100644
18 --- a/drivers/block/xen-blkfront.c
19 +++ b/drivers/block/xen-blkfront.c
20 @@ -1005,3 +1005,4 @@ module_exit(xlblk_exit);
21 MODULE_DESCRIPTION("Xen virtual block device frontend");
22 MODULE_LICENSE("GPL");
23 MODULE_ALIAS_BLOCKDEV_MAJOR(XENVBD_MAJOR);
24 +MODULE_ALIAS("xen:vbd");
25 diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
26 index 7483d45..b3fa27e 100644
27 --- a/drivers/net/xen-netfront.c
28 +++ b/drivers/net/xen-netfront.c
29 @@ -1809,3 +1809,4 @@ module_exit(netif_exit);
30
31 MODULE_DESCRIPTION("Xen virtual network device frontend");
32 MODULE_LICENSE("GPL");
33 +MODULE_ALIAS("xen:vif");
34 diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
35 index 4750de3..336363c 100644
36 --- a/drivers/xen/xenbus/xenbus_probe.c
37 +++ b/drivers/xen/xenbus/xenbus_probe.c
38 @@ -88,6 +88,16 @@ int xenbus_match(struct device *_dev, struct device_driver *_drv)
39 return match_device(drv->ids, to_xenbus_device(_dev)) != NULL;
40 }
41
42 +static int xenbus_uevent(struct device *_dev, struct kobj_uevent_env *env)
43 +{
44 + struct xenbus_device *dev = to_xenbus_device(_dev);
45 +
46 + if (add_uevent_var(env, "MODALIAS=xen:%s", dev->devicetype))
47 + return -ENOMEM;
48 +
49 + return 0;
50 +}
51 +
52 /* device/<type>/<id> => <type>-<id> */
53 static int frontend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename)
54 {
55 @@ -166,6 +176,7 @@ static struct xen_bus_type xenbus_frontend = {
56 .bus = {
57 .name = "xen",
58 .match = xenbus_match,
59 + .uevent = xenbus_uevent,
60 .probe = xenbus_dev_probe,
61 .remove = xenbus_dev_remove,
62 .shutdown = xenbus_dev_shutdown,
63 @@ -438,6 +449,12 @@ static ssize_t xendev_show_devtype(struct device *dev,
64 }
65 DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL);
66
67 +static ssize_t xendev_show_modalias(struct device *dev,
68 + struct device_attribute *attr, char *buf)
69 +{
70 + return sprintf(buf, "xen:%s\n", to_xenbus_device(dev)->devicetype);
71 +}
72 +DEVICE_ATTR(modalias, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_modalias, NULL);
73
74 int xenbus_probe_node(struct xen_bus_type *bus,
75 const char *type,
76 @@ -492,10 +509,16 @@ int xenbus_probe_node(struct xen_bus_type *bus,
77
78 err = device_create_file(&xendev->dev, &dev_attr_devtype);
79 if (err)
80 - goto fail_remove_file;
81 + goto fail_remove_nodename;
82 +
83 + err = device_create_file(&xendev->dev, &dev_attr_modalias);
84 + if (err)
85 + goto fail_remove_devtype;
86
87 return 0;
88 -fail_remove_file:
89 +fail_remove_devtype:
90 + device_remove_file(&xendev->dev, &dev_attr_devtype);
91 +fail_remove_nodename:
92 device_remove_file(&xendev->dev, &dev_attr_nodename);
93 fail_unregister:
94 device_unregister(&xendev->dev);
95 --
96 1.5.4.1
97