From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-sh@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH 06/13] pinctrl: sh-pfc: checker: Improve pin checks
Date: Fri, 10 Jan 2020 14:19:20 +0100 [thread overview]
Message-ID: <20200110131927.1029-7-geert+renesas@glider.be> (raw)
In-Reply-To: <20200110131927.1029-1-geert+renesas@glider.be>
Improve the checks for pin descriptors:
1. Introduce local variables for the current pin, to make the checks
easier to read,
2. Pins must have a name,
3. Fix double printing of identical pin names.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/pinctrl/sh-pfc/core.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
index f82f483b98a25da5..6ff0f19403dc7813 100644
--- a/drivers/pinctrl/sh-pfc/core.c
+++ b/drivers/pinctrl/sh-pfc/core.c
@@ -860,25 +860,27 @@ static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info)
/* Check pins */
for (i = 0; i < info->nr_pins; i++) {
+ const struct sh_pfc_pin *pin = &info->pins[i];
+
+ if (!pin->name) {
+ sh_pfc_err("empty pin %u\n", i);
+ continue;
+ }
for (j = 0; j < i; j++) {
- if (same_name(info->pins[i].name, info->pins[j].name))
- sh_pfc_err("pin %s/%s: name conflict\n",
- info->pins[i].name,
- info->pins[j].name);
+ const struct sh_pfc_pin *pin2 = &info->pins[j];
+
+ if (same_name(pin->name, pin2->name))
+ sh_pfc_err("pin %s: name conflict\n",
+ pin->name);
- if (info->pins[i].pin != (u16)-1 &&
- info->pins[i].pin == info->pins[j].pin)
+ if (pin->pin != (u16)-1 && pin->pin == pin2->pin)
sh_pfc_err("pin %s/%s: pin %u conflict\n",
- info->pins[i].name,
- info->pins[j].name,
- info->pins[i].pin);
+ pin->name, pin2->name, pin->pin);
- if (info->pins[i].enum_id &&
- info->pins[i].enum_id == info->pins[j].enum_id)
+ if (pin->enum_id && pin->enum_id == pin2->enum_id)
sh_pfc_err("pin %s/%s: enum_id %u conflict\n",
- info->pins[i].name,
- info->pins[j].name,
- info->pins[i].enum_id);
+ pin->name, pin2->name,
+ pin->enum_id);
}
}
--
2.17.1
next prev parent reply other threads:[~2020-01-10 13:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-10 13:19 [PATCH 00/13] pinctrl: sh-pfc: checker: Various improvements Geert Uytterhoeven
2020-01-10 13:19 ` [PATCH 01/13] pinctrl: sh-pfc: checker: Move data before code Geert Uytterhoeven
2020-01-10 13:19 ` [PATCH 02/13] pinctrl: sh-pfc: checker: Add helpers for reporting Geert Uytterhoeven
2020-01-10 13:19 ` [PATCH 03/13] pinctrl: sh-pfc: checker: Add helper for safe name comparison Geert Uytterhoeven
2020-01-10 13:19 ` [PATCH 04/13] pinctrl: sh-pfc: checker: Add check for config register conflicts Geert Uytterhoeven
2020-01-10 13:19 ` [PATCH 05/13] pinctrl: sh-pfc: checker: Add check for enum ID conflicts Geert Uytterhoeven
2020-01-10 13:19 ` Geert Uytterhoeven [this message]
2020-01-10 13:19 ` [PATCH 07/13] pinctrl: sh-pfc: checker: Improve pin function checks Geert Uytterhoeven
2020-01-10 13:19 ` [PATCH 08/13] pinctrl: sh-pfc: checker: Improve pin group checks Geert Uytterhoeven
2020-01-10 13:19 ` [PATCH 09/13] pinctrl: sh-pfc: checker: Add drive strength register checks Geert Uytterhoeven
2020-01-10 13:19 ` [PATCH 10/13] pinctrl: sh-pfc: checker: Add bias " Geert Uytterhoeven
2020-01-10 13:19 ` [PATCH 11/13] pinctrl: sh-pfc: checker: Add ioctrl " Geert Uytterhoeven
2020-01-10 13:19 ` [PATCH 12/13] pinctrl: sh-pfc: checker: Add data " Geert Uytterhoeven
2020-01-10 13:19 ` [PATCH 13/13] pinctrl: sh-pfc: checker: Add function GPIO checks Geert Uytterhoeven
2020-01-10 13:22 ` Geert Uytterhoeven
2020-01-10 20:29 ` [PATCH 00/13] pinctrl: sh-pfc: checker: Various improvements Niklas Söderlund
2020-02-10 13:46 ` Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200110131927.1029-7-geert+renesas@glider.be \
--to=geert+renesas@glider.be \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).