]> Pileus Git - ~andy/linux/blobdiff - include/xen/xenbus.h
Merge branch 'perf/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/acme...
[~andy/linux] / include / xen / xenbus.h
index b1b6676c1c438485ad48b04db6f8d87f2ed3c432..0a7515c1e3a424214158750aaf1262c05fac0d48 100644 (file)
@@ -85,8 +85,6 @@ struct xenbus_device_id
 
 /* A xenbus driver. */
 struct xenbus_driver {
-       char *name;
-       struct module *owner;
        const struct xenbus_device_id *ids;
        int (*probe)(struct xenbus_device *dev,
                     const struct xenbus_device_id *id);
@@ -101,31 +99,20 @@ struct xenbus_driver {
        int (*is_ready)(struct xenbus_device *dev);
 };
 
-static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv)
-{
-       return container_of(drv, struct xenbus_driver, driver);
+#define DEFINE_XENBUS_DRIVER(var, drvname, methods...)         \
+struct xenbus_driver var ## _driver = {                                \
+       .driver.name = drvname + 0 ?: var ## _ids->devicetype,  \
+       .driver.owner = THIS_MODULE,                            \
+       .ids = var ## _ids, ## methods                          \
 }
 
-int __must_check __xenbus_register_frontend(struct xenbus_driver *drv,
-                                           struct module *owner,
-                                           const char *mod_name);
-
-static inline int __must_check
-xenbus_register_frontend(struct xenbus_driver *drv)
+static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv)
 {
-       WARN_ON(drv->owner != THIS_MODULE);
-       return __xenbus_register_frontend(drv, THIS_MODULE, KBUILD_MODNAME);
+       return container_of(drv, struct xenbus_driver, driver);
 }
 
-int __must_check __xenbus_register_backend(struct xenbus_driver *drv,
-                                          struct module *owner,
-                                          const char *mod_name);
-static inline int __must_check
-xenbus_register_backend(struct xenbus_driver *drv)
-{
-       WARN_ON(drv->owner != THIS_MODULE);
-       return __xenbus_register_backend(drv, THIS_MODULE, KBUILD_MODNAME);
-}
+int __must_check xenbus_register_frontend(struct xenbus_driver *);
+int __must_check xenbus_register_backend(struct xenbus_driver *);
 
 void xenbus_unregister_driver(struct xenbus_driver *drv);
 
@@ -152,9 +139,9 @@ int xenbus_transaction_start(struct xenbus_transaction *t);
 int xenbus_transaction_end(struct xenbus_transaction t, int abort);
 
 /* Single read and scanf: returns -errno or num scanned if > 0. */
+__scanf(4, 5)
 int xenbus_scanf(struct xenbus_transaction t,
-                const char *dir, const char *node, const char *fmt, ...)
-       __attribute__((format(scanf, 4, 5)));
+                const char *dir, const char *node, const char *fmt, ...);
 
 /* Single printf and write: returns -errno or 0. */
 __printf(4, 5)