[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1360270997-7639-3-git-send-email-tomas.winkler@intel.com>
Date: Thu, 7 Feb 2013 23:03:08 +0200
From: Tomas Winkler <tomas.winkler@...el.com>
To: gregkh@...uxfoundation.org, sameo@...ux.intel.com
Cc: arnd@...db.de, linux-kernel@...r.kernel.org,
Tomas Winkler <tomas.winkler@...el.com>
Subject: [char-misc-next 02/11] mei: bus: Implement driver registration
From: Samuel Ortiz <sameo@...ux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@...ux.intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@...el.com>
---
drivers/misc/mei/bus.c | 29 +++++++++++++++++++++++++++++
include/linux/mei_bus.h | 3 +++
2 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index bb96423c..ea24e7c 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -153,3 +153,32 @@ void mei_remove_device(struct mei_bus_client *client)
device_unregister(&client->dev);
}
EXPORT_SYMBOL(mei_remove_device);
+
+int mei_add_driver(struct mei_bus_driver *driver)
+{
+ int err;
+
+ /* Can't register until after driver model init */
+ if (unlikely(WARN_ON(!mei_bus_type.p)))
+ return -EAGAIN;
+
+ driver->driver.owner = THIS_MODULE;
+ 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(mei_add_driver);
+
+void mei_del_driver(struct mei_bus_driver *driver)
+{
+ driver_unregister(&driver->driver);
+
+ pr_debug("mei: driver [%s] unregistered\n", driver->driver.name);
+}
+EXPORT_SYMBOL(mei_del_driver);
diff --git a/include/linux/mei_bus.h b/include/linux/mei_bus.h
index 3a53f9e..395f573 100644
--- a/include/linux/mei_bus.h
+++ b/include/linux/mei_bus.h
@@ -88,4 +88,7 @@ struct mei_bus_driver {
int (*remove)(struct mei_bus_client *client);
};
+int mei_add_driver(struct mei_bus_driver *driver);
+void mei_del_driver(struct mei_bus_driver *driver);
+
#endif /* _LINUX_MEI_BUS_H */
--
1.7.4.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