diff options
Diffstat (limited to 'include/xen/xenbus.h')
-rw-r--r-- | include/xen/xenbus.h | 31 |
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. */ |
87 | struct xenbus_driver { | 87 | struct 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 | ||
104 | static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv) | 102 | #define DEFINE_XENBUS_DRIVER(var, drvname, methods...) \ |
105 | { | 103 | struct 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 | ||
109 | int __must_check __xenbus_register_frontend(struct xenbus_driver *drv, | 109 | static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv) |
110 | struct module *owner, | ||
111 | const char *mod_name); | ||
112 | |||
113 | static inline int __must_check | ||
114 | xenbus_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 | ||
120 | int __must_check __xenbus_register_backend(struct xenbus_driver *drv, | 114 | int __must_check xenbus_register_frontend(struct xenbus_driver *); |
121 | struct module *owner, | 115 | int __must_check xenbus_register_backend(struct xenbus_driver *); |
122 | const char *mod_name); | ||
123 | static inline int __must_check | ||
124 | xenbus_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 | ||
130 | void xenbus_unregister_driver(struct xenbus_driver *drv); | 117 | void xenbus_unregister_driver(struct xenbus_driver *drv); |
131 | 118 | ||