提交 9c7d66fa 编写于 作者: A Aniroop Mathur 提交者: Dmitry Torokhov

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: NAniroop Mathur <aniroop.mathur@gmail.com>
Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
上级 8195077c
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册