diff options
author | Kazuhiro SUZUKI <kaz@jp.fujitsu.com> | 2011-02-18 17:43:07 -0500 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-03-16 13:06:29 -0400 |
commit | c7853aea57d8e850b0979e7bdcbcabdcbbdd9e37 (patch) | |
tree | 2cfd0f35cdd1a115e672f78653b34fdced4bd251 | |
parent | 76ca07832842100b14a31ad8996dab7b0c28aa42 (diff) |
xen: xenbus PM events support
Make xenbus frontend device subscribe to PM events
to receive suspend/resume/freeze/thaw/restore
notifications.
Signed-off-by: Kenji Wakamiya <wkenji@jp.fujitsu.com>
Signed-off-by: Kazuhiro Suzuki <kaz@jp.fujitsu.com>
Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[shriram--minor mods and improved commit message]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.c | 12 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.h | 3 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe_frontend.c | 9 | ||||
-rw-r--r-- | include/xen/xenbus.h | 2 |
4 files changed, 20 insertions, 6 deletions
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index baa65e7fbbc7..739769551e33 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c | |||
@@ -577,7 +577,7 @@ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus) | |||
577 | } | 577 | } |
578 | EXPORT_SYMBOL_GPL(xenbus_dev_changed); | 578 | EXPORT_SYMBOL_GPL(xenbus_dev_changed); |
579 | 579 | ||
580 | int xenbus_dev_suspend(struct device *dev, pm_message_t state) | 580 | int xenbus_dev_suspend(struct device *dev) |
581 | { | 581 | { |
582 | int err = 0; | 582 | int err = 0; |
583 | struct xenbus_driver *drv; | 583 | struct xenbus_driver *drv; |
@@ -590,7 +590,7 @@ int xenbus_dev_suspend(struct device *dev, pm_message_t state) | |||
590 | return 0; | 590 | return 0; |
591 | drv = to_xenbus_driver(dev->driver); | 591 | drv = to_xenbus_driver(dev->driver); |
592 | if (drv->suspend) | 592 | if (drv->suspend) |
593 | err = drv->suspend(xdev, state); | 593 | err = drv->suspend(xdev); |
594 | if (err) | 594 | if (err) |
595 | printk(KERN_WARNING | 595 | printk(KERN_WARNING |
596 | "xenbus: suspend %s failed: %i\n", dev_name(dev), err); | 596 | "xenbus: suspend %s failed: %i\n", dev_name(dev), err); |
@@ -642,6 +642,14 @@ int xenbus_dev_resume(struct device *dev) | |||
642 | } | 642 | } |
643 | EXPORT_SYMBOL_GPL(xenbus_dev_resume); | 643 | EXPORT_SYMBOL_GPL(xenbus_dev_resume); |
644 | 644 | ||
645 | int xenbus_dev_cancel(struct device *dev) | ||
646 | { | ||
647 | /* Do nothing */ | ||
648 | DPRINTK("cancel"); | ||
649 | return 0; | ||
650 | } | ||
651 | EXPORT_SYMBOL_GPL(xenbus_dev_cancel); | ||
652 | |||
645 | /* A flag to determine if xenstored is 'ready' (i.e. has started) */ | 653 | /* A flag to determine if xenstored is 'ready' (i.e. has started) */ |
646 | int xenstored_ready = 0; | 654 | int xenstored_ready = 0; |
647 | 655 | ||
diff --git a/drivers/xen/xenbus/xenbus_probe.h b/drivers/xen/xenbus/xenbus_probe.h index 24665812316a..888b9900ca08 100644 --- a/drivers/xen/xenbus/xenbus_probe.h +++ b/drivers/xen/xenbus/xenbus_probe.h | |||
@@ -64,8 +64,9 @@ extern void xenbus_dev_changed(const char *node, struct xen_bus_type *bus); | |||
64 | 64 | ||
65 | extern void xenbus_dev_shutdown(struct device *_dev); | 65 | extern void xenbus_dev_shutdown(struct device *_dev); |
66 | 66 | ||
67 | extern int xenbus_dev_suspend(struct device *dev, pm_message_t state); | 67 | extern int xenbus_dev_suspend(struct device *dev); |
68 | extern int xenbus_dev_resume(struct device *dev); | 68 | extern int xenbus_dev_resume(struct device *dev); |
69 | extern int xenbus_dev_cancel(struct device *dev); | ||
69 | 70 | ||
70 | extern void xenbus_otherend_changed(struct xenbus_watch *watch, | 71 | extern void xenbus_otherend_changed(struct xenbus_watch *watch, |
71 | const char **vec, unsigned int len, | 72 | const char **vec, unsigned int len, |
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index 5bcc2d6cf129..ea83999c02f3 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c | |||
@@ -85,6 +85,12 @@ static struct device_attribute xenbus_frontend_dev_attrs[] = { | |||
85 | __ATTR_NULL | 85 | __ATTR_NULL |
86 | }; | 86 | }; |
87 | 87 | ||
88 | static const struct dev_pm_ops xenbus_pm_ops = { | ||
89 | .suspend = xenbus_dev_suspend, | ||
90 | .resume = xenbus_dev_resume, | ||
91 | .thaw = xenbus_dev_cancel, | ||
92 | }; | ||
93 | |||
88 | static struct xen_bus_type xenbus_frontend = { | 94 | static struct xen_bus_type xenbus_frontend = { |
89 | .root = "device", | 95 | .root = "device", |
90 | .levels = 2, /* device/type/<id> */ | 96 | .levels = 2, /* device/type/<id> */ |
@@ -100,8 +106,7 @@ static struct xen_bus_type xenbus_frontend = { | |||
100 | .shutdown = xenbus_dev_shutdown, | 106 | .shutdown = xenbus_dev_shutdown, |
101 | .dev_attrs = xenbus_frontend_dev_attrs, | 107 | .dev_attrs = xenbus_frontend_dev_attrs, |
102 | 108 | ||
103 | .suspend = xenbus_dev_suspend, | 109 | .pm = &xenbus_pm_ops, |
104 | .resume = xenbus_dev_resume, | ||
105 | }, | 110 | }, |
106 | }; | 111 | }; |
107 | 112 | ||
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index 7a1d15ff19b7..5467369e0889 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h | |||
@@ -92,7 +92,7 @@ struct xenbus_driver { | |||
92 | void (*otherend_changed)(struct xenbus_device *dev, | 92 | void (*otherend_changed)(struct xenbus_device *dev, |
93 | enum xenbus_state backend_state); | 93 | enum xenbus_state backend_state); |
94 | int (*remove)(struct xenbus_device *dev); | 94 | int (*remove)(struct xenbus_device *dev); |
95 | int (*suspend)(struct xenbus_device *dev, pm_message_t state); | 95 | int (*suspend)(struct xenbus_device *dev); |
96 | int (*resume)(struct xenbus_device *dev); | 96 | int (*resume)(struct xenbus_device *dev); |
97 | int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *); | 97 | int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *); |
98 | struct device_driver driver; | 98 | struct device_driver driver; |