[char-misc-next 03/12 v3] mei: bus: Implement driver registration
From: Samuel Ortiz
Date: Tue Feb 12 2013 - 13:39:44 EST
Signed-off-by: Samuel Ortiz <sameo@xxxxxxxxxxxxxxx>
Signed-off-by: Tomas Winkler <tomas.winkler@xxxxxxxxx>
---
drivers/misc/mei/bus.c | 26 ++++++++++++++++++++++++++
include/linux/mei_bus.h | 6 ++++++
2 files changed, 32 insertions(+)
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index 485fcf3c..04e7ada 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -149,3 +149,29 @@ void mei_remove_device(struct mei_device *device)
device_unregister(&device->dev);
}
EXPORT_SYMBOL_GPL(mei_remove_device);
+
+int __mei_driver_register(struct mei_driver *driver, struct module *owner)
+{
+ int err;
+
+ driver->driver.name = driver->name;
+ driver->driver.owner = owner;
+ driver->driver.bus = &mei_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_driver_register);
+
+void mei_driver_unregister(struct mei_driver *driver)
+{
+ driver_unregister(&driver->driver);
+
+ pr_debug("mei: driver [%s] unregistered\n", driver->driver.name);
+}
+EXPORT_SYMBOL_GPL(mei_driver_unregister);
diff --git a/include/linux/mei_bus.h b/include/linux/mei_bus.h
index 6506cb7..28be556 100644
--- a/include/linux/mei_bus.h
+++ b/include/linux/mei_bus.h
@@ -89,4 +89,10 @@ struct mei_driver {
int (*remove)(struct mei_device *dev);
};
+int __mei_driver_register(struct mei_driver *driver, struct module *owner);
+#define mei_driver_register(driver) \
+ __mei_driver_register(driver, THIS_MODULE)
+
+void mei_driver_unregister(struct mei_driver *driver);
+
#endif /* _LINUX_MEI_BUS_H */
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/