2 * The Serio abstraction module
4 * Copyright (c) 1999-2004 Vojtech Pavlik
5 * Copyright (c) 2004 Dmitry Torokhov
6 * Copyright (c) 2003 Daniele Bellucci
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * Should you need to contact me, the author, you can do so either by
25 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
26 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
29 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31 #include <linux/stddef.h>
32 #include <linux/module.h>
33 #include <linux/serio.h>
34 #include <linux/errno.h>
35 #include <linux/wait.h>
36 #include <linux/sched.h>
37 #include <linux/slab.h>
38 #include <linux/kthread.h>
39 #include <linux/mutex.h>
41 MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
42 MODULE_DESCRIPTION("Serio abstraction core");
43 MODULE_LICENSE("GPL");
46 * serio_mutex protects entire serio subsystem and is taken every time
47 * serio port or driver registrered or unregistered.
49 static DEFINE_MUTEX(serio_mutex);
51 static LIST_HEAD(serio_list);
53 static struct bus_type serio_bus;
55 static void serio_add_port(struct serio *serio);
56 static int serio_reconnect_port(struct serio *serio);
57 static void serio_disconnect_port(struct serio *serio);
58 static void serio_reconnect_chain(struct serio *serio);
59 static void serio_attach_driver(struct serio_driver *drv);
61 static int serio_connect_driver(struct serio *serio, struct serio_driver *drv)
65 mutex_lock(&serio->drv_mutex);
66 retval = drv->connect(serio, drv);
67 mutex_unlock(&serio->drv_mutex);
72 static int serio_reconnect_driver(struct serio *serio)
76 mutex_lock(&serio->drv_mutex);
77 if (serio->drv && serio->drv->reconnect)
78 retval = serio->drv->reconnect(serio);
79 mutex_unlock(&serio->drv_mutex);
84 static void serio_disconnect_driver(struct serio *serio)
86 mutex_lock(&serio->drv_mutex);
88 serio->drv->disconnect(serio);
89 mutex_unlock(&serio->drv_mutex);
92 static int serio_match_port(const struct serio_device_id *ids, struct serio *serio)
94 while (ids->type || ids->proto) {
95 if ((ids->type == SERIO_ANY || ids->type == serio->id.type) &&
96 (ids->proto == SERIO_ANY || ids->proto == serio->id.proto) &&
97 (ids->extra == SERIO_ANY || ids->extra == serio->id.extra) &&
98 (ids->id == SERIO_ANY || ids->id == serio->id.id))
106 * Basic serio -> driver core mappings
109 static int serio_bind_driver(struct serio *serio, struct serio_driver *drv)
113 if (serio_match_port(drv->id_table, serio)) {
115 serio->dev.driver = &drv->driver;
116 if (serio_connect_driver(serio, drv)) {
117 serio->dev.driver = NULL;
121 error = device_bind_driver(&serio->dev);
123 dev_warn(&serio->dev,
124 "device_bind_driver() failed for %s (%s) and %s, error: %d\n",
125 serio->phys, serio->name,
126 drv->description, error);
127 serio_disconnect_driver(serio);
128 serio->dev.driver = NULL;
135 static void serio_find_driver(struct serio *serio)
139 error = device_attach(&serio->dev);
141 dev_warn(&serio->dev,
142 "device_attach() failed for %s (%s), error: %d\n",
143 serio->phys, serio->name, error);
148 * Serio event processing.
151 enum serio_event_type {
153 SERIO_RECONNECT_PORT,
154 SERIO_RECONNECT_CHAIN,
160 enum serio_event_type type;
162 struct module *owner;
163 struct list_head node;
166 static DEFINE_SPINLOCK(serio_event_lock); /* protects serio_event_list */
167 static LIST_HEAD(serio_event_list);
168 static DECLARE_WAIT_QUEUE_HEAD(serio_wait);
169 static struct task_struct *serio_task;
171 static int serio_queue_event(void *object, struct module *owner,
172 enum serio_event_type event_type)
175 struct serio_event *event;
178 spin_lock_irqsave(&serio_event_lock, flags);
181 * Scan event list for the other events for the same serio port,
182 * starting with the most recent one. If event is the same we
183 * do not need add new one. If event is of different type we
184 * need to add this event and should not look further because
185 * we need to preseve sequence of distinct events.
187 list_for_each_entry_reverse(event, &serio_event_list, node) {
188 if (event->object == object) {
189 if (event->type == event_type)
195 event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC);
197 pr_err("Not enough memory to queue event %d\n", event_type);
202 if (!try_module_get(owner)) {
203 pr_warning("Can't get module reference, dropping event %d\n",
210 event->type = event_type;
211 event->object = object;
212 event->owner = owner;
214 list_add_tail(&event->node, &serio_event_list);
215 wake_up(&serio_wait);
218 spin_unlock_irqrestore(&serio_event_lock, flags);
222 static void serio_free_event(struct serio_event *event)
224 module_put(event->owner);
228 static void serio_remove_duplicate_events(struct serio_event *event)
230 struct serio_event *e, *next;
233 spin_lock_irqsave(&serio_event_lock, flags);
235 list_for_each_entry_safe(e, next, &serio_event_list, node) {
236 if (event->object == e->object) {
238 * If this event is of different type we should not
239 * look further - we only suppress duplicate events
240 * that were sent back-to-back.
242 if (event->type != e->type)
245 list_del_init(&e->node);
250 spin_unlock_irqrestore(&serio_event_lock, flags);
254 static struct serio_event *serio_get_event(void)
256 struct serio_event *event = NULL;
259 spin_lock_irqsave(&serio_event_lock, flags);
261 if (!list_empty(&serio_event_list)) {
262 event = list_first_entry(&serio_event_list,
263 struct serio_event, node);
264 list_del_init(&event->node);
267 spin_unlock_irqrestore(&serio_event_lock, flags);
271 static void serio_handle_event(void)
273 struct serio_event *event;
275 mutex_lock(&serio_mutex);
277 while ((event = serio_get_event())) {
279 switch (event->type) {
281 case SERIO_REGISTER_PORT:
282 serio_add_port(event->object);
285 case SERIO_RECONNECT_PORT:
286 serio_reconnect_port(event->object);
289 case SERIO_RESCAN_PORT:
290 serio_disconnect_port(event->object);
291 serio_find_driver(event->object);
294 case SERIO_RECONNECT_CHAIN:
295 serio_reconnect_chain(event->object);
298 case SERIO_ATTACH_DRIVER:
299 serio_attach_driver(event->object);
303 serio_remove_duplicate_events(event);
304 serio_free_event(event);
307 mutex_unlock(&serio_mutex);
311 * Remove all events that have been submitted for a given
312 * object, be it serio port or driver.
314 static void serio_remove_pending_events(void *object)
316 struct serio_event *event, *next;
319 spin_lock_irqsave(&serio_event_lock, flags);
321 list_for_each_entry_safe(event, next, &serio_event_list, node) {
322 if (event->object == object) {
323 list_del_init(&event->node);
324 serio_free_event(event);
328 spin_unlock_irqrestore(&serio_event_lock, flags);
332 * Destroy child serio port (if any) that has not been fully registered yet.
334 * Note that we rely on the fact that port can have only one child and therefore
335 * only one child registration request can be pending. Additionally, children
336 * are registered by driver's connect() handler so there can't be a grandchild
337 * pending registration together with a child.
339 static struct serio *serio_get_pending_child(struct serio *parent)
341 struct serio_event *event;
342 struct serio *serio, *child = NULL;
345 spin_lock_irqsave(&serio_event_lock, flags);
347 list_for_each_entry(event, &serio_event_list, node) {
348 if (event->type == SERIO_REGISTER_PORT) {
349 serio = event->object;
350 if (serio->parent == parent) {
357 spin_unlock_irqrestore(&serio_event_lock, flags);
361 static int serio_thread(void *nothing)
364 serio_handle_event();
365 wait_event_interruptible(serio_wait,
366 kthread_should_stop() || !list_empty(&serio_event_list));
367 } while (!kthread_should_stop());
374 * Serio port operations
377 static ssize_t serio_show_description(struct device *dev, struct device_attribute *attr, char *buf)
379 struct serio *serio = to_serio_port(dev);
380 return sprintf(buf, "%s\n", serio->name);
383 static ssize_t serio_show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
385 struct serio *serio = to_serio_port(dev);
387 return sprintf(buf, "serio:ty%02Xpr%02Xid%02Xex%02X\n",
388 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
391 static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf)
393 struct serio *serio = to_serio_port(dev);
394 return sprintf(buf, "%02x\n", serio->id.type);
397 static ssize_t serio_show_id_proto(struct device *dev, struct device_attribute *attr, char *buf)
399 struct serio *serio = to_serio_port(dev);
400 return sprintf(buf, "%02x\n", serio->id.proto);
403 static ssize_t serio_show_id_id(struct device *dev, struct device_attribute *attr, char *buf)
405 struct serio *serio = to_serio_port(dev);
406 return sprintf(buf, "%02x\n", serio->id.id);
409 static ssize_t serio_show_id_extra(struct device *dev, struct device_attribute *attr, char *buf)
411 struct serio *serio = to_serio_port(dev);
412 return sprintf(buf, "%02x\n", serio->id.extra);
415 static DEVICE_ATTR(type, S_IRUGO, serio_show_id_type, NULL);
416 static DEVICE_ATTR(proto, S_IRUGO, serio_show_id_proto, NULL);
417 static DEVICE_ATTR(id, S_IRUGO, serio_show_id_id, NULL);
418 static DEVICE_ATTR(extra, S_IRUGO, serio_show_id_extra, NULL);
420 static struct attribute *serio_device_id_attrs[] = {
422 &dev_attr_proto.attr,
424 &dev_attr_extra.attr,
428 static struct attribute_group serio_id_attr_group = {
430 .attrs = serio_device_id_attrs,
433 static const struct attribute_group *serio_device_attr_groups[] = {
434 &serio_id_attr_group,
438 static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
440 struct serio *serio = to_serio_port(dev);
441 struct device_driver *drv;
444 error = mutex_lock_interruptible(&serio_mutex);
448 if (!strncmp(buf, "none", count)) {
449 serio_disconnect_port(serio);
450 } else if (!strncmp(buf, "reconnect", count)) {
451 serio_reconnect_chain(serio);
452 } else if (!strncmp(buf, "rescan", count)) {
453 serio_disconnect_port(serio);
454 serio_find_driver(serio);
455 } else if ((drv = driver_find(buf, &serio_bus)) != NULL) {
456 serio_disconnect_port(serio);
457 error = serio_bind_driver(serio, to_serio_driver(drv));
463 mutex_unlock(&serio_mutex);
465 return error ? error : count;
468 static ssize_t serio_show_bind_mode(struct device *dev, struct device_attribute *attr, char *buf)
470 struct serio *serio = to_serio_port(dev);
471 return sprintf(buf, "%s\n", serio->manual_bind ? "manual" : "auto");
474 static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
476 struct serio *serio = to_serio_port(dev);
480 if (!strncmp(buf, "manual", count)) {
481 serio->manual_bind = true;
482 } else if (!strncmp(buf, "auto", count)) {
483 serio->manual_bind = false;
491 static struct device_attribute serio_device_attrs[] = {
492 __ATTR(description, S_IRUGO, serio_show_description, NULL),
493 __ATTR(modalias, S_IRUGO, serio_show_modalias, NULL),
494 __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver),
495 __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode),
500 static void serio_release_port(struct device *dev)
502 struct serio *serio = to_serio_port(dev);
505 module_put(THIS_MODULE);
509 * Prepare serio port for registration.
511 static void serio_init_port(struct serio *serio)
513 static atomic_t serio_no = ATOMIC_INIT(0);
515 __module_get(THIS_MODULE);
517 INIT_LIST_HEAD(&serio->node);
518 spin_lock_init(&serio->lock);
519 mutex_init(&serio->drv_mutex);
520 device_initialize(&serio->dev);
521 dev_set_name(&serio->dev, "serio%ld",
522 (long)atomic_inc_return(&serio_no) - 1);
523 serio->dev.bus = &serio_bus;
524 serio->dev.release = serio_release_port;
525 serio->dev.groups = serio_device_attr_groups;
527 serio->dev.parent = &serio->parent->dev;
528 serio->depth = serio->parent->depth + 1;
531 lockdep_set_subclass(&serio->lock, serio->depth);
535 * Complete serio port registration.
536 * Driver core will attempt to find appropriate driver for the port.
538 static void serio_add_port(struct serio *serio)
543 serio_pause_rx(serio->parent);
544 serio->parent->child = serio;
545 serio_continue_rx(serio->parent);
548 list_add_tail(&serio->node, &serio_list);
553 error = device_add(&serio->dev);
556 "device_add() failed for %s (%s), error: %d\n",
557 serio->phys, serio->name, error);
561 * serio_destroy_port() completes deregistration process and removes
562 * port from the system
564 static void serio_destroy_port(struct serio *serio)
568 child = serio_get_pending_child(serio);
570 serio_remove_pending_events(child);
571 put_device(&child->dev);
578 serio_pause_rx(serio->parent);
579 serio->parent->child = NULL;
580 serio_continue_rx(serio->parent);
581 serio->parent = NULL;
584 if (device_is_registered(&serio->dev))
585 device_del(&serio->dev);
587 list_del_init(&serio->node);
588 serio_remove_pending_events(serio);
589 put_device(&serio->dev);
593 * Reconnect serio port (re-initialize attached device).
594 * If reconnect fails (old device is no longer attached or
595 * there was no device to begin with) we do full rescan in
596 * hope of finding a driver for the port.
598 static int serio_reconnect_port(struct serio *serio)
600 int error = serio_reconnect_driver(serio);
603 serio_disconnect_port(serio);
604 serio_find_driver(serio);
611 * Reconnect serio port and all its children (re-initialize attached devices)
613 static void serio_reconnect_chain(struct serio *serio)
616 if (serio_reconnect_port(serio)) {
617 /* Ok, old children are now gone, we are done */
620 serio = serio->child;
625 * serio_disconnect_port() unbinds a port from its driver. As a side effect
626 * all child ports are unbound and destroyed.
628 static void serio_disconnect_port(struct serio *serio)
630 struct serio *s, *parent;
634 * Children ports should be disconnected and destroyed
635 * first, staring with the leaf one, since we don't want
638 for (s = serio; s->child; s = s->child)
644 device_release_driver(&s->dev);
645 serio_destroy_port(s);
646 } while ((s = parent) != serio);
650 * Ok, no children left, now disconnect this port
652 device_release_driver(&serio->dev);
655 void serio_rescan(struct serio *serio)
657 serio_queue_event(serio, NULL, SERIO_RESCAN_PORT);
659 EXPORT_SYMBOL(serio_rescan);
661 void serio_reconnect(struct serio *serio)
663 serio_queue_event(serio, NULL, SERIO_RECONNECT_CHAIN);
665 EXPORT_SYMBOL(serio_reconnect);
668 * Submits register request to kseriod for subsequent execution.
669 * Note that port registration is always asynchronous.
671 void __serio_register_port(struct serio *serio, struct module *owner)
673 serio_init_port(serio);
674 serio_queue_event(serio, owner, SERIO_REGISTER_PORT);
676 EXPORT_SYMBOL(__serio_register_port);
679 * Synchronously unregisters serio port.
681 void serio_unregister_port(struct serio *serio)
683 mutex_lock(&serio_mutex);
684 serio_disconnect_port(serio);
685 serio_destroy_port(serio);
686 mutex_unlock(&serio_mutex);
688 EXPORT_SYMBOL(serio_unregister_port);
691 * Safely unregisters child port if one is present.
693 void serio_unregister_child_port(struct serio *serio)
695 mutex_lock(&serio_mutex);
697 serio_disconnect_port(serio->child);
698 serio_destroy_port(serio->child);
700 mutex_unlock(&serio_mutex);
702 EXPORT_SYMBOL(serio_unregister_child_port);
706 * Serio driver operations
709 static ssize_t serio_driver_show_description(struct device_driver *drv, char *buf)
711 struct serio_driver *driver = to_serio_driver(drv);
712 return sprintf(buf, "%s\n", driver->description ? driver->description : "(none)");
715 static ssize_t serio_driver_show_bind_mode(struct device_driver *drv, char *buf)
717 struct serio_driver *serio_drv = to_serio_driver(drv);
718 return sprintf(buf, "%s\n", serio_drv->manual_bind ? "manual" : "auto");
721 static ssize_t serio_driver_set_bind_mode(struct device_driver *drv, const char *buf, size_t count)
723 struct serio_driver *serio_drv = to_serio_driver(drv);
727 if (!strncmp(buf, "manual", count)) {
728 serio_drv->manual_bind = true;
729 } else if (!strncmp(buf, "auto", count)) {
730 serio_drv->manual_bind = false;
739 static struct driver_attribute serio_driver_attrs[] = {
740 __ATTR(description, S_IRUGO, serio_driver_show_description, NULL),
741 __ATTR(bind_mode, S_IWUSR | S_IRUGO,
742 serio_driver_show_bind_mode, serio_driver_set_bind_mode),
746 static int serio_driver_probe(struct device *dev)
748 struct serio *serio = to_serio_port(dev);
749 struct serio_driver *drv = to_serio_driver(dev->driver);
751 return serio_connect_driver(serio, drv);
754 static int serio_driver_remove(struct device *dev)
756 struct serio *serio = to_serio_port(dev);
758 serio_disconnect_driver(serio);
762 static void serio_cleanup(struct serio *serio)
764 mutex_lock(&serio->drv_mutex);
765 if (serio->drv && serio->drv->cleanup)
766 serio->drv->cleanup(serio);
767 mutex_unlock(&serio->drv_mutex);
770 static void serio_shutdown(struct device *dev)
772 struct serio *serio = to_serio_port(dev);
774 serio_cleanup(serio);
777 static void serio_attach_driver(struct serio_driver *drv)
781 error = driver_attach(&drv->driver);
783 pr_warning("driver_attach() failed for %s with error %d\n",
784 drv->driver.name, error);
787 int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name)
789 bool manual_bind = drv->manual_bind;
792 drv->driver.bus = &serio_bus;
793 drv->driver.owner = owner;
794 drv->driver.mod_name = mod_name;
797 * Temporarily disable automatic binding because probing
798 * takes long time and we are better off doing it in kseriod
800 drv->manual_bind = true;
802 error = driver_register(&drv->driver);
804 pr_err("driver_register() failed for %s, error: %d\n",
805 drv->driver.name, error);
810 * Restore original bind mode and let kseriod bind the
811 * driver to free ports
814 drv->manual_bind = false;
815 error = serio_queue_event(drv, NULL, SERIO_ATTACH_DRIVER);
817 driver_unregister(&drv->driver);
824 EXPORT_SYMBOL(__serio_register_driver);
826 void serio_unregister_driver(struct serio_driver *drv)
830 mutex_lock(&serio_mutex);
832 drv->manual_bind = true; /* so serio_find_driver ignores it */
833 serio_remove_pending_events(drv);
836 list_for_each_entry(serio, &serio_list, node) {
837 if (serio->drv == drv) {
838 serio_disconnect_port(serio);
839 serio_find_driver(serio);
840 /* we could've deleted some ports, restart */
845 driver_unregister(&drv->driver);
846 mutex_unlock(&serio_mutex);
848 EXPORT_SYMBOL(serio_unregister_driver);
850 static void serio_set_drv(struct serio *serio, struct serio_driver *drv)
852 serio_pause_rx(serio);
854 serio_continue_rx(serio);
857 static int serio_bus_match(struct device *dev, struct device_driver *drv)
859 struct serio *serio = to_serio_port(dev);
860 struct serio_driver *serio_drv = to_serio_driver(drv);
862 if (serio->manual_bind || serio_drv->manual_bind)
865 return serio_match_port(serio_drv->id_table, serio);
868 #ifdef CONFIG_HOTPLUG
870 #define SERIO_ADD_UEVENT_VAR(fmt, val...) \
872 int err = add_uevent_var(env, fmt, val); \
877 static int serio_uevent(struct device *dev, struct kobj_uevent_env *env)
884 serio = to_serio_port(dev);
886 SERIO_ADD_UEVENT_VAR("SERIO_TYPE=%02x", serio->id.type);
887 SERIO_ADD_UEVENT_VAR("SERIO_PROTO=%02x", serio->id.proto);
888 SERIO_ADD_UEVENT_VAR("SERIO_ID=%02x", serio->id.id);
889 SERIO_ADD_UEVENT_VAR("SERIO_EXTRA=%02x", serio->id.extra);
890 SERIO_ADD_UEVENT_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X",
891 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
895 #undef SERIO_ADD_UEVENT_VAR
899 static int serio_uevent(struct device *dev, struct kobj_uevent_env *env)
904 #endif /* CONFIG_HOTPLUG */
907 static int serio_suspend(struct device *dev)
909 struct serio *serio = to_serio_port(dev);
911 serio_cleanup(serio);
916 static int serio_resume(struct device *dev)
918 struct serio *serio = to_serio_port(dev);
921 * Driver reconnect can take a while, so better let kseriod
924 serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT);
929 static const struct dev_pm_ops serio_pm_ops = {
930 .suspend = serio_suspend,
931 .resume = serio_resume,
932 .poweroff = serio_suspend,
933 .restore = serio_resume,
935 #endif /* CONFIG_PM */
937 /* called from serio_driver->connect/disconnect methods under serio_mutex */
938 int serio_open(struct serio *serio, struct serio_driver *drv)
940 serio_set_drv(serio, drv);
942 if (serio->open && serio->open(serio)) {
943 serio_set_drv(serio, NULL);
948 EXPORT_SYMBOL(serio_open);
950 /* called from serio_driver->connect/disconnect methods under serio_mutex */
951 void serio_close(struct serio *serio)
956 serio_set_drv(serio, NULL);
958 EXPORT_SYMBOL(serio_close);
960 irqreturn_t serio_interrupt(struct serio *serio,
961 unsigned char data, unsigned int dfl)
964 irqreturn_t ret = IRQ_NONE;
966 spin_lock_irqsave(&serio->lock, flags);
968 if (likely(serio->drv)) {
969 ret = serio->drv->interrupt(serio, data, dfl);
970 } else if (!dfl && device_is_registered(&serio->dev)) {
975 spin_unlock_irqrestore(&serio->lock, flags);
979 EXPORT_SYMBOL(serio_interrupt);
981 static struct bus_type serio_bus = {
983 .dev_attrs = serio_device_attrs,
984 .drv_attrs = serio_driver_attrs,
985 .match = serio_bus_match,
986 .uevent = serio_uevent,
987 .probe = serio_driver_probe,
988 .remove = serio_driver_remove,
989 .shutdown = serio_shutdown,
995 static int __init serio_init(void)
999 error = bus_register(&serio_bus);
1001 pr_err("Failed to register serio bus, error: %d\n", error);
1005 serio_task = kthread_run(serio_thread, NULL, "kseriod");
1006 if (IS_ERR(serio_task)) {
1007 bus_unregister(&serio_bus);
1008 error = PTR_ERR(serio_task);
1009 pr_err("Failed to start kseriod, error: %d\n", error);
1016 static void __exit serio_exit(void)
1018 bus_unregister(&serio_bus);
1019 kthread_stop(serio_task);
1022 subsys_initcall(serio_init);
1023 module_exit(serio_exit);