* [PATCH] Input: Initialize input_no by -1
@ 2014-11-21 18:48 Aniroop Mathur
2014-11-24 3:20 ` Aniroop Mathur
2014-11-25 8:40 ` Dmitry Torokhov
0 siblings, 2 replies; 8+ messages in thread
From: Aniroop Mathur @ 2014-11-21 18:48 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input@vger.kernel.org
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 <aniroop.mathur@gmail.com>
---
drivers/input/input.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 29ca0bb..01fe49e 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] Input: Initialize input_no by -1
2014-11-21 18:48 [PATCH] Input: " Aniroop Mathur
@ 2014-11-24 3:20 ` Aniroop Mathur
2014-11-25 8:40 ` Dmitry Torokhov
1 sibling, 0 replies; 8+ messages in thread
From: Aniroop Mathur @ 2014-11-24 3:20 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input@vger.kernel.org
Dear Mr. Torokhov and Linux-Input Community,
Greetings of the day !!
Kindly update about the below patch.
Thank you,
Aniroop Mathur
On Sat, Nov 22, 2014 at 12:18 AM, Aniroop Mathur
<aniroop.mathur@gmail.com> wrote:
>
> 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 <aniroop.mathur@gmail.com>
> ---
> drivers/input/input.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index 29ca0bb..01fe49e 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Input: Initialize input_no by -1
2014-11-21 18:48 [PATCH] Input: " Aniroop Mathur
2014-11-24 3:20 ` Aniroop Mathur
@ 2014-11-25 8:40 ` Dmitry Torokhov
1 sibling, 0 replies; 8+ messages in thread
From: Dmitry Torokhov @ 2014-11-25 8:40 UTC (permalink / raw)
To: Aniroop Mathur; +Cc: linux-input@vger.kernel.org
Hi Aniroop,
On Sat, Nov 22, 2014 at 12:18:39AM +0530, Aniroop Mathur wrote:
> 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 <aniroop.mathur@gmail.com>
It looks like you rmail client converted all tabs to spaces so the patch
can't be applied as is. Could you please fix and resend.
Thanks.
> ---
> drivers/input/input.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index 29ca0bb..01fe49e 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -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
--
Dmitry
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Input: Initialize input_no by -1
@ 2014-11-25 16:08 Aniroop Mathur
2014-11-28 16:10 ` Aniroop Mathur
0 siblings, 1 reply; 8+ messages in thread
From: Aniroop Mathur @ 2014-11-25 16:08 UTC (permalink / raw)
To: dmitry.torokhov, linux-input; +Cc: aniroop.mathur
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 <aniroop.mathur@gmail.com>
---
drivers/input/input.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 29ca0bb..01fe49e 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] Input: Initialize input_no by -1
2014-11-25 16:08 [PATCH] Input: Initialize input_no by -1 Aniroop Mathur
@ 2014-11-28 16:10 ` Aniroop Mathur
0 siblings, 0 replies; 8+ messages in thread
From: Aniroop Mathur @ 2014-11-28 16:10 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input@vger.kernel.org, dtor
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
On Tue, Nov 25, 2014 at 9:38 PM, Aniroop Mathur
<aniroop.mathur@gmail.com> wrote:
>
> 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 <aniroop.mathur@gmail.com>
> ---
> drivers/input/input.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index 29ca0bb..01fe49e 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -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
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Input : Initialize input_no by -1
@ 2014-12-02 16:45 Aniroop Mathur
2014-12-02 23:29 ` Dmitry Torokhov
0 siblings, 1 reply; 8+ messages in thread
From: Aniroop Mathur @ 2014-12-02 16:45 UTC (permalink / raw)
To: dmitry.torokhov, dtor, linux-input; +Cc: aniroop.mathur, a.mathur
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 <aniroop.mathur@gmail.com>
---
drivers/input/input.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 29ca0bb..01fe49e 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] Input : Initialize input_no by -1
2014-12-02 16:45 [PATCH] Input : " Aniroop Mathur
@ 2014-12-02 23:29 ` Dmitry Torokhov
2014-12-03 5:57 ` Dmitry Torokhov
0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Torokhov @ 2014-12-02 23:29 UTC (permalink / raw)
To: Aniroop Mathur; +Cc: linux-input, a.mathur
On Tue, Dec 02, 2014 at 10:15:29PM +0530, Aniroop Mathur wrote:
> 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 <aniroop.mathur@gmail.com>
Applied, thank you.
By the way, we have a few more places in drivers/input that count from 0, we
may want to change them as well.
> ---
> drivers/input/input.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index 29ca0bb..01fe49e 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -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
>
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Input : Initialize input_no by -1
2014-12-02 23:29 ` Dmitry Torokhov
@ 2014-12-03 5:57 ` Dmitry Torokhov
0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Torokhov @ 2014-12-03 5:57 UTC (permalink / raw)
To: Aniroop Mathur; +Cc: linux-input, a.mathur
On Tue, Dec 02, 2014 at 03:29:23PM -0800, Dmitry Torokhov wrote:
> On Tue, Dec 02, 2014 at 10:15:29PM +0530, Aniroop Mathur wrote:
> > 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 <aniroop.mathur@gmail.com>
>
> Applied, thank you.
>
> By the way, we have a few more places in drivers/input that count from 0, we
> may want to change them as well.
Also, for patches of such nature (non urgent) there is no need to ping me so
often.
Thanks.
>
> > ---
> > drivers/input/input.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/input/input.c b/drivers/input/input.c
> > index 29ca0bb..01fe49e 100644
> > --- a/drivers/input/input.c
> > +++ b/drivers/input/input.c
> > @@ -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
> >
>
> Thanks.
>
> --
> Dmitry
--
Dmitry
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-12-03 5:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-25 16:08 [PATCH] Input: Initialize input_no by -1 Aniroop Mathur
2014-11-28 16:10 ` Aniroop Mathur
-- strict thread matches above, loose matches on Subject: below --
2014-12-02 16:45 [PATCH] Input : " Aniroop Mathur
2014-12-02 23:29 ` Dmitry Torokhov
2014-12-03 5:57 ` Dmitry Torokhov
2014-11-21 18:48 [PATCH] Input: " Aniroop Mathur
2014-11-24 3:20 ` Aniroop Mathur
2014-11-25 8:40 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).