]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm64: a37xx: pinctrl: Improve description for pinmux command
authorPali Rohár <pali@kernel.org>
Thu, 4 Aug 2022 10:41:56 +0000 (12:41 +0200)
committerStefan Roese <sr@denx.de>
Tue, 9 Aug 2022 06:58:27 +0000 (08:58 +0200)
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>
Reviewed-by: Stefan Roese <sr@denx.de>
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c

index 32b49f167c6693966887f4e1a8f39f8da5ed6364..25fbe39abd193eb0be65ad19c9ef88ebc3bf6ab5 100644 (file)
@@ -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;
                                }
                        }