[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1360694222-27632-4-git-send-email-sameo@linux.intel.com>
Date: Tue, 12 Feb 2013 19:36:53 +0100
From: Samuel Ortiz <sameo@...ux.intel.com>
To: gregkh@...uxfoundation.org
Cc: arnd@...db.de, linux-kernel@...r.kernel.org,
tomas.winkler@...el.com, Samuel Ortiz <sameo@...ux.intel.com>
Subject: [char-misc-next 03/12 v3] mei: bus: Implement driver registration
Signed-off-by: Samuel Ortiz <sameo@...ux.intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@...el.com>
---
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists