diff options
-rw-r--r-- | drivers/xen/manage.c | 9 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.c | 37 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_xs.c | 2 | ||||
-rw-r--r-- | include/xen/xenbus.h | 2 |
4 files changed, 16 insertions, 34 deletions
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index b703dd2c9f11..5269bb4d2496 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -104,9 +104,8 @@ static void do_suspend(void) | |||
104 | goto out; | 104 | goto out; |
105 | } | 105 | } |
106 | 106 | ||
107 | printk("suspending xenbus...\n"); | 107 | printk(KERN_DEBUG "suspending xenstore...\n"); |
108 | /* XXX use normal device tree? */ | 108 | xs_suspend(); |
109 | xenbus_suspend(); | ||
110 | 109 | ||
111 | err = stop_machine(xen_suspend, &cancelled, cpumask_of(0)); | 110 | err = stop_machine(xen_suspend, &cancelled, cpumask_of(0)); |
112 | if (err) { | 111 | if (err) { |
@@ -116,9 +115,9 @@ static void do_suspend(void) | |||
116 | 115 | ||
117 | if (!cancelled) { | 116 | if (!cancelled) { |
118 | xen_arch_resume(); | 117 | xen_arch_resume(); |
119 | xenbus_resume(); | 118 | xs_resume(); |
120 | } else | 119 | } else |
121 | xenbus_suspend_cancel(); | 120 | xs_suspend_cancel(); |
122 | 121 | ||
123 | device_resume(PMSG_RESUME); | 122 | device_resume(PMSG_RESUME); |
124 | 123 | ||
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index bd20361fb099..4649213bed9e 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c | |||
@@ -71,6 +71,9 @@ static int xenbus_probe_frontend(const char *type, const char *name); | |||
71 | 71 | ||
72 | static void xenbus_dev_shutdown(struct device *_dev); | 72 | static void xenbus_dev_shutdown(struct device *_dev); |
73 | 73 | ||
74 | static int xenbus_dev_suspend(struct device *dev, pm_message_t state); | ||
75 | static int xenbus_dev_resume(struct device *dev); | ||
76 | |||
74 | /* If something in array of ids matches this device, return it. */ | 77 | /* If something in array of ids matches this device, return it. */ |
75 | static const struct xenbus_device_id * | 78 | static const struct xenbus_device_id * |
76 | match_device(const struct xenbus_device_id *arr, struct xenbus_device *dev) | 79 | match_device(const struct xenbus_device_id *arr, struct xenbus_device *dev) |
@@ -188,6 +191,9 @@ static struct xen_bus_type xenbus_frontend = { | |||
188 | .remove = xenbus_dev_remove, | 191 | .remove = xenbus_dev_remove, |
189 | .shutdown = xenbus_dev_shutdown, | 192 | .shutdown = xenbus_dev_shutdown, |
190 | .dev_attrs = xenbus_dev_attrs, | 193 | .dev_attrs = xenbus_dev_attrs, |
194 | |||
195 | .suspend = xenbus_dev_suspend, | ||
196 | .resume = xenbus_dev_resume, | ||
191 | }, | 197 | }, |
192 | }; | 198 | }; |
193 | 199 | ||
@@ -669,7 +675,7 @@ static struct xenbus_watch fe_watch = { | |||
669 | .callback = frontend_changed, | 675 | .callback = frontend_changed, |
670 | }; | 676 | }; |
671 | 677 | ||
672 | static int suspend_dev(struct device *dev, void *data) | 678 | static int xenbus_dev_suspend(struct device *dev, pm_message_t state) |
673 | { | 679 | { |
674 | int err = 0; | 680 | int err = 0; |
675 | struct xenbus_driver *drv; | 681 | struct xenbus_driver *drv; |
@@ -682,14 +688,14 @@ static int suspend_dev(struct device *dev, void *data) | |||
682 | drv = to_xenbus_driver(dev->driver); | 688 | drv = to_xenbus_driver(dev->driver); |
683 | xdev = container_of(dev, struct xenbus_device, dev); | 689 | xdev = container_of(dev, struct xenbus_device, dev); |
684 | if (drv->suspend) | 690 | if (drv->suspend) |
685 | err = drv->suspend(xdev); | 691 | err = drv->suspend(xdev, state); |
686 | if (err) | 692 | if (err) |
687 | printk(KERN_WARNING | 693 | printk(KERN_WARNING |
688 | "xenbus: suspend %s failed: %i\n", dev_name(dev), err); | 694 | "xenbus: suspend %s failed: %i\n", dev_name(dev), err); |
689 | return 0; | 695 | return 0; |
690 | } | 696 | } |
691 | 697 | ||
692 | static int resume_dev(struct device *dev, void *data) | 698 | static int xenbus_dev_resume(struct device *dev) |
693 | { | 699 | { |
694 | int err; | 700 | int err; |
695 | struct xenbus_driver *drv; | 701 | struct xenbus_driver *drv; |
@@ -734,31 +740,6 @@ static int resume_dev(struct device *dev, void *data) | |||
734 | return 0; | 740 | return 0; |
735 | } | 741 | } |
736 | 742 | ||
737 | void xenbus_suspend(void) | ||
738 | { | ||
739 | DPRINTK(""); | ||
740 | |||
741 | bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, suspend_dev); | ||
742 | xenbus_backend_suspend(suspend_dev); | ||
743 | xs_suspend(); | ||
744 | } | ||
745 | EXPORT_SYMBOL_GPL(xenbus_suspend); | ||
746 | |||
747 | void xenbus_resume(void) | ||
748 | { | ||
749 | xb_init_comms(); | ||
750 | xs_resume(); | ||
751 | bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, resume_dev); | ||
752 | xenbus_backend_resume(resume_dev); | ||
753 | } | ||
754 | EXPORT_SYMBOL_GPL(xenbus_resume); | ||
755 | |||
756 | void xenbus_suspend_cancel(void) | ||
757 | { | ||
758 | xs_suspend_cancel(); | ||
759 | } | ||
760 | EXPORT_SYMBOL_GPL(xenbus_suspend_cancel); | ||
761 | |||
762 | /* A flag to determine if xenstored is 'ready' (i.e. has started) */ | 743 | /* A flag to determine if xenstored is 'ready' (i.e. has started) */ |
763 | int xenstored_ready = 0; | 744 | int xenstored_ready = 0; |
764 | 745 | ||
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c index e325eab4724d..eab33f1dbdf7 100644 --- a/drivers/xen/xenbus/xenbus_xs.c +++ b/drivers/xen/xenbus/xenbus_xs.c | |||
@@ -673,6 +673,8 @@ void xs_resume(void) | |||
673 | struct xenbus_watch *watch; | 673 | struct xenbus_watch *watch; |
674 | char token[sizeof(watch) * 2 + 1]; | 674 | char token[sizeof(watch) * 2 + 1]; |
675 | 675 | ||
676 | xb_init_comms(); | ||
677 | |||
676 | mutex_unlock(&xs_state.response_mutex); | 678 | mutex_unlock(&xs_state.response_mutex); |
677 | mutex_unlock(&xs_state.request_mutex); | 679 | mutex_unlock(&xs_state.request_mutex); |
678 | up_write(&xs_state.transaction_mutex); | 680 | up_write(&xs_state.transaction_mutex); |
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index 0836772b9686..b9763badbd77 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h | |||
@@ -91,7 +91,7 @@ struct xenbus_driver { | |||
91 | void (*otherend_changed)(struct xenbus_device *dev, | 91 | void (*otherend_changed)(struct xenbus_device *dev, |
92 | enum xenbus_state backend_state); | 92 | enum xenbus_state backend_state); |
93 | int (*remove)(struct xenbus_device *dev); | 93 | int (*remove)(struct xenbus_device *dev); |
94 | int (*suspend)(struct xenbus_device *dev); | 94 | int (*suspend)(struct xenbus_device *dev, pm_message_t state); |
95 | int (*resume)(struct xenbus_device *dev); | 95 | int (*resume)(struct xenbus_device *dev); |
96 | int (*uevent)(struct xenbus_device *, char **, int, char *, int); | 96 | int (*uevent)(struct xenbus_device *, char **, int, char *, int); |
97 | struct device_driver driver; | 97 | struct device_driver driver; |