Commit fc99ec6f authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: gameport - switch to using pr_xxx() and dev_xxx()

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 d621af47
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
* the Free Software Foundation. * the Free Software Foundation.
*/ */
#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/ioport.h> #include <linux/ioport.h>
...@@ -190,9 +192,8 @@ static int gameport_bind_driver(struct gameport *gameport, struct gameport_drive ...@@ -190,9 +192,8 @@ static int gameport_bind_driver(struct gameport *gameport, struct gameport_drive
error = device_bind_driver(&gameport->dev); error = device_bind_driver(&gameport->dev);
if (error) { if (error) {
printk(KERN_WARNING dev_warn(&gameport->dev,
"gameport: device_bind_driver() failed " "device_bind_driver() failed for %s (%s) and %s, error: %d\n",
"for %s (%s) and %s, error: %d\n",
gameport->phys, gameport->name, gameport->phys, gameport->name,
drv->description, error); drv->description, error);
drv->disconnect(gameport); drv->disconnect(gameport);
...@@ -209,8 +210,8 @@ static void gameport_find_driver(struct gameport *gameport) ...@@ -209,8 +210,8 @@ static void gameport_find_driver(struct gameport *gameport)
error = device_attach(&gameport->dev); error = device_attach(&gameport->dev);
if (error < 0) if (error < 0)
printk(KERN_WARNING dev_warn(&gameport->dev,
"gameport: device_attach() failed for %s (%s), error: %d\n", "device_attach() failed for %s (%s), error: %d\n",
gameport->phys, gameport->name, error); gameport->phys, gameport->name, error);
} }
...@@ -262,16 +263,13 @@ static int gameport_queue_event(void *object, struct module *owner, ...@@ -262,16 +263,13 @@ static int gameport_queue_event(void *object, struct module *owner,
event = kmalloc(sizeof(struct gameport_event), GFP_ATOMIC); event = kmalloc(sizeof(struct gameport_event), GFP_ATOMIC);
if (!event) { if (!event) {
printk(KERN_ERR pr_err("Not enough memory to queue event %d\n", event_type);
"gameport: 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",
"gameport: Can't get module reference, dropping event %d\n",
event_type); event_type);
kfree(event); kfree(event);
retval = -EINVAL; retval = -EINVAL;
...@@ -335,7 +333,6 @@ static struct gameport_event *gameport_get_event(void) ...@@ -335,7 +333,6 @@ static struct gameport_event *gameport_get_event(void)
} }
spin_unlock_irqrestore(&gameport_event_lock, flags); spin_unlock_irqrestore(&gameport_event_lock, flags);
return event; return event;
} }
...@@ -354,6 +351,7 @@ static void gameport_handle_event(void) ...@@ -354,6 +351,7 @@ static void gameport_handle_event(void)
if ((event = gameport_get_event())) { if ((event = gameport_get_event())) {
switch (event->type) { switch (event->type) {
case GAMEPORT_REGISTER_PORT: case GAMEPORT_REGISTER_PORT:
gameport_add_port(event->object); gameport_add_port(event->object);
break; break;
...@@ -361,9 +359,6 @@ static void gameport_handle_event(void) ...@@ -361,9 +359,6 @@ static void gameport_handle_event(void)
case GAMEPORT_ATTACH_DRIVER: case GAMEPORT_ATTACH_DRIVER:
gameport_attach_driver(event->object); gameport_attach_driver(event->object);
break; break;
default:
break;
} }
gameport_remove_duplicate_events(event); gameport_remove_duplicate_events(event);
...@@ -433,7 +428,6 @@ static int gameport_thread(void *nothing) ...@@ -433,7 +428,6 @@ static int gameport_thread(void *nothing)
kthread_should_stop() || !list_empty(&gameport_event_list)); kthread_should_stop() || !list_empty(&gameport_event_list));
} while (!kthread_should_stop()); } while (!kthread_should_stop());
printk(KERN_DEBUG "gameport: kgameportd exiting\n");
return 0; return 0;
} }
...@@ -445,6 +439,7 @@ static int gameport_thread(void *nothing) ...@@ -445,6 +439,7 @@ static int gameport_thread(void *nothing)
static ssize_t gameport_show_description(struct device *dev, struct device_attribute *attr, char *buf) static ssize_t gameport_show_description(struct device *dev, struct device_attribute *attr, char *buf)
{ {
struct gameport *gameport = to_gameport_port(dev); struct gameport *gameport = to_gameport_port(dev);
return sprintf(buf, "%s\n", gameport->name); return sprintf(buf, "%s\n", gameport->name);
} }
...@@ -513,7 +508,8 @@ static void gameport_init_port(struct gameport *gameport) ...@@ -513,7 +508,8 @@ static void gameport_init_port(struct gameport *gameport)
mutex_init(&gameport->drv_mutex); mutex_init(&gameport->drv_mutex);
device_initialize(&gameport->dev); device_initialize(&gameport->dev);
dev_set_name(&gameport->dev, "gameport%lu", (unsigned long)atomic_inc_return(&gameport_no) - 1); dev_set_name(&gameport->dev, "gameport%lu",
(unsigned long)atomic_inc_return(&gameport_no) - 1);
gameport->dev.bus = &gameport_bus; gameport->dev.bus = &gameport_bus;
gameport->dev.release = gameport_release_port; gameport->dev.release = gameport_release_port;
if (gameport->parent) if (gameport->parent)
...@@ -542,16 +538,16 @@ static void gameport_add_port(struct gameport *gameport) ...@@ -542,16 +538,16 @@ static void gameport_add_port(struct gameport *gameport)
list_add_tail(&gameport->node, &gameport_list); list_add_tail(&gameport->node, &gameport_list);
if (gameport->io) if (gameport->io)
printk(KERN_INFO "gameport: %s is %s, io %#x, speed %dkHz\n", dev_info(&gameport->dev, "%s is %s, io %#x, speed %dkHz\n",
gameport->name, gameport->phys, gameport->io, gameport->speed); gameport->name, gameport->phys, gameport->io, gameport->speed);
else else
printk(KERN_INFO "gameport: %s is %s, speed %dkHz\n", dev_info(&gameport->dev, "%s is %s, speed %dkHz\n",
gameport->name, gameport->phys, gameport->speed); gameport->name, gameport->phys, gameport->speed);
error = device_add(&gameport->dev); error = device_add(&gameport->dev);
if (error) if (error)
printk(KERN_ERR dev_err(&gameport->dev,
"gameport: device_add() failed for %s (%s), error: %d\n", "device_add() failed for %s (%s), error: %d\n",
gameport->phys, gameport->name, error); gameport->phys, gameport->name, error);
} }
...@@ -693,8 +689,7 @@ static void gameport_attach_driver(struct gameport_driver *drv) ...@@ -693,8 +689,7 @@ static void gameport_attach_driver(struct gameport_driver *drv)
error = driver_attach(&drv->driver); error = driver_attach(&drv->driver);
if (error) if (error)
printk(KERN_ERR pr_err("driver_attach() failed for %s, error: %d\n",
"gameport: driver_attach() failed for %s, error: %d\n",
drv->driver.name, error); drv->driver.name, error);
} }
...@@ -715,8 +710,7 @@ int __gameport_register_driver(struct gameport_driver *drv, struct module *owner ...@@ -715,8 +710,7 @@ int __gameport_register_driver(struct gameport_driver *drv, struct module *owner
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",
"gameport: driver_register() failed for %s, error: %d\n",
drv->driver.name, error); drv->driver.name, error);
return error; return error;
} }
...@@ -816,7 +810,7 @@ static int __init gameport_init(void) ...@@ -816,7 +810,7 @@ static int __init gameport_init(void)
error = bus_register(&gameport_bus); error = bus_register(&gameport_bus);
if (error) { if (error) {
printk(KERN_ERR "gameport: failed to register gameport bus, error: %d\n", error); pr_err("failed to register gameport bus, error: %d\n", error);
return error; return error;
} }
...@@ -824,7 +818,7 @@ static int __init gameport_init(void) ...@@ -824,7 +818,7 @@ static int __init gameport_init(void)
if (IS_ERR(gameport_task)) { if (IS_ERR(gameport_task)) {
bus_unregister(&gameport_bus); bus_unregister(&gameport_bus);
error = PTR_ERR(gameport_task); error = PTR_ERR(gameport_task);
printk(KERN_ERR "gameport: Failed to start kgameportd, error: %d\n", error); pr_err("Failed to start kgameportd, 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