2 * Intel Management Engine Interface (Intel MEI) Linux driver
3 * Copyright (c) 2012-2013, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 #include <linux/module.h>
17 #include <linux/device.h>
18 #include <linux/kernel.h>
19 #include <linux/sched/signal.h>
20 #include <linux/init.h>
21 #include <linux/errno.h>
22 #include <linux/slab.h>
23 #include <linux/mutex.h>
24 #include <linux/interrupt.h>
25 #include <linux/mei_cl_bus.h>
30 #define to_mei_cl_driver(d) container_of(d, struct mei_cl_driver, driver)
33 * __mei_cl_send - internal client send (write)
36 * @buf: buffer to send
37 * @length: buffer length
40 * Return: written size bytes or < 0 on error
42 ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length,
45 struct mei_device *bus;
49 if (WARN_ON(!cl || !cl->dev))
54 mutex_lock(&bus->device_lock);
55 if (bus->dev_state != MEI_DEV_ENABLED) {
60 if (!mei_cl_is_connected(cl)) {
65 /* Check if we have an ME client device */
66 if (!mei_me_cl_is_active(cl->me_cl)) {
71 if (length > mei_cl_mtu(cl)) {
76 while (cl->tx_cb_queued >= bus->tx_queue_limit) {
77 mutex_unlock(&bus->device_lock);
78 rets = wait_event_interruptible(cl->tx_wait,
79 cl->writing_state == MEI_WRITE_COMPLETE ||
80 (!mei_cl_is_connected(cl)));
81 mutex_lock(&bus->device_lock);
83 if (signal_pending(current))
87 if (!mei_cl_is_connected(cl)) {
93 cb = mei_cl_alloc_cb(cl, length, MEI_FOP_WRITE, NULL);
99 cb->internal = !!(mode & MEI_CL_IO_TX_INTERNAL);
100 cb->blocking = !!(mode & MEI_CL_IO_TX_BLOCKING);
101 memcpy(cb->buf.data, buf, length);
103 rets = mei_cl_write(cl, cb);
106 mutex_unlock(&bus->device_lock);
112 * __mei_cl_recv - internal client receive (read)
115 * @buf: buffer to receive
116 * @length: buffer length
118 * @timeout: recv timeout, 0 for infinite timeout
120 * Return: read size in bytes of < 0 on error
122 ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length,
123 unsigned int mode, unsigned long timeout)
125 struct mei_device *bus;
126 struct mei_cl_cb *cb;
129 bool nonblock = !!(mode & MEI_CL_IO_RX_NONBLOCK);
131 if (WARN_ON(!cl || !cl->dev))
136 mutex_lock(&bus->device_lock);
137 if (bus->dev_state != MEI_DEV_ENABLED) {
142 cb = mei_cl_read_cb(cl, NULL);
146 rets = mei_cl_read_start(cl, length, NULL);
147 if (rets && rets != -EBUSY)
155 /* wait on event only if there is no other waiter */
156 /* synchronized under device mutex */
157 if (!waitqueue_active(&cl->rx_wait)) {
159 mutex_unlock(&bus->device_lock);
162 rets = wait_event_interruptible_timeout
164 (!list_empty(&cl->rd_completed)) ||
165 (!mei_cl_is_connected(cl)),
166 msecs_to_jiffies(timeout));
170 if (signal_pending(current))
175 if (wait_event_interruptible
177 (!list_empty(&cl->rd_completed)) ||
178 (!mei_cl_is_connected(cl)))) {
179 if (signal_pending(current))
185 mutex_lock(&bus->device_lock);
187 if (!mei_cl_is_connected(cl)) {
193 cb = mei_cl_read_cb(cl, NULL);
205 r_length = min_t(size_t, length, cb->buf_idx);
206 memcpy(buf, cb->buf.data, r_length);
212 mutex_unlock(&bus->device_lock);
218 * mei_cldev_send - me device send (write)
220 * @cldev: me client device
221 * @buf: buffer to send
222 * @length: buffer length
224 * Return: written size in bytes or < 0 on error
226 ssize_t mei_cldev_send(struct mei_cl_device *cldev, u8 *buf, size_t length)
228 struct mei_cl *cl = cldev->cl;
230 return __mei_cl_send(cl, buf, length, MEI_CL_IO_TX_BLOCKING);
232 EXPORT_SYMBOL_GPL(mei_cldev_send);
235 * mei_cldev_recv_nonblock - non block client receive (read)
237 * @cldev: me client device
238 * @buf: buffer to receive
239 * @length: buffer length
241 * Return: read size in bytes of < 0 on error
242 * -EAGAIN if function will block.
244 ssize_t mei_cldev_recv_nonblock(struct mei_cl_device *cldev, u8 *buf,
247 struct mei_cl *cl = cldev->cl;
249 return __mei_cl_recv(cl, buf, length, MEI_CL_IO_RX_NONBLOCK, 0);
251 EXPORT_SYMBOL_GPL(mei_cldev_recv_nonblock);
254 * mei_cldev_recv - client receive (read)
256 * @cldev: me client device
257 * @buf: buffer to receive
258 * @length: buffer length
260 * Return: read size in bytes of < 0 on error
262 ssize_t mei_cldev_recv(struct mei_cl_device *cldev, u8 *buf, size_t length)
264 struct mei_cl *cl = cldev->cl;
266 return __mei_cl_recv(cl, buf, length, 0, 0);
268 EXPORT_SYMBOL_GPL(mei_cldev_recv);
271 * mei_cl_bus_rx_work - dispatch rx event for a bus device
275 static void mei_cl_bus_rx_work(struct work_struct *work)
277 struct mei_cl_device *cldev;
278 struct mei_device *bus;
280 cldev = container_of(work, struct mei_cl_device, rx_work);
287 mutex_lock(&bus->device_lock);
288 mei_cl_read_start(cldev->cl, mei_cl_mtu(cldev->cl), NULL);
289 mutex_unlock(&bus->device_lock);
293 * mei_cl_bus_notif_work - dispatch FW notif event for a bus device
297 static void mei_cl_bus_notif_work(struct work_struct *work)
299 struct mei_cl_device *cldev;
301 cldev = container_of(work, struct mei_cl_device, notif_work);
304 cldev->notif_cb(cldev);
308 * mei_cl_bus_notify_event - schedule notify cb on bus client
312 * Return: true if event was scheduled
313 * false if the client is not waiting for event
315 bool mei_cl_bus_notify_event(struct mei_cl *cl)
317 struct mei_cl_device *cldev = cl->cldev;
319 if (!cldev || !cldev->notif_cb)
325 schedule_work(&cldev->notif_work);
327 cl->notify_ev = false;
333 * mei_cl_bus_rx_event - schedule rx event
337 * Return: true if event was scheduled
338 * false if the client is not waiting for event
340 bool mei_cl_bus_rx_event(struct mei_cl *cl)
342 struct mei_cl_device *cldev = cl->cldev;
344 if (!cldev || !cldev->rx_cb)
347 schedule_work(&cldev->rx_work);
353 * mei_cldev_register_rx_cb - register Rx event callback
355 * @cldev: me client devices
356 * @rx_cb: callback function
358 * Return: 0 on success
359 * -EALREADY if an callback is already registered
362 int mei_cldev_register_rx_cb(struct mei_cl_device *cldev, mei_cldev_cb_t rx_cb)
364 struct mei_device *bus = cldev->bus;
372 cldev->rx_cb = rx_cb;
373 INIT_WORK(&cldev->rx_work, mei_cl_bus_rx_work);
375 mutex_lock(&bus->device_lock);
376 ret = mei_cl_read_start(cldev->cl, mei_cl_mtu(cldev->cl), NULL);
377 mutex_unlock(&bus->device_lock);
378 if (ret && ret != -EBUSY)
383 EXPORT_SYMBOL_GPL(mei_cldev_register_rx_cb);
386 * mei_cldev_register_notif_cb - register FW notification event callback
388 * @cldev: me client devices
389 * @notif_cb: callback function
391 * Return: 0 on success
392 * -EALREADY if an callback is already registered
395 int mei_cldev_register_notif_cb(struct mei_cl_device *cldev,
396 mei_cldev_cb_t notif_cb)
398 struct mei_device *bus = cldev->bus;
407 cldev->notif_cb = notif_cb;
408 INIT_WORK(&cldev->notif_work, mei_cl_bus_notif_work);
410 mutex_lock(&bus->device_lock);
411 ret = mei_cl_notify_request(cldev->cl, NULL, 1);
412 mutex_unlock(&bus->device_lock);
418 EXPORT_SYMBOL_GPL(mei_cldev_register_notif_cb);
421 * mei_cldev_get_drvdata - driver data getter
423 * @cldev: mei client device
425 * Return: driver private data
427 void *mei_cldev_get_drvdata(const struct mei_cl_device *cldev)
429 return dev_get_drvdata(&cldev->dev);
431 EXPORT_SYMBOL_GPL(mei_cldev_get_drvdata);
434 * mei_cldev_set_drvdata - driver data setter
436 * @cldev: mei client device
437 * @data: data to store
439 void mei_cldev_set_drvdata(struct mei_cl_device *cldev, void *data)
441 dev_set_drvdata(&cldev->dev, data);
443 EXPORT_SYMBOL_GPL(mei_cldev_set_drvdata);
446 * mei_cldev_uuid - return uuid of the underlying me client
448 * @cldev: mei client device
450 * Return: me client uuid
452 const uuid_le *mei_cldev_uuid(const struct mei_cl_device *cldev)
454 return mei_me_cl_uuid(cldev->me_cl);
456 EXPORT_SYMBOL_GPL(mei_cldev_uuid);
459 * mei_cldev_ver - return protocol version of the underlying me client
461 * @cldev: mei client device
463 * Return: me client protocol version
465 u8 mei_cldev_ver(const struct mei_cl_device *cldev)
467 return mei_me_cl_ver(cldev->me_cl);
469 EXPORT_SYMBOL_GPL(mei_cldev_ver);
472 * mei_cldev_enabled - check whether the device is enabled
474 * @cldev: mei client device
476 * Return: true if me client is initialized and connected
478 bool mei_cldev_enabled(struct mei_cl_device *cldev)
480 return mei_cl_is_connected(cldev->cl);
482 EXPORT_SYMBOL_GPL(mei_cldev_enabled);
485 * mei_cl_bus_module_get - acquire module of the underlying
488 * @cldev: mei client device
490 * Return: true on success; false if the module was removed.
492 static bool mei_cl_bus_module_get(struct mei_cl_device *cldev)
494 return try_module_get(cldev->bus->dev->driver->owner);
498 * mei_cl_bus_module_put - release the underlying hw module.
500 * @cldev: mei client device
502 static void mei_cl_bus_module_put(struct mei_cl_device *cldev)
504 module_put(cldev->bus->dev->driver->owner);
508 * mei_cldev_enable - enable me client device
509 * create connection with me client
511 * @cldev: me client device
513 * Return: 0 on success and < 0 on error
515 int mei_cldev_enable(struct mei_cl_device *cldev)
517 struct mei_device *bus = cldev->bus;
523 mutex_lock(&bus->device_lock);
524 if (cl->state == MEI_FILE_UNINITIALIZED) {
525 ret = mei_cl_link(cl);
528 /* update pointers */
532 if (mei_cl_is_connected(cl)) {
537 if (!mei_me_cl_is_active(cldev->me_cl)) {
538 dev_err(&cldev->dev, "me client is not active\n");
543 ret = mei_cl_connect(cl, cldev->me_cl, NULL);
545 dev_err(&cldev->dev, "cannot connect\n");
548 mutex_unlock(&bus->device_lock);
552 EXPORT_SYMBOL_GPL(mei_cldev_enable);
555 * mei_cldev_unregister_callbacks - internal wrapper for unregistering
558 * @cldev: client device
560 static void mei_cldev_unregister_callbacks(struct mei_cl_device *cldev)
563 cancel_work_sync(&cldev->rx_work);
567 if (cldev->notif_cb) {
568 cancel_work_sync(&cldev->notif_work);
569 cldev->notif_cb = NULL;
574 * mei_cldev_disable - disable me client device
575 * disconnect form the me client
577 * @cldev: me client device
579 * Return: 0 on success and < 0 on error
581 int mei_cldev_disable(struct mei_cl_device *cldev)
583 struct mei_device *bus;
594 mei_cldev_unregister_callbacks(cldev);
596 mutex_lock(&bus->device_lock);
598 if (!mei_cl_is_connected(cl)) {
599 dev_dbg(bus->dev, "Already disconnected\n");
604 err = mei_cl_disconnect(cl);
606 dev_err(bus->dev, "Could not disconnect from the ME client\n");
609 /* Flush queues and remove any pending read */
610 mei_cl_flush_queues(cl, NULL);
613 mutex_unlock(&bus->device_lock);
616 EXPORT_SYMBOL_GPL(mei_cldev_disable);
619 * mei_cl_device_find - find matching entry in the driver id table
621 * @cldev: me client device
622 * @cldrv: me client driver
624 * Return: id on success; NULL if no id is matching
627 struct mei_cl_device_id *mei_cl_device_find(struct mei_cl_device *cldev,
628 struct mei_cl_driver *cldrv)
630 const struct mei_cl_device_id *id;
635 uuid = mei_me_cl_uuid(cldev->me_cl);
636 version = mei_me_cl_ver(cldev->me_cl);
638 id = cldrv->id_table;
639 while (uuid_le_cmp(NULL_UUID_LE, id->uuid)) {
640 if (!uuid_le_cmp(*uuid, id->uuid)) {
644 if (strncmp(cldev->name, id->name,
648 if (id->version != MEI_CL_VERSION_ANY)
649 if (id->version != version)
662 * mei_cl_device_match - device match function
667 * Return: 1 if matching device was found 0 otherwise
669 static int mei_cl_device_match(struct device *dev, struct device_driver *drv)
671 struct mei_cl_device *cldev = to_mei_cl_device(dev);
672 struct mei_cl_driver *cldrv = to_mei_cl_driver(drv);
673 const struct mei_cl_device_id *found_id;
678 if (!cldev->do_match)
681 if (!cldrv || !cldrv->id_table)
684 found_id = mei_cl_device_find(cldev, cldrv);
692 * mei_cl_device_probe - bus probe function
696 * Return: 0 on success; < 0 otherwise
698 static int mei_cl_device_probe(struct device *dev)
700 struct mei_cl_device *cldev;
701 struct mei_cl_driver *cldrv;
702 const struct mei_cl_device_id *id;
705 cldev = to_mei_cl_device(dev);
706 cldrv = to_mei_cl_driver(dev->driver);
711 if (!cldrv || !cldrv->probe)
714 id = mei_cl_device_find(cldev, cldrv);
718 if (!mei_cl_bus_module_get(cldev)) {
719 dev_err(&cldev->dev, "get hw module failed");
723 ret = cldrv->probe(cldev, id);
725 mei_cl_bus_module_put(cldev);
729 __module_get(THIS_MODULE);
734 * mei_cl_device_remove - remove device from the bus
738 * Return: 0 on success; < 0 otherwise
740 static int mei_cl_device_remove(struct device *dev)
742 struct mei_cl_device *cldev = to_mei_cl_device(dev);
743 struct mei_cl_driver *cldrv;
746 if (!cldev || !dev->driver)
749 cldrv = to_mei_cl_driver(dev->driver);
751 ret = cldrv->remove(cldev);
753 mei_cldev_unregister_callbacks(cldev);
755 mei_cl_bus_module_put(cldev);
756 module_put(THIS_MODULE);
762 static ssize_t name_show(struct device *dev, struct device_attribute *a,
765 struct mei_cl_device *cldev = to_mei_cl_device(dev);
767 return scnprintf(buf, PAGE_SIZE, "%s", cldev->name);
769 static DEVICE_ATTR_RO(name);
771 static ssize_t uuid_show(struct device *dev, struct device_attribute *a,
774 struct mei_cl_device *cldev = to_mei_cl_device(dev);
775 const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl);
777 return scnprintf(buf, PAGE_SIZE, "%pUl", uuid);
779 static DEVICE_ATTR_RO(uuid);
781 static ssize_t version_show(struct device *dev, struct device_attribute *a,
784 struct mei_cl_device *cldev = to_mei_cl_device(dev);
785 u8 version = mei_me_cl_ver(cldev->me_cl);
787 return scnprintf(buf, PAGE_SIZE, "%02X", version);
789 static DEVICE_ATTR_RO(version);
791 static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
794 struct mei_cl_device *cldev = to_mei_cl_device(dev);
795 const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl);
796 u8 version = mei_me_cl_ver(cldev->me_cl);
798 return scnprintf(buf, PAGE_SIZE, "mei:%s:%pUl:%02X:",
799 cldev->name, uuid, version);
801 static DEVICE_ATTR_RO(modalias);
803 static struct attribute *mei_cldev_attrs[] = {
806 &dev_attr_version.attr,
807 &dev_attr_modalias.attr,
810 ATTRIBUTE_GROUPS(mei_cldev);
813 * mei_cl_device_uevent - me client bus uevent handler
816 * @env: uevent kobject
818 * Return: 0 on success -ENOMEM on when add_uevent_var fails
820 static int mei_cl_device_uevent(struct device *dev, struct kobj_uevent_env *env)
822 struct mei_cl_device *cldev = to_mei_cl_device(dev);
823 const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl);
824 u8 version = mei_me_cl_ver(cldev->me_cl);
826 if (add_uevent_var(env, "MEI_CL_VERSION=%d", version))
829 if (add_uevent_var(env, "MEI_CL_UUID=%pUl", uuid))
832 if (add_uevent_var(env, "MEI_CL_NAME=%s", cldev->name))
835 if (add_uevent_var(env, "MODALIAS=mei:%s:%pUl:%02X:",
836 cldev->name, uuid, version))
842 static struct bus_type mei_cl_bus_type = {
844 .dev_groups = mei_cldev_groups,
845 .match = mei_cl_device_match,
846 .probe = mei_cl_device_probe,
847 .remove = mei_cl_device_remove,
848 .uevent = mei_cl_device_uevent,
851 static struct mei_device *mei_dev_bus_get(struct mei_device *bus)
854 get_device(bus->dev);
859 static void mei_dev_bus_put(struct mei_device *bus)
862 put_device(bus->dev);
865 static void mei_cl_bus_dev_release(struct device *dev)
867 struct mei_cl_device *cldev = to_mei_cl_device(dev);
872 mei_me_cl_put(cldev->me_cl);
873 mei_dev_bus_put(cldev->bus);
874 mei_cl_unlink(cldev->cl);
879 static const struct device_type mei_cl_device_type = {
880 .release = mei_cl_bus_dev_release,
884 * mei_cl_bus_set_name - set device name for me client device
886 * @cldev: me client device
888 static inline void mei_cl_bus_set_name(struct mei_cl_device *cldev)
890 dev_set_name(&cldev->dev, "mei:%s:%pUl:%02X",
892 mei_me_cl_uuid(cldev->me_cl),
893 mei_me_cl_ver(cldev->me_cl));
897 * mei_cl_bus_dev_alloc - initialize and allocate mei client device
902 * Return: allocated device structur or NULL on allocation failure
904 static struct mei_cl_device *mei_cl_bus_dev_alloc(struct mei_device *bus,
905 struct mei_me_client *me_cl)
907 struct mei_cl_device *cldev;
910 cldev = kzalloc(sizeof(struct mei_cl_device), GFP_KERNEL);
914 cl = mei_cl_allocate(bus);
920 device_initialize(&cldev->dev);
921 cldev->dev.parent = bus->dev;
922 cldev->dev.bus = &mei_cl_bus_type;
923 cldev->dev.type = &mei_cl_device_type;
924 cldev->bus = mei_dev_bus_get(bus);
925 cldev->me_cl = mei_me_cl_get(me_cl);
927 mei_cl_bus_set_name(cldev);
929 INIT_LIST_HEAD(&cldev->bus_list);
935 * mei_cl_dev_setup - setup me client device
936 * run fix up routines and set the device name
939 * @cldev: me client device
941 * Return: true if the device is eligible for enumeration
943 static bool mei_cl_bus_dev_setup(struct mei_device *bus,
944 struct mei_cl_device *cldev)
947 mei_cl_bus_dev_fixup(cldev);
949 /* the device name can change during fix up */
951 mei_cl_bus_set_name(cldev);
953 return cldev->do_match == 1;
957 * mei_cl_bus_dev_add - add me client devices
959 * @cldev: me client device
961 * Return: 0 on success; < 0 on failre
963 static int mei_cl_bus_dev_add(struct mei_cl_device *cldev)
967 dev_dbg(cldev->bus->dev, "adding %pUL:%02X\n",
968 mei_me_cl_uuid(cldev->me_cl),
969 mei_me_cl_ver(cldev->me_cl));
970 ret = device_add(&cldev->dev);
978 * mei_cl_bus_dev_stop - stop the driver
980 * @cldev: me client device
982 static void mei_cl_bus_dev_stop(struct mei_cl_device *cldev)
985 device_release_driver(&cldev->dev);
989 * mei_cl_bus_dev_destroy - destroy me client devices object
991 * @cldev: me client device
993 * Locking: called under "dev->cl_bus_lock" lock
995 static void mei_cl_bus_dev_destroy(struct mei_cl_device *cldev)
998 WARN_ON(!mutex_is_locked(&cldev->bus->cl_bus_lock));
1000 if (!cldev->is_added)
1003 device_del(&cldev->dev);
1005 list_del_init(&cldev->bus_list);
1007 cldev->is_added = 0;
1008 put_device(&cldev->dev);
1012 * mei_cl_bus_remove_device - remove a devices form the bus
1014 * @cldev: me client device
1016 static void mei_cl_bus_remove_device(struct mei_cl_device *cldev)
1018 mei_cl_bus_dev_stop(cldev);
1019 mei_cl_bus_dev_destroy(cldev);
1023 * mei_cl_bus_remove_devices - remove all devices form the bus
1027 void mei_cl_bus_remove_devices(struct mei_device *bus)
1029 struct mei_cl_device *cldev, *next;
1031 mutex_lock(&bus->cl_bus_lock);
1032 list_for_each_entry_safe(cldev, next, &bus->device_list, bus_list)
1033 mei_cl_bus_remove_device(cldev);
1034 mutex_unlock(&bus->cl_bus_lock);
1039 * mei_cl_bus_dev_init - allocate and initializes an mei client devices
1040 * based on me client
1045 * Locking: called under "dev->cl_bus_lock" lock
1047 static void mei_cl_bus_dev_init(struct mei_device *bus,
1048 struct mei_me_client *me_cl)
1050 struct mei_cl_device *cldev;
1052 WARN_ON(!mutex_is_locked(&bus->cl_bus_lock));
1054 dev_dbg(bus->dev, "initializing %pUl", mei_me_cl_uuid(me_cl));
1056 if (me_cl->bus_added)
1059 cldev = mei_cl_bus_dev_alloc(bus, me_cl);
1063 me_cl->bus_added = true;
1064 list_add_tail(&cldev->bus_list, &bus->device_list);
1069 * mei_cl_bus_rescan - scan me clients list and add create
1070 * devices for eligible clients
1074 static void mei_cl_bus_rescan(struct mei_device *bus)
1076 struct mei_cl_device *cldev, *n;
1077 struct mei_me_client *me_cl;
1079 mutex_lock(&bus->cl_bus_lock);
1081 down_read(&bus->me_clients_rwsem);
1082 list_for_each_entry(me_cl, &bus->me_clients, list)
1083 mei_cl_bus_dev_init(bus, me_cl);
1084 up_read(&bus->me_clients_rwsem);
1086 list_for_each_entry_safe(cldev, n, &bus->device_list, bus_list) {
1088 if (!mei_me_cl_is_active(cldev->me_cl)) {
1089 mei_cl_bus_remove_device(cldev);
1093 if (cldev->is_added)
1096 if (mei_cl_bus_dev_setup(bus, cldev))
1097 mei_cl_bus_dev_add(cldev);
1099 list_del_init(&cldev->bus_list);
1100 put_device(&cldev->dev);
1103 mutex_unlock(&bus->cl_bus_lock);
1105 dev_dbg(bus->dev, "rescan end");
1108 void mei_cl_bus_rescan_work(struct work_struct *work)
1110 struct mei_device *bus =
1111 container_of(work, struct mei_device, bus_rescan_work);
1113 mei_cl_bus_rescan(bus);
1116 int __mei_cldev_driver_register(struct mei_cl_driver *cldrv,
1117 struct module *owner)
1121 cldrv->driver.name = cldrv->name;
1122 cldrv->driver.owner = owner;
1123 cldrv->driver.bus = &mei_cl_bus_type;
1125 err = driver_register(&cldrv->driver);
1129 pr_debug("mei: driver [%s] registered\n", cldrv->driver.name);
1133 EXPORT_SYMBOL_GPL(__mei_cldev_driver_register);
1135 void mei_cldev_driver_unregister(struct mei_cl_driver *cldrv)
1137 driver_unregister(&cldrv->driver);
1139 pr_debug("mei: driver [%s] unregistered\n", cldrv->driver.name);
1141 EXPORT_SYMBOL_GPL(mei_cldev_driver_unregister);
1144 int __init mei_cl_bus_init(void)
1146 return bus_register(&mei_cl_bus_type);
1149 void __exit mei_cl_bus_exit(void)
1151 bus_unregister(&mei_cl_bus_type);