diff options
author | Aniroop Mathur <aniroop.mathur@gmail.com> | 2014-12-03 17:27:42 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-12-03 18:27:17 -0500 |
commit | 939ffb1712890ee22146d2dfc24adbc7da6afa84 (patch) | |
tree | 32f55ccf440835f0c929b6c7b173ffd87e18f2c6 /drivers/input/gameport | |
parent | 9c7d66fa9bb21ef89c6acdd0cf536eb84e760d8b (diff) |
Input: initialize device counter variables with -1
Let's initialize atomic_t variables keeping track of number of various
devices created so far with -1 in order to avoid extra subtraction
operation.
Signed-off-by: Aniroop Mathur <aniroop.mathur@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/gameport')
-rw-r--r-- | drivers/input/gameport/gameport.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index e29c04e2aff4..e853a2134680 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -527,14 +527,14 @@ EXPORT_SYMBOL(gameport_set_phys); | |||
527 | */ | 527 | */ |
528 | static void gameport_init_port(struct gameport *gameport) | 528 | static void gameport_init_port(struct gameport *gameport) |
529 | { | 529 | { |
530 | static atomic_t gameport_no = ATOMIC_INIT(0); | 530 | static atomic_t gameport_no = ATOMIC_INIT(-1); |
531 | 531 | ||
532 | __module_get(THIS_MODULE); | 532 | __module_get(THIS_MODULE); |
533 | 533 | ||
534 | mutex_init(&gameport->drv_mutex); | 534 | mutex_init(&gameport->drv_mutex); |
535 | device_initialize(&gameport->dev); | 535 | device_initialize(&gameport->dev); |
536 | dev_set_name(&gameport->dev, "gameport%lu", | 536 | dev_set_name(&gameport->dev, "gameport%lu", |
537 | (unsigned long)atomic_inc_return(&gameport_no) - 1); | 537 | (unsigned long)atomic_inc_return(&gameport_no)); |
538 | gameport->dev.bus = &gameport_bus; | 538 | gameport->dev.bus = &gameport_bus; |
539 | gameport->dev.release = gameport_release_port; | 539 | gameport->dev.release = gameport_release_port; |
540 | if (gameport->parent) | 540 | if (gameport->parent) |