linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: Make of_node_name_eq() case insensitive
@ 2019-01-24 20:08 Florian Fainelli
  2019-01-24 20:14 ` Joe Perches
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Florian Fainelli @ 2019-01-24 20:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: vivien.didelot, Florian Fainelli, Rob Herring, Frank Rowand,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE

Since c32569e358ad ("regulator: Use of_node_name_eq for node name
comparisons") Vivien reported the mc13892-regulator complaining about
not being able to find regulators.

This is because prior to that commit we used of_node_cmp() to compare
the regulator array passed from mc13892_regulators down to
mc13xxx_parse_regulators_dt() and they are all defined in uppercase
letters by the MC13892_*_DEFINE* macros, whereas they are defined as
lowercase in the DTS.

Fix this by use strncasecmp() since that makes sure the comparison is
case insensitive like what of_node_cmp() did.

Reported-by: Vivien Didelot <vivien.didelot@gmail.com>
Fixes: c32569e358ad ("regulator: Use of_node_name_eq for node name comparisons")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/of/base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 5226e898476e..ff47c86277cb 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -66,7 +66,8 @@ bool of_node_name_eq(const struct device_node *np, const char *name)
 	node_name = kbasename(np->full_name);
 	len = strchrnul(node_name, '@') - node_name;
 
-	return (strlen(name) == len) && (strncmp(node_name, name, len) == 0);
+	return (strlen(name) == len) &&
+		(strncasecmp(node_name, name, len) == 0);
 }
 EXPORT_SYMBOL(of_node_name_eq);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-01-25 15:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-24 20:08 [PATCH] of: Make of_node_name_eq() case insensitive Florian Fainelli
2019-01-24 20:14 ` Joe Perches
2019-01-24 20:19 ` Vivien Didelot
2019-01-24 23:45 ` Frank Rowand
2019-01-25  1:20   ` Florian Fainelli
2019-01-25  2:06     ` Frank Rowand
2019-01-25  5:00       ` Florian Fainelli
2019-01-25 15:33         ` Rob Herring

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).