mei: bus: Implement driver registration
authorSamuel Ortiz <sameo@linux.intel.com>
Wed, 27 Mar 2013 15:29:54 +0000 (17:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Mar 2013 15:35:47 +0000 (08:35 -0700)
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mei/bus.c
include/linux/mei_cl_bus.h

index 78c876af2676803812e41204c0075b1d627e8094..d16b3c3e1b38820f35765515f9582eb531c75af2 100644 (file)
@@ -170,3 +170,29 @@ void mei_cl_remove_device(struct mei_cl_device *device)
        device_unregister(&device->dev);
 }
 EXPORT_SYMBOL_GPL(mei_cl_remove_device);
+
+int __mei_cl_driver_register(struct mei_cl_driver *driver, struct module *owner)
+{
+       int err;
+
+       driver->driver.name = driver->name;
+       driver->driver.owner = owner;
+       driver->driver.bus = &mei_cl_bus_type;
+
+       err = driver_register(&driver->driver);
+       if (err)
+               return err;
+
+       pr_debug("mei: driver [%s] registered\n", driver->driver.name);
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(__mei_cl_driver_register);
+
+void mei_cl_driver_unregister(struct mei_cl_driver *driver)
+{
+       driver_unregister(&driver->driver);
+
+       pr_debug("mei: driver [%s] unregistered\n", driver->driver.name);
+}
+EXPORT_SYMBOL_GPL(mei_cl_driver_unregister);
index 4e7351de7eca496566aec9413e9472e40c2c6472..ba2aa3b66f309dca943ad1c9d05c4c669e15e5a9 100644 (file)
@@ -17,4 +17,11 @@ struct mei_cl_driver {
        int (*remove)(struct mei_cl_device *dev);
 };
 
+int __mei_cl_driver_register(struct mei_cl_driver *driver,
+                               struct module *owner);
+#define mei_cl_driver_register(driver)             \
+       __mei_cl_driver_register(driver, THIS_MODULE)
+
+void mei_cl_driver_unregister(struct mei_cl_driver *driver);
+
 #endif /* _LINUX_MEI_CL_BUS_H */