Commit cac9169b authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: serio - use pr_xxx() and dev_xxx() helpers

pr_xxx() and dev_xxx() helpers ensure that all messages emitted by the
module have consistent prefixes, so let's use them. Also fix some
formatting issues.
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 4516c818
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/serio.h> #include <linux/serio.h>
...@@ -119,11 +121,10 @@ static int serio_bind_driver(struct serio *serio, struct serio_driver *drv) ...@@ -119,11 +121,10 @@ static int serio_bind_driver(struct serio *serio, struct serio_driver *drv)
error = device_bind_driver(&serio->dev); error = device_bind_driver(&serio->dev);
if (error) { if (error) {
printk(KERN_WARNING dev_warn(&serio->dev,
"serio: device_bind_driver() failed " "device_bind_driver() failed for %s (%s) and %s, error: %d\n",
"for %s (%s) and %s, error: %d\n", serio->phys, serio->name,
serio->phys, serio->name, drv->description, error);
drv->description, error);
serio_disconnect_driver(serio); serio_disconnect_driver(serio);
serio->dev.driver = NULL; serio->dev.driver = NULL;
return error; return error;
...@@ -138,9 +139,9 @@ static void serio_find_driver(struct serio *serio) ...@@ -138,9 +139,9 @@ static void serio_find_driver(struct serio *serio)
error = device_attach(&serio->dev); error = device_attach(&serio->dev);
if (error < 0) if (error < 0)
printk(KERN_WARNING dev_warn(&serio->dev,
"serio: device_attach() failed for %s (%s), error: %d\n", "device_attach() failed for %s (%s), error: %d\n",
serio->phys, serio->name, error); serio->phys, serio->name, error);
} }
...@@ -194,17 +195,14 @@ static int serio_queue_event(void *object, struct module *owner, ...@@ -194,17 +195,14 @@ static int serio_queue_event(void *object, struct module *owner,
event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC); event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC);
if (!event) { if (!event) {
printk(KERN_ERR pr_err("Not enough memory to queue event %d\n", event_type);
"serio: Not enough memory to queue event %d\n",
event_type);
retval = -ENOMEM; retval = -ENOMEM;
goto out; goto out;
} }
if (!try_module_get(owner)) { if (!try_module_get(owner)) {
printk(KERN_WARNING pr_warning("Can't get module reference, dropping event %d\n",
"serio: Can't get module reference, dropping event %d\n", event_type);
event_type);
kfree(event); kfree(event);
retval = -EINVAL; retval = -EINVAL;
goto out; goto out;
...@@ -286,29 +284,27 @@ static void serio_handle_event(void) ...@@ -286,29 +284,27 @@ static void serio_handle_event(void)
if ((event = serio_get_event())) { if ((event = serio_get_event())) {
switch (event->type) { switch (event->type) {
case SERIO_REGISTER_PORT:
serio_add_port(event->object);
break;
case SERIO_RECONNECT_PORT: case SERIO_REGISTER_PORT:
serio_reconnect_port(event->object); serio_add_port(event->object);
break; break;
case SERIO_RESCAN_PORT: case SERIO_RECONNECT_PORT:
serio_disconnect_port(event->object); serio_reconnect_port(event->object);
serio_find_driver(event->object); break;
break;
case SERIO_RECONNECT_CHAIN: case SERIO_RESCAN_PORT:
serio_reconnect_chain(event->object); serio_disconnect_port(event->object);
break; serio_find_driver(event->object);
break;
case SERIO_ATTACH_DRIVER: case SERIO_RECONNECT_CHAIN:
serio_attach_driver(event->object); serio_reconnect_chain(event->object);
break; break;
default: case SERIO_ATTACH_DRIVER:
break; serio_attach_driver(event->object);
break;
} }
serio_remove_duplicate_events(event); serio_remove_duplicate_events(event);
...@@ -378,7 +374,6 @@ static int serio_thread(void *nothing) ...@@ -378,7 +374,6 @@ static int serio_thread(void *nothing)
kthread_should_stop() || !list_empty(&serio_event_list)); kthread_should_stop() || !list_empty(&serio_event_list));
} while (!kthread_should_stop()); } while (!kthread_should_stop());
printk(KERN_DEBUG "serio: kseriod exiting\n");
return 0; return 0;
} }
...@@ -565,8 +560,8 @@ static void serio_add_port(struct serio *serio) ...@@ -565,8 +560,8 @@ static void serio_add_port(struct serio *serio)
error = device_add(&serio->dev); error = device_add(&serio->dev);
if (error) if (error)
printk(KERN_ERR dev_err(&serio->dev,
"serio: device_add() failed for %s (%s), error: %d\n", "device_add() failed for %s (%s), error: %d\n",
serio->phys, serio->name, error); serio->phys, serio->name, error);
} }
...@@ -793,9 +788,8 @@ static void serio_attach_driver(struct serio_driver *drv) ...@@ -793,9 +788,8 @@ static void serio_attach_driver(struct serio_driver *drv)
error = driver_attach(&drv->driver); error = driver_attach(&drv->driver);
if (error) if (error)
printk(KERN_WARNING pr_warning("driver_attach() failed for %s with error %d\n",
"serio: driver_attach() failed for %s with error %d\n", drv->driver.name, error);
drv->driver.name, error);
} }
int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name) 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,8 +809,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons
error = driver_register(&drv->driver); error = driver_register(&drv->driver);
if (error) { if (error) {
printk(KERN_ERR pr_err("driver_register() failed for %s, error: %d\n",
"serio: driver_register() failed for %s, error: %d\n",
drv->driver.name, error); drv->driver.name, error);
return error; return error;
} }
...@@ -1013,7 +1006,7 @@ static int __init serio_init(void) ...@@ -1013,7 +1006,7 @@ static int __init serio_init(void)
error = bus_register(&serio_bus); error = bus_register(&serio_bus);
if (error) { if (error) {
printk(KERN_ERR "serio: failed to register serio bus, error: %d\n", error); pr_err("Failed to register serio bus, error: %d\n", error);
return error; return error;
} }
...@@ -1021,7 +1014,7 @@ static int __init serio_init(void) ...@@ -1021,7 +1014,7 @@ static int __init serio_init(void)
if (IS_ERR(serio_task)) { if (IS_ERR(serio_task)) {
bus_unregister(&serio_bus); bus_unregister(&serio_bus);
error = PTR_ERR(serio_task); error = PTR_ERR(serio_task);
printk(KERN_ERR "serio: Failed to start kseriod, error: %d\n", error); pr_err("Failed to start kseriod, error: %d\n", error);
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment