Input: Initialize input_no by -1
Subsystems (2)
PATCH 1/1 Input: Initialize input_no by -1
This patch initializes input_no by -1 in order to avoid extra subtraction operation performed everytime for allocation of an input device.
Signed-off-by Aniroop Mathur <[email protected]>
--- drivers/input/input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/input.c +2 -2
@@ -1774,7 +1774,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 );
@@ -1789,7 +1789,7 @@ struct input_dev *input_allocate_device(void)INIT_LIST_HEAD (&dev->node);dev_set_name (&dev->dev,"input%ld" , - (unsigned long )atomic_inc_return (&input_no) -1 ); + (unsigned long )atomic_inc_return (&input_no));__module_get (THIS_MODULE ); }
Signature · 1 line
1.9.1
Dear Mr. Torokhov and Linux Input Community,
Greetings of the day !!
Kindly update about below patch.
I have corrected the spaces and sent it on Tue, Nov 25, 2014.
Thanks,
Aniroop Mathur
Quoted 34 lines · Aniroop Mathur
This patch initializes
input_noby -1 in order to avoid extra subtraction operation performed everytime for allocation of an input device.Signed-off-by Aniroop Mathur <[email protected]>--- drivers/input/input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/input/input.c +2
-3@@ -1774,7 +1774,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 );@@ -1789,7 +1789,7 @@ struct input_dev *input_allocate_device(void)INIT_LIST_HEAD (&dev->node);dev_set_name (&dev->dev,"input%ld" , - (unsigned long )atomic_inc_return (&input_no) -1 ); + (unsigned long )atomic_inc_return (&input_no));__module_get (THIS_MODULE ); } --1.9.1