diff options
author | Aurelien Chartier <aurelien.chartier@citrix.com> | 2013-07-09 09:29:35 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2013-07-29 09:32:31 -0400 |
commit | d7ead0c3c27ef601964d1428066fac932070af7f (patch) | |
tree | d2deecec19a8e848ea9864eebb24a8272e8434fe /drivers/xen | |
parent | 0b0c002c340e78173789f8afaa508070d838cf3d (diff) |
xenbus: frontend resume cleanup
Only create the delayed resume workqueue if we are running in the same domain
as xenstored and issue a warning if the workqueue creation fails.
Move the work initialization to the device probe so it is done only once.
Signed-off-by: Aurelien Chartier <aurelien.chartier@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe_frontend.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index 6ed8a9df4472..34b20bfa4e8c 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c | |||
@@ -115,7 +115,6 @@ static int xenbus_frontend_dev_resume(struct device *dev) | |||
115 | return -EFAULT; | 115 | return -EFAULT; |
116 | } | 116 | } |
117 | 117 | ||
118 | INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume); | ||
119 | queue_work(xenbus_frontend_wq, &xdev->work); | 118 | queue_work(xenbus_frontend_wq, &xdev->work); |
120 | 119 | ||
121 | return 0; | 120 | return 0; |
@@ -124,6 +123,16 @@ static int xenbus_frontend_dev_resume(struct device *dev) | |||
124 | return xenbus_dev_resume(dev); | 123 | return xenbus_dev_resume(dev); |
125 | } | 124 | } |
126 | 125 | ||
126 | static int xenbus_frontend_dev_probe(struct device *dev) | ||
127 | { | ||
128 | if (xen_store_domain_type == XS_LOCAL) { | ||
129 | struct xenbus_device *xdev = to_xenbus_device(dev); | ||
130 | INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume); | ||
131 | } | ||
132 | |||
133 | return xenbus_dev_probe(dev); | ||
134 | } | ||
135 | |||
127 | static const struct dev_pm_ops xenbus_pm_ops = { | 136 | static const struct dev_pm_ops xenbus_pm_ops = { |
128 | .suspend = xenbus_dev_suspend, | 137 | .suspend = xenbus_dev_suspend, |
129 | .resume = xenbus_frontend_dev_resume, | 138 | .resume = xenbus_frontend_dev_resume, |
@@ -142,7 +151,7 @@ static struct xen_bus_type xenbus_frontend = { | |||
142 | .name = "xen", | 151 | .name = "xen", |
143 | .match = xenbus_match, | 152 | .match = xenbus_match, |
144 | .uevent = xenbus_uevent_frontend, | 153 | .uevent = xenbus_uevent_frontend, |
145 | .probe = xenbus_dev_probe, | 154 | .probe = xenbus_frontend_dev_probe, |
146 | .remove = xenbus_dev_remove, | 155 | .remove = xenbus_dev_remove, |
147 | .shutdown = xenbus_dev_shutdown, | 156 | .shutdown = xenbus_dev_shutdown, |
148 | .dev_attrs = xenbus_dev_attrs, | 157 | .dev_attrs = xenbus_dev_attrs, |
@@ -474,7 +483,11 @@ static int __init xenbus_probe_frontend_init(void) | |||
474 | 483 | ||
475 | register_xenstore_notifier(&xenstore_notifier); | 484 | register_xenstore_notifier(&xenstore_notifier); |
476 | 485 | ||
477 | xenbus_frontend_wq = create_workqueue("xenbus_frontend"); | 486 | if (xen_store_domain_type == XS_LOCAL) { |
487 | xenbus_frontend_wq = create_workqueue("xenbus_frontend"); | ||
488 | if (!xenbus_frontend_wq) | ||
489 | pr_warn("create xenbus frontend workqueue failed, S3 resume is likely to fail\n"); | ||
490 | } | ||
478 | 491 | ||
479 | return 0; | 492 | return 0; |
480 | } | 493 | } |