aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/gameport/gameport.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-01-05 20:56:03 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-01-06 03:24:21 -0500
commitfc99ec6f4b6116305bca56a781b8b3b2ac054d27 (patch)
tree6cc054a099d4a7c82f5e947226030f3c5ed3315f /drivers/input/gameport/gameport.c
parentd621af473079851caac873adc5431a05c9d78dfd (diff)
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: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/gameport/gameport.c')
-rw-r--r--drivers/input/gameport/gameport.c62
1 files changed, 28 insertions, 34 deletions
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index 953a20bf26e8..7e18bcf05a66 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -11,6 +11,8 @@
11 * the Free Software Foundation. 11 * the Free Software Foundation.
12 */ 12 */
13 13
14#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15
14#include <linux/stddef.h> 16#include <linux/stddef.h>
15#include <linux/module.h> 17#include <linux/module.h>
16#include <linux/ioport.h> 18#include <linux/ioport.h>
@@ -190,9 +192,8 @@ static int gameport_bind_driver(struct gameport *gameport, struct gameport_drive
190 192
191 error = device_bind_driver(&gameport->dev); 193 error = device_bind_driver(&gameport->dev);
192 if (error) { 194 if (error) {
193 printk(KERN_WARNING 195 dev_warn(&gameport->dev,
194 "gameport: device_bind_driver() failed " 196 "device_bind_driver() failed for %s (%s) and %s, error: %d\n",
195 "for %s (%s) and %s, error: %d\n",
196 gameport->phys, gameport->name, 197 gameport->phys, gameport->name,
197 drv->description, error); 198 drv->description, error);
198 drv->disconnect(gameport); 199 drv->disconnect(gameport);
@@ -209,9 +210,9 @@ static void gameport_find_driver(struct gameport *gameport)
209 210
210 error = device_attach(&gameport->dev); 211 error = device_attach(&gameport->dev);
211 if (error < 0) 212 if (error < 0)
212 printk(KERN_WARNING 213 dev_warn(&gameport->dev,
213 "gameport: device_attach() failed for %s (%s), error: %d\n", 214 "device_attach() failed for %s (%s), error: %d\n",
214 gameport->phys, gameport->name, error); 215 gameport->phys, gameport->name, error);
215} 216}
216 217
217 218
@@ -262,17 +263,14 @@ static int gameport_queue_event(void *object, struct module *owner,
262 263
263 event = kmalloc(sizeof(struct gameport_event), GFP_ATOMIC); 264 event = kmalloc(sizeof(struct gameport_event), GFP_ATOMIC);
264 if (!event) { 265 if (!event) {
265 printk(KERN_ERR 266 pr_err("Not enough memory to queue event %d\n", event_type);
266 "gameport: Not enough memory to queue event %d\n",
267 event_type);
268 retval = -ENOMEM; 267 retval = -ENOMEM;
269 goto out; 268 goto out;
270 } 269 }
271 270
272 if (!try_module_get(owner)) { 271 if (!try_module_get(owner)) {
273 printk(KERN_WARNING 272 pr_warning("Can't get module reference, dropping event %d\n",
274 "gameport: Can't get module reference, dropping event %d\n", 273 event_type);
275 event_type);
276 kfree(event); 274 kfree(event);
277 retval = -EINVAL; 275 retval = -EINVAL;
278 goto out; 276 goto out;
@@ -335,7 +333,6 @@ static struct gameport_event *gameport_get_event(void)
335 } 333 }
336 334
337 spin_unlock_irqrestore(&gameport_event_lock, flags); 335 spin_unlock_irqrestore(&gameport_event_lock, flags);
338
339 return event; 336 return event;
340} 337}
341 338
@@ -354,16 +351,14 @@ static void gameport_handle_event(void)
354 if ((event = gameport_get_event())) { 351 if ((event = gameport_get_event())) {
355 352
356 switch (event->type) { 353 switch (event->type) {
357 case GAMEPORT_REGISTER_PORT:
358 gameport_add_port(event->object);
359 break;
360 354
361 case GAMEPORT_ATTACH_DRIVER: 355 case GAMEPORT_REGISTER_PORT:
362 gameport_attach_driver(event->object); 356 gameport_add_port(event->object);
363 break; 357 break;
364 358
365 default: 359 case GAMEPORT_ATTACH_DRIVER:
366 break; 360 gameport_attach_driver(event->object);
361 break;
367 } 362 }
368 363
369 gameport_remove_duplicate_events(event); 364 gameport_remove_duplicate_events(event);
@@ -433,7 +428,6 @@ static int gameport_thread(void *nothing)
433 kthread_should_stop() || !list_empty(&gameport_event_list)); 428 kthread_should_stop() || !list_empty(&gameport_event_list));
434 } while (!kthread_should_stop()); 429 } while (!kthread_should_stop());
435 430
436 printk(KERN_DEBUG "gameport: kgameportd exiting\n");
437 return 0; 431 return 0;
438} 432}
439 433
@@ -445,6 +439,7 @@ static int gameport_thread(void *nothing)
445static ssize_t gameport_show_description(struct device *dev, struct device_attribute *attr, char *buf) 439static ssize_t gameport_show_description(struct device *dev, struct device_attribute *attr, char *buf)
446{ 440{
447 struct gameport *gameport = to_gameport_port(dev); 441 struct gameport *gameport = to_gameport_port(dev);
442
448 return sprintf(buf, "%s\n", gameport->name); 443 return sprintf(buf, "%s\n", gameport->name);
449} 444}
450 445
@@ -513,7 +508,8 @@ static void gameport_init_port(struct gameport *gameport)
513 508
514 mutex_init(&gameport->drv_mutex); 509 mutex_init(&gameport->drv_mutex);
515 device_initialize(&gameport->dev); 510 device_initialize(&gameport->dev);
516 dev_set_name(&gameport->dev, "gameport%lu", (unsigned long)atomic_inc_return(&gameport_no) - 1); 511 dev_set_name(&gameport->dev, "gameport%lu",
512 (unsigned long)atomic_inc_return(&gameport_no) - 1);
517 gameport->dev.bus = &gameport_bus; 513 gameport->dev.bus = &gameport_bus;
518 gameport->dev.release = gameport_release_port; 514 gameport->dev.release = gameport_release_port;
519 if (gameport->parent) 515 if (gameport->parent)
@@ -542,16 +538,16 @@ static void gameport_add_port(struct gameport *gameport)
542 list_add_tail(&gameport->node, &gameport_list); 538 list_add_tail(&gameport->node, &gameport_list);
543 539
544 if (gameport->io) 540 if (gameport->io)
545 printk(KERN_INFO "gameport: %s is %s, io %#x, speed %dkHz\n", 541 dev_info(&gameport->dev, "%s is %s, io %#x, speed %dkHz\n",
546 gameport->name, gameport->phys, gameport->io, gameport->speed); 542 gameport->name, gameport->phys, gameport->io, gameport->speed);
547 else 543 else
548 printk(KERN_INFO "gameport: %s is %s, speed %dkHz\n", 544 dev_info(&gameport->dev, "%s is %s, speed %dkHz\n",
549 gameport->name, gameport->phys, gameport->speed); 545 gameport->name, gameport->phys, gameport->speed);
550 546
551 error = device_add(&gameport->dev); 547 error = device_add(&gameport->dev);
552 if (error) 548 if (error)
553 printk(KERN_ERR 549 dev_err(&gameport->dev,
554 "gameport: device_add() failed for %s (%s), error: %d\n", 550 "device_add() failed for %s (%s), error: %d\n",
555 gameport->phys, gameport->name, error); 551 gameport->phys, gameport->name, error);
556} 552}
557 553
@@ -693,8 +689,7 @@ static void gameport_attach_driver(struct gameport_driver *drv)
693 689
694 error = driver_attach(&drv->driver); 690 error = driver_attach(&drv->driver);
695 if (error) 691 if (error)
696 printk(KERN_ERR 692 pr_err("driver_attach() failed for %s, error: %d\n",
697 "gameport: driver_attach() failed for %s, error: %d\n",
698 drv->driver.name, error); 693 drv->driver.name, error);
699} 694}
700 695
@@ -715,8 +710,7 @@ int __gameport_register_driver(struct gameport_driver *drv, struct module *owner
715 710
716 error = driver_register(&drv->driver); 711 error = driver_register(&drv->driver);
717 if (error) { 712 if (error) {
718 printk(KERN_ERR 713 pr_err("driver_register() failed for %s, error: %d\n",
719 "gameport: driver_register() failed for %s, error: %d\n",
720 drv->driver.name, error); 714 drv->driver.name, error);
721 return error; 715 return error;
722 } 716 }
@@ -816,7 +810,7 @@ static int __init gameport_init(void)
816 810
817 error = bus_register(&gameport_bus); 811 error = bus_register(&gameport_bus);
818 if (error) { 812 if (error) {
819 printk(KERN_ERR "gameport: failed to register gameport bus, error: %d\n", error); 813 pr_err("failed to register gameport bus, error: %d\n", error);
820 return error; 814 return error;
821 } 815 }
822 816
@@ -824,7 +818,7 @@ static int __init gameport_init(void)
824 if (IS_ERR(gameport_task)) { 818 if (IS_ERR(gameport_task)) {
825 bus_unregister(&gameport_bus); 819 bus_unregister(&gameport_bus);
826 error = PTR_ERR(gameport_task); 820 error = PTR_ERR(gameport_task);
827 printk(KERN_ERR "gameport: Failed to start kgameportd, error: %d\n", error); 821 pr_err("Failed to start kgameportd, error: %d\n", error);
828 return error; 822 return error;
829 } 823 }
830 824