diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2009-02-09 15:05:51 -0500 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-01-05 16:29:58 -0500 |
commit | df660251eb534649f90f9dcfe1da1cef4ea48a3e (patch) | |
tree | f4ce5d401d16f13437f553117acb7807d05ed2dd /drivers/xen/xenbus/xenbus_probe_frontend.c | |
parent | 2de06cc1f18d638cc7ab1169f61a8599045c2d4f (diff) |
xen: add backend driver support
Impact: backend device support
Add the basic machinery to support backend drivers.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
[corresponds to 79727b851bac in git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/xen/xenbus/xenbus_probe_frontend.c')
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe_frontend.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index 04c4f0123521..dd31d5a43b40 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c | |||
@@ -62,6 +62,17 @@ static int xenbus_probe_frontend(struct xen_bus_type *bus, const char *type, con | |||
62 | return err; | 62 | return err; |
63 | } | 63 | } |
64 | 64 | ||
65 | static int xenbus_uevent_frontend(struct device *_dev, struct kobj_uevent_env *env) | ||
66 | { | ||
67 | struct xenbus_device *dev = to_xenbus_device(_dev); | ||
68 | |||
69 | if (add_uevent_var(env, "MODALIAS=xen:%s", dev->devicetype)) | ||
70 | return -ENOMEM; | ||
71 | |||
72 | return 0; | ||
73 | } | ||
74 | |||
75 | |||
65 | static void backend_changed(struct xenbus_watch *watch, | 76 | static void backend_changed(struct xenbus_watch *watch, |
66 | const char **vec, unsigned int len) | 77 | const char **vec, unsigned int len) |
67 | { | 78 | { |
@@ -81,7 +92,7 @@ static struct xen_bus_type xenbus_frontend = { | |||
81 | .bus = { | 92 | .bus = { |
82 | .name = "xen", | 93 | .name = "xen", |
83 | .match = xenbus_match, | 94 | .match = xenbus_match, |
84 | .uevent = xenbus_uevent, | 95 | .uevent = xenbus_uevent_frontend, |
85 | .probe = xenbus_dev_probe, | 96 | .probe = xenbus_dev_probe, |
86 | .remove = xenbus_dev_remove, | 97 | .remove = xenbus_dev_remove, |
87 | .shutdown = xenbus_dev_shutdown, | 98 | .shutdown = xenbus_dev_shutdown, |
@@ -232,8 +243,25 @@ int __xenbus_register_frontend(struct xenbus_driver *drv, | |||
232 | } | 243 | } |
233 | EXPORT_SYMBOL_GPL(__xenbus_register_frontend); | 244 | EXPORT_SYMBOL_GPL(__xenbus_register_frontend); |
234 | 245 | ||
246 | static int frontend_probe_and_watch(struct notifier_block *notifier, | ||
247 | unsigned long event, | ||
248 | void *data) | ||
249 | { | ||
250 | /* Enumerate devices in xenstore and watch for changes. */ | ||
251 | xenbus_probe_devices(&xenbus_frontend); | ||
252 | printk(KERN_CRIT "%s devices probed ok\n", __func__); | ||
253 | register_xenbus_watch(&fe_watch); | ||
254 | printk(KERN_CRIT "%s watch add ok ok\n", __func__); | ||
255 | printk(KERN_CRIT "%s all done\n", __func__); | ||
256 | return NOTIFY_DONE; | ||
257 | } | ||
258 | |||
259 | |||
235 | static int __init xenbus_probe_frontend_init(void) | 260 | static int __init xenbus_probe_frontend_init(void) |
236 | { | 261 | { |
262 | static struct notifier_block xenstore_notifier = { | ||
263 | .notifier_call = frontend_probe_and_watch | ||
264 | }; | ||
237 | int err; | 265 | int err; |
238 | 266 | ||
239 | DPRINTK(""); | 267 | DPRINTK(""); |
@@ -246,14 +274,7 @@ static int __init xenbus_probe_frontend_init(void) | |||
246 | } | 274 | } |
247 | printk(KERN_CRIT "%s bus registered ok\n", __func__); | 275 | printk(KERN_CRIT "%s bus registered ok\n", __func__); |
248 | 276 | ||
249 | if (!xen_initial_domain()) { | 277 | register_xenstore_notifier(&xenstore_notifier); |
250 | /* Enumerate devices in xenstore and watch for changes. */ | ||
251 | xenbus_probe_devices(&xenbus_frontend); | ||
252 | printk(KERN_CRIT "%s devices probed ok\n", __func__); | ||
253 | register_xenbus_watch(&fe_watch); | ||
254 | printk(KERN_CRIT "%s watch add ok ok\n", __func__); | ||
255 | printk(KERN_CRIT "%s all done\n", __func__); | ||
256 | } | ||
257 | 278 | ||
258 | return 0; | 279 | return 0; |
259 | } | 280 | } |