[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190731132917.17607-2-geert+renesas@glider.be>
Date: Wed, 31 Jul 2019 15:29:15 +0200
From: Geert Uytterhoeven <geert+renesas@...der.be>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
Geert Uytterhoeven <geert+renesas@...der.be>
Subject: [PATCH 1/3] pinctrl: devicetree: Use strlen() instead of hardcoded number
Improve readability by replacing a hardcoded number requiring a comment
by strlen().
Gcc is smart enough to evaluate the length of a constant string at
compile-time.
Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>
---
drivers/pinctrl/devicetree.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c
index 88ddbb2e30de10f6..5d6d8b1e906203af 100644
--- a/drivers/pinctrl/devicetree.c
+++ b/drivers/pinctrl/devicetree.c
@@ -228,10 +228,8 @@ int pinctrl_dt_to_map(struct pinctrl *p, struct pinctrl_dev *pctldev)
* than dynamically allocate it and have to free it later,
* just point part way into the property name for the string.
*/
- if (ret < 0) {
- /* strlen("pinctrl-") == 8 */
- statename = prop->name + 8;
- }
+ if (ret < 0)
+ statename = prop->name + strlen("pinctrl-");
/* For every referenced pin configuration node in it */
for (config = 0; config < size; config++) {
--
2.17.1
Powered by blists - more mailing lists