* Re: case sensitivity for devicetree node names [not found] <575B1D84.2010703@gmail.com> @ 2016-06-11 19:38 ` Frank Rowand 2016-06-11 22:05 ` Benjamin Herrenschmidt 0 siblings, 1 reply; 4+ messages in thread From: Frank Rowand @ 2016-06-11 19:38 UTC (permalink / raw) To: Benjamin Herrenschmidt Cc: Rob Herring, Grant Likely, David Gibson, devicetree-spec@vger.kernel.org, devicetree@vger.kernel.org, Paul Mackerras, Michael Ellerman, linuxppc-dev Hi Ben, (and adding other powerpc folks) On 06/10/16 13:05, Frank Rowand wrote: > I had assumed that devicetree node names were case sensitive. But a recent > email thread asserted that they were not, which made me curious. > > dtc treats node names as case sensitive: > > $ cat test_node_case_1.dts > > /dts-v1/; > > / { > node-x { > prop_a = < 1 >; > }; > }; > > / { > node-X { > prop_a = < 2 >; > }; > }; > > $ cat test_node_case_2.dts > > /dts-v1/; > > / { > node-x { > prop_a = < 1 >; > }; > }; > > / { > node-x { > prop_a = < 2 >; > }; > }; > > $ dtc -O dts test_node_case_1.dts > /dts-v1/; > > / { > > node-x { > prop_a = <0x1>; > }; > > node-X { > prop_a = <0x2>; > }; > }; > > $ dtc -O dts test_node_case_2.dts > /dts-v1/; > > / { > > node-x { > prop_a = <0x2>; > }; > }; > > > But the Linux kernel source code defines of_node_cmp() as: > > include/linux/of.h: > > /* Default string compare functions, Allow arch asm/prom.h to override */ > #if !defined(of_compat_cmp) > #define of_node_cmp(s1, s2) strcasecmp((s1), (s2)) > > arch/sparc/include/asm/prom.h uses strcmp() instead of strcasecmp(). > > Examples of using of_node_cmp() to check for a node name can be found, > for example, of_find_node_by_name(). > > Is case insensitivity for node names a bug in the Linux kernel, or desired > for some reason? > > -Frank > I chased through the history and found a 2.6.0-test5 announcement which noted the patch from you which adds: of_find_node_by_path() of_find_node_by_name() of_find_node_by_type() of_find_compatible_node() (And the patch is commit 394edd852a14 in the git recreation of bitkeeper days, which is found at git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git) That version of the functions uses a case insensitive compare for devicetree node names. Do you remember why you chose to not use a case sensitive compare? Thanks, -Frank ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: case sensitivity for devicetree node names 2016-06-11 19:38 ` case sensitivity for devicetree node names Frank Rowand @ 2016-06-11 22:05 ` Benjamin Herrenschmidt 2016-06-12 18:39 ` Frank Rowand 0 siblings, 1 reply; 4+ messages in thread From: Benjamin Herrenschmidt @ 2016-06-11 22:05 UTC (permalink / raw) To: Frank Rowand Cc: Rob Herring, Grant Likely, David Gibson, devicetree-spec@vger.kernel.org, devicetree@vger.kernel.org, Paul Mackerras, Michael Ellerman, linuxppc-dev On Sat, 2016-06-11 at 12:38 -0700, Frank Rowand wrote: > I chased through the history and found a 2.6.0-test5 announcement > which noted the patch from you which adds: > > of_find_node_by_path() > of_find_node_by_name() > of_find_node_by_type() > of_find_compatible_node() > > (And the patch is commit 394edd852a14 in the git recreation > of bitkeeper days, which is found at > git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git) > > That version of the functions uses a case insensitive compare for > devicetree node names. > > Do you remember why you chose to not use a case sensitive compare? >From memory, there were inconsistency in case on various earlier machines (notably old macs). I think that's the main reason. Cheers, Ben. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: case sensitivity for devicetree node names 2016-06-11 22:05 ` Benjamin Herrenschmidt @ 2016-06-12 18:39 ` Frank Rowand 2016-06-12 21:56 ` Benjamin Herrenschmidt 0 siblings, 1 reply; 4+ messages in thread From: Frank Rowand @ 2016-06-12 18:39 UTC (permalink / raw) To: Benjamin Herrenschmidt Cc: Rob Herring, Grant Likely, David Gibson, devicetree-spec@vger.kernel.org, devicetree@vger.kernel.org, Paul Mackerras, Michael Ellerman, linuxppc-dev On 06/11/16 15:05, Benjamin Herrenschmidt wrote: > On Sat, 2016-06-11 at 12:38 -0700, Frank Rowand wrote: >> I chased through the history and found a 2.6.0-test5 announcement >> which noted the patch from you which adds: >> >> of_find_node_by_path() >> of_find_node_by_name() >> of_find_node_by_type() >> of_find_compatible_node() >> >> (And the patch is commit 394edd852a14 in the git recreation >> of bitkeeper days, which is found at >> git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git) >> >> That version of the functions uses a case insensitive compare for >> devicetree node names. >> >> Do you remember why you chose to not use a case sensitive compare? > >>From memory, there were inconsistency in case on various earlier > machines (notably old macs). I think that's the main reason. > > Cheers, > Ben. Is there a kernel config option (or a small set of config options) that would identify the affected machines? It would be ok if the option(s) also included some non-affected machines. That way we could use the case insensitive compare for a small set of machines. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: case sensitivity for devicetree node names 2016-06-12 18:39 ` Frank Rowand @ 2016-06-12 21:56 ` Benjamin Herrenschmidt 0 siblings, 0 replies; 4+ messages in thread From: Benjamin Herrenschmidt @ 2016-06-12 21:56 UTC (permalink / raw) To: Frank Rowand Cc: Rob Herring, Grant Likely, David Gibson, devicetree-spec@vger.kernel.org, devicetree@vger.kernel.org, Paul Mackerras, Michael Ellerman, linuxppc-dev On Sun, 2016-06-12 at 11:39 -0700, Frank Rowand wrote: > > Is there a kernel config option (or a small set of config options) > that would identify the affected machines? It would be ok if > the option(s) also included some non-affected machines. That > way we could use the case insensitive compare for a small > set of machines. Why do we want this ? Are there people really wanting to rely on case difference between nodes ? That sounds fishy... If you really want to do that, then CONFIG_PPC_PMAC would be your test I suppose. Cheers, Ben. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-12 21:56 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <575B1D84.2010703@gmail.com> 2016-06-11 19:38 ` case sensitivity for devicetree node names Frank Rowand 2016-06-11 22:05 ` Benjamin Herrenschmidt 2016-06-12 18:39 ` Frank Rowand 2016-06-12 21:56 ` Benjamin Herrenschmidt
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).