diff options
author | Aniroop Mathur <aniroop.mathur@gmail.com> | 2014-12-03 00:22:28 +0100 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-12-03 06:34:49 +0100 |
commit | 9c7d66fa9bb21ef89c6acdd0cf536eb84e760d8b (patch) | |
tree | b98a6234464d403c1451f2b4ea94472b6e0970ad /drivers/input/input.c | |
parent | Input: i8042 - do not try to load on Intel NUC D54250WYK (diff) | |
download | linux-9c7d66fa9bb21ef89c6acdd0cf536eb84e760d8b.tar.xz linux-9c7d66fa9bb21ef89c6acdd0cf536eb84e760d8b.zip |
Input: initialize input_no to -1 to avoid subtraction
Let's initializes input_no to -1 in order to avoid extra subtraction
operation performed every time we allocate an input device.
Signed-off-by: Aniroop Mathur <aniroop.mathur@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r-- | drivers/input/input.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index 0f175f55782b..04217c2e345c 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -1775,7 +1775,7 @@ EXPORT_SYMBOL_GPL(input_class); */ struct input_dev *input_allocate_device(void) { - static atomic_t input_no = ATOMIC_INIT(0); + static atomic_t input_no = ATOMIC_INIT(-1); struct input_dev *dev; dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL); @@ -1790,7 +1790,7 @@ struct input_dev *input_allocate_device(void) INIT_LIST_HEAD(&dev->node); dev_set_name(&dev->dev, "input%lu", - (unsigned long) atomic_inc_return(&input_no) - 1); + (unsigned long)atomic_inc_return(&input_no)); __module_get(THIS_MODULE); } |