diff options
Diffstat (limited to 'drivers/input/serio')
-rw-r--r-- | drivers/input/serio/serio.c | 77 |
1 files changed, 35 insertions, 42 deletions
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 7fbf7670ae09..ee69ec399e08 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -26,6 +26,8 @@ | |||
26 | * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic | 26 | * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
30 | |||
29 | #include <linux/stddef.h> | 31 | #include <linux/stddef.h> |
30 | #include <linux/module.h> | 32 | #include <linux/module.h> |
31 | #include <linux/serio.h> | 33 | #include <linux/serio.h> |
@@ -119,11 +121,10 @@ static int serio_bind_driver(struct serio *serio, struct serio_driver *drv) | |||
119 | 121 | ||
120 | error = device_bind_driver(&serio->dev); | 122 | error = device_bind_driver(&serio->dev); |
121 | if (error) { | 123 | if (error) { |
122 | printk(KERN_WARNING | 124 | dev_warn(&serio->dev, |
123 | "serio: device_bind_driver() failed " | 125 | "device_bind_driver() failed for %s (%s) and %s, error: %d\n", |
124 | "for %s (%s) and %s, error: %d\n", | 126 | serio->phys, serio->name, |
125 | serio->phys, serio->name, | 127 | drv->description, error); |
126 | drv->description, error); | ||
127 | serio_disconnect_driver(serio); | 128 | serio_disconnect_driver(serio); |
128 | serio->dev.driver = NULL; | 129 | serio->dev.driver = NULL; |
129 | return error; | 130 | return error; |
@@ -138,9 +139,9 @@ static void serio_find_driver(struct serio *serio) | |||
138 | 139 | ||
139 | error = device_attach(&serio->dev); | 140 | error = device_attach(&serio->dev); |
140 | if (error < 0) | 141 | if (error < 0) |
141 | printk(KERN_WARNING | 142 | dev_warn(&serio->dev, |
142 | "serio: device_attach() failed for %s (%s), error: %d\n", | 143 | "device_attach() failed for %s (%s), error: %d\n", |
143 | serio->phys, serio->name, error); | 144 | serio->phys, serio->name, error); |
144 | } | 145 | } |
145 | 146 | ||
146 | 147 | ||
@@ -194,17 +195,14 @@ static int serio_queue_event(void *object, struct module *owner, | |||
194 | 195 | ||
195 | event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC); | 196 | event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC); |
196 | if (!event) { | 197 | if (!event) { |
197 | printk(KERN_ERR | 198 | pr_err("Not enough memory to queue event %d\n", event_type); |
198 | "serio: Not enough memory to queue event %d\n", | ||
199 | event_type); | ||
200 | retval = -ENOMEM; | 199 | retval = -ENOMEM; |
201 | goto out; | 200 | goto out; |
202 | } | 201 | } |
203 | 202 | ||
204 | if (!try_module_get(owner)) { | 203 | if (!try_module_get(owner)) { |
205 | printk(KERN_WARNING | 204 | pr_warning("Can't get module reference, dropping event %d\n", |
206 | "serio: Can't get module reference, dropping event %d\n", | 205 | event_type); |
207 | event_type); | ||
208 | kfree(event); | 206 | kfree(event); |
209 | retval = -EINVAL; | 207 | retval = -EINVAL; |
210 | goto out; | 208 | goto out; |
@@ -286,29 +284,27 @@ static void serio_handle_event(void) | |||
286 | if ((event = serio_get_event())) { | 284 | if ((event = serio_get_event())) { |
287 | 285 | ||
288 | switch (event->type) { | 286 | switch (event->type) { |
289 | case SERIO_REGISTER_PORT: | ||
290 | serio_add_port(event->object); | ||
291 | break; | ||
292 | 287 | ||
293 | case SERIO_RECONNECT_PORT: | 288 | case SERIO_REGISTER_PORT: |
294 | serio_reconnect_port(event->object); | 289 | serio_add_port(event->object); |
295 | break; | 290 | break; |
296 | 291 | ||
297 | case SERIO_RESCAN_PORT: | 292 | case SERIO_RECONNECT_PORT: |
298 | serio_disconnect_port(event->object); | 293 | serio_reconnect_port(event->object); |
299 | serio_find_driver(event->object); | 294 | break; |
300 | break; | ||
301 | 295 | ||
302 | case SERIO_RECONNECT_CHAIN: | 296 | case SERIO_RESCAN_PORT: |
303 | serio_reconnect_chain(event->object); | 297 | serio_disconnect_port(event->object); |
304 | break; | 298 | serio_find_driver(event->object); |
299 | break; | ||
305 | 300 | ||
306 | case SERIO_ATTACH_DRIVER: | 301 | case SERIO_RECONNECT_CHAIN: |
307 | serio_attach_driver(event->object); | 302 | serio_reconnect_chain(event->object); |
308 | break; | 303 | break; |
309 | 304 | ||
310 | default: | 305 | case SERIO_ATTACH_DRIVER: |
311 | break; | 306 | serio_attach_driver(event->object); |
307 | break; | ||
312 | } | 308 | } |
313 | 309 | ||
314 | serio_remove_duplicate_events(event); | 310 | serio_remove_duplicate_events(event); |
@@ -378,7 +374,6 @@ static int serio_thread(void *nothing) | |||
378 | kthread_should_stop() || !list_empty(&serio_event_list)); | 374 | kthread_should_stop() || !list_empty(&serio_event_list)); |
379 | } while (!kthread_should_stop()); | 375 | } while (!kthread_should_stop()); |
380 | 376 | ||
381 | printk(KERN_DEBUG "serio: kseriod exiting\n"); | ||
382 | return 0; | 377 | return 0; |
383 | } | 378 | } |
384 | 379 | ||
@@ -565,8 +560,8 @@ static void serio_add_port(struct serio *serio) | |||
565 | 560 | ||
566 | error = device_add(&serio->dev); | 561 | error = device_add(&serio->dev); |
567 | if (error) | 562 | if (error) |
568 | printk(KERN_ERR | 563 | dev_err(&serio->dev, |
569 | "serio: device_add() failed for %s (%s), error: %d\n", | 564 | "device_add() failed for %s (%s), error: %d\n", |
570 | serio->phys, serio->name, error); | 565 | serio->phys, serio->name, error); |
571 | } | 566 | } |
572 | 567 | ||
@@ -793,9 +788,8 @@ static void serio_attach_driver(struct serio_driver *drv) | |||
793 | 788 | ||
794 | error = driver_attach(&drv->driver); | 789 | error = driver_attach(&drv->driver); |
795 | if (error) | 790 | if (error) |
796 | printk(KERN_WARNING | 791 | pr_warning("driver_attach() failed for %s with error %d\n", |
797 | "serio: driver_attach() failed for %s with error %d\n", | 792 | drv->driver.name, error); |
798 | drv->driver.name, error); | ||
799 | } | 793 | } |
800 | 794 | ||
801 | int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name) | 795 | int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name) |
@@ -815,8 +809,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons | |||
815 | 809 | ||
816 | error = driver_register(&drv->driver); | 810 | error = driver_register(&drv->driver); |
817 | if (error) { | 811 | if (error) { |
818 | printk(KERN_ERR | 812 | pr_err("driver_register() failed for %s, error: %d\n", |
819 | "serio: driver_register() failed for %s, error: %d\n", | ||
820 | drv->driver.name, error); | 813 | drv->driver.name, error); |
821 | return error; | 814 | return error; |
822 | } | 815 | } |
@@ -1013,7 +1006,7 @@ static int __init serio_init(void) | |||
1013 | 1006 | ||
1014 | error = bus_register(&serio_bus); | 1007 | error = bus_register(&serio_bus); |
1015 | if (error) { | 1008 | if (error) { |
1016 | printk(KERN_ERR "serio: failed to register serio bus, error: %d\n", error); | 1009 | pr_err("Failed to register serio bus, error: %d\n", error); |
1017 | return error; | 1010 | return error; |
1018 | } | 1011 | } |
1019 | 1012 | ||
@@ -1021,7 +1014,7 @@ static int __init serio_init(void) | |||
1021 | if (IS_ERR(serio_task)) { | 1014 | if (IS_ERR(serio_task)) { |
1022 | bus_unregister(&serio_bus); | 1015 | bus_unregister(&serio_bus); |
1023 | error = PTR_ERR(serio_task); | 1016 | error = PTR_ERR(serio_task); |
1024 | printk(KERN_ERR "serio: Failed to start kseriod, error: %d\n", error); | 1017 | pr_err("Failed to start kseriod, error: %d\n", error); |
1025 | return error; | 1018 | return error; |
1026 | } | 1019 | } |
1027 | 1020 | ||