aboutsummaryrefslogtreecommitdiffstats
path: root/include/xen/xenbus.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/xen/xenbus.h')
-rw-r--r--include/xen/xenbus.h31
1 files changed, 9 insertions, 22 deletions
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index b1b6676c1c43..e8c599b237c2 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -85,8 +85,6 @@ struct xenbus_device_id
85 85
86/* A xenbus driver. */ 86/* A xenbus driver. */
87struct xenbus_driver { 87struct xenbus_driver {
88 char *name;
89 struct module *owner;
90 const struct xenbus_device_id *ids; 88 const struct xenbus_device_id *ids;
91 int (*probe)(struct xenbus_device *dev, 89 int (*probe)(struct xenbus_device *dev,
92 const struct xenbus_device_id *id); 90 const struct xenbus_device_id *id);
@@ -101,31 +99,20 @@ struct xenbus_driver {
101 int (*is_ready)(struct xenbus_device *dev); 99 int (*is_ready)(struct xenbus_device *dev);
102}; 100};
103 101
104static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv) 102#define DEFINE_XENBUS_DRIVER(var, drvname, methods...) \
105{ 103struct xenbus_driver var ## _driver = { \
106 return container_of(drv, struct xenbus_driver, driver); 104 .driver.name = drvname + 0 ?: var ## _ids->devicetype, \
105 .driver.owner = THIS_MODULE, \
106 .ids = var ## _ids, ## methods \
107} 107}
108 108
109int __must_check __xenbus_register_frontend(struct xenbus_driver *drv, 109static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv)
110 struct module *owner,
111 const char *mod_name);
112
113static inline int __must_check
114xenbus_register_frontend(struct xenbus_driver *drv)
115{ 110{
116 WARN_ON(drv->owner != THIS_MODULE); 111 return container_of(drv, struct xenbus_driver, driver);
117 return __xenbus_register_frontend(drv, THIS_MODULE, KBUILD_MODNAME);
118} 112}
119 113
120int __must_check __xenbus_register_backend(struct xenbus_driver *drv, 114int __must_check xenbus_register_frontend(struct xenbus_driver *);
121 struct module *owner, 115int __must_check xenbus_register_backend(struct xenbus_driver *);
122 const char *mod_name);
123static inline int __must_check
124xenbus_register_backend(struct xenbus_driver *drv)
125{
126 WARN_ON(drv->owner != THIS_MODULE);
127 return __xenbus_register_backend(drv, THIS_MODULE, KBUILD_MODNAME);
128}
129 116
130void xenbus_unregister_driver(struct xenbus_driver *drv); 117void xenbus_unregister_driver(struct xenbus_driver *drv);
131 118