summaryrefslogtreecommitdiffstats
path: root/drivers/input/gameport/gameport.c
diff options
context:
space:
mode:
authorAniroop Mathur <aniroop.mathur@gmail.com>2014-12-03 14:27:42 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2014-12-03 15:27:17 -0800
commit939ffb1712890ee22146d2dfc24adbc7da6afa84 (patch)
tree32f55ccf440835f0c929b6c7b173ffd87e18f2c6 /drivers/input/gameport/gameport.c
parent9c7d66fa9bb21ef89c6acdd0cf536eb84e760d8b (diff)
downloadlinux-939ffb1712890ee22146d2dfc24adbc7da6afa84.tar.bz2
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/gameport.c')
-rw-r--r--drivers/input/gameport/gameport.c4
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);
*/
static void gameport_init_port(struct gameport *gameport)
{
- static atomic_t gameport_no = ATOMIC_INIT(0);
+ static atomic_t gameport_no = ATOMIC_INIT(-1);
__module_get(THIS_MODULE);
mutex_init(&gameport->drv_mutex);
device_initialize(&gameport->dev);
dev_set_name(&gameport->dev, "gameport%lu",
- (unsigned long)atomic_inc_return(&gameport_no) - 1);
+ (unsigned long)atomic_inc_return(&gameport_no));
gameport->dev.bus = &gameport_bus;
gameport->dev.release = gameport_release_port;
if (gameport->parent)