summaryrefslogtreecommitdiffstats
path: root/drivers/input/gameport
diff options
context:
space:
mode:
authorAniroop Mathur2014-12-03 23:27:42 +0100
committerDmitry Torokhov2014-12-04 00:27:17 +0100
commit939ffb1712890ee22146d2dfc24adbc7da6afa84 (patch)
tree32f55ccf440835f0c929b6c7b173ffd87e18f2c6 /drivers/input/gameport
parentInput: initialize input_no to -1 to avoid subtraction (diff)
downloadkernel-qcow2-linux-939ffb1712890ee22146d2dfc24adbc7da6afa84.tar.gz
kernel-qcow2-linux-939ffb1712890ee22146d2dfc24adbc7da6afa84.tar.xz
kernel-qcow2-linux-939ffb1712890ee22146d2dfc24adbc7da6afa84.zip
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.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)