[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1419782237-2562-1-git-send-email-aniroop.mathur@gmail.com>
Date: Sun, 28 Dec 2014 21:27:17 +0530
From: Aniroop Mathur <aniroop.mathur@...il.com>
To: <lgirdwood@...il.com>, <broonie@...nel.org>,
<linux-kernel@...r.kernel.org>
Cc: <aniroop.mathur@...il.com>, <a.mathur@...sung.com>
Subject: [PATCH] regulator: core: Initialize regulator_no to -1
From: Aniroop Mathur <a.mathur@...sung.com>
This patch initializes regulator_no to -1 to avoid extra subtraction
operation performed every time we register a regulator.
Signed-off-by: Aniroop Mathur <a.mathur@...sung.com>
---
drivers/regulator/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index a3c3785..4da1d98 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3481,7 +3481,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
{
const struct regulation_constraints *constraints = NULL;
const struct regulator_init_data *init_data;
- static atomic_t regulator_no = ATOMIC_INIT(0);
+ static atomic_t regulator_no = ATOMIC_INIT(-1);
struct regulator_dev *rdev;
struct device *dev;
int ret, i;
@@ -3551,7 +3551,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
rdev->dev.of_node = of_node_get(config->of_node);
rdev->dev.parent = dev;
dev_set_name(&rdev->dev, "regulator.%d",
- atomic_inc_return(®ulator_no) - 1);
+ atomic_inc_return(®ulator_no));
ret = device_register(&rdev->dev);
if (ret != 0) {
put_device(&rdev->dev);
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists