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>

authored by Kazuhiro SUZUKI and committed by Konrad Rzeszutek Wilk c7853aea 76ca0783

+20 -6
+10 -2
drivers/xen/xenbus/xenbus_probe.c
··· 577 577 } 578 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 582 int err = 0; 583 583 struct xenbus_driver *drv; ··· 590 590 return 0; 591 591 drv = to_xenbus_driver(dev->driver); 592 592 if (drv->suspend) 593 - err = drv->suspend(xdev, state); 593 + err = drv->suspend(xdev); 594 594 if (err) 595 595 printk(KERN_WARNING 596 596 "xenbus: suspend %s failed: %i\n", dev_name(dev), err); ··· 641 641 return 0; 642 642 } 643 643 EXPORT_SYMBOL_GPL(xenbus_dev_resume); 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); 644 652 645 653 /* A flag to determine if xenstored is 'ready' (i.e. has started) */ 646 654 int xenstored_ready = 0;
+2 -1
drivers/xen/xenbus/xenbus_probe.h
··· 64 64 65 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 68 extern int xenbus_dev_resume(struct device *dev); 69 + extern int xenbus_dev_cancel(struct device *dev); 69 70 70 71 extern void xenbus_otherend_changed(struct xenbus_watch *watch, 71 72 const char **vec, unsigned int len,
+7 -2
drivers/xen/xenbus/xenbus_probe_frontend.c
··· 85 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 94 static struct xen_bus_type xenbus_frontend = { 89 95 .root = "device", 90 96 .levels = 2, /* device/type/<id> */ ··· 106 100 .shutdown = xenbus_dev_shutdown, 107 101 .dev_attrs = xenbus_frontend_dev_attrs, 108 102 109 - .suspend = xenbus_dev_suspend, 110 - .resume = xenbus_dev_resume, 103 + .pm = &xenbus_pm_ops, 111 104 }, 112 105 }; 113 106
+1 -1
include/xen/xenbus.h
··· 92 92 void (*otherend_changed)(struct xenbus_device *dev, 93 93 enum xenbus_state backend_state); 94 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 96 int (*resume)(struct xenbus_device *dev); 97 97 int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *); 98 98 struct device_driver driver;