From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli Subject: Re: [PATCH] of: Make of_node_name_eq() case insensitive Date: Thu, 24 Jan 2019 17:20:07 -0800 Message-ID: <3e63d0c3-cb92-5caa-c0db-a04ef8fb5393@gmail.com> References: <20190124200825.2611-1-f.fainelli@gmail.com> <1a19b5f3-1387-0e6d-2d84-1b61079b4efb@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1a19b5f3-1387-0e6d-2d84-1b61079b4efb@gmail.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Frank Rowand , linux-kernel@vger.kernel.org Cc: vivien.didelot@gmail.com, Rob Herring , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE" List-Id: devicetree@vger.kernel.org On 1/24/19 3:45 PM, Frank Rowand wrote: > On 1/24/19 12:08 PM, Florian Fainelli wrote: >> 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 >> Fixes: c32569e358ad ("regulator: Use of_node_name_eq for node name comparisons") >> Signed-off-by: Florian Fainelli >> --- >> 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); >> >> > > Node names are case sensitive. Please fix mc13xxx_parse_regulators_dt() to > properly handle case instead of changing of_node_name_eq(). Fair enough, should we issue a warning if np->full_name contains upper case while name does not (and vice versa) to help troubleshoot cases like the one we found with Vivien? -- Florian