public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Stefan Roese <sr@denx.de>
Cc: "Marek Behún" <kabel@kernel.org>, u-boot@lists.denx.de
Subject: [PATCH u-boot-marvell 3/3] arm64: a37xx: pinctrl: Improve description for pinmux command
Date: Thu,  4 Aug 2022 12:41:56 +0200	[thread overview]
Message-ID: <20220804104156.22209-3-pali@kernel.org> (raw)
In-Reply-To: <20220804104156.22209-1-pali@kernel.org>

In more cases group name consist of function name followed by function
number. So if function name is just prefix of group name, show group name.

So in 'pinmux status -a' command output would be visible also extended
function number, which is useful for debugging.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
index 32b49f167c66..25fbe39abd19 100644
--- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
+++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
@@ -406,7 +406,17 @@ static int armada_37xx_pmx_get_pin_muxing(struct udevice *dev, unsigned int sele
 
 			for (f = 0; f < NB_FUNCS && grp->funcs[f]; f++) {
 				if (grp->val[f] == val) {
-					strlcpy(buf, grp->funcs[f], size);
+					/*
+					 * In more cases group name consist of
+					 * function name followed by function
+					 * number. So if function name is just
+					 * prefix of group name, show group name.
+					 */
+					if (strncmp(grp->name, grp->funcs[f],
+						    strlen(grp->funcs[f])) == 0)
+						strlcpy(buf, grp->name, size);
+					else
+						strlcpy(buf, grp->funcs[f], size);
 					return 0;
 				}
 			}
-- 
2.20.1


  parent reply	other threads:[~2022-08-04 10:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04 10:41 [PATCH u-boot-marvell 1/3] arm64: a37xx: pinctrl: Fix definitions for MPP pins 20-22 Pali Rohár
2022-08-04 10:41 ` [PATCH u-boot-marvell 2/3] arm64: a37xx: pinctrl: Remove unused macro PIN_GRP() Pali Rohár
2022-08-05 10:45   ` Stefan Roese
2022-08-09 11:35   ` Stefan Roese
2022-08-04 10:41 ` Pali Rohár [this message]
2022-08-05 10:45   ` [PATCH u-boot-marvell 3/3] arm64: a37xx: pinctrl: Improve description for pinmux command Stefan Roese
2022-08-09 11:35   ` Stefan Roese
2022-08-05 10:45 ` [PATCH u-boot-marvell 1/3] arm64: a37xx: pinctrl: Fix definitions for MPP pins 20-22 Stefan Roese
2022-08-09 11:35 ` Stefan Roese

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=20220804104156.22209-3-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=kabel@kernel.org \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /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