* [PATCH] scripts/dtc: Simplify condition in get_node_by_path
@ 2019-08-27 14:57 Denis Efremov
2019-08-27 18:46 ` Frank Rowand
0 siblings, 1 reply; 2+ messages in thread
From: Denis Efremov @ 2019-08-27 14:57 UTC (permalink / raw)
To: Rob Herring, Frank Rowand; +Cc: Denis Efremov, devicetree, linux-kernel
The strlen && strprefixeq check in get_node_by_path is
excessive, since strlen is checked in strprefixeq macro
internally. Thus, 'strlen(child->name) == p-path'
conjunct duplicates after macro expansion and could
be removed.
Signed-off-by: Denis Efremov <efremov@linux.com>
---
scripts/dtc/livetree.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/scripts/dtc/livetree.c b/scripts/dtc/livetree.c
index 0c039993953a..032df5878ccc 100644
--- a/scripts/dtc/livetree.c
+++ b/scripts/dtc/livetree.c
@@ -526,8 +526,7 @@ struct node *get_node_by_path(struct node *tree, const char *path)
p = strchr(path, '/');
for_each_child(tree, child) {
- if (p && (strlen(child->name) == p-path) &&
- strprefixeq(path, p - path, child->name))
+ if (p && strprefixeq(path, p - path, child->name))
return get_node_by_path(child, p+1);
else if (!p && streq(path, child->name))
return child;
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] scripts/dtc: Simplify condition in get_node_by_path
2019-08-27 14:57 [PATCH] scripts/dtc: Simplify condition in get_node_by_path Denis Efremov
@ 2019-08-27 18:46 ` Frank Rowand
0 siblings, 0 replies; 2+ messages in thread
From: Frank Rowand @ 2019-08-27 18:46 UTC (permalink / raw)
To: Denis Efremov, Rob Herring; +Cc: devicetree, linux-kernel
Hi Denis,
On 8/27/19 7:57 AM, Denis Efremov wrote:
> The strlen && strprefixeq check in get_node_by_path is
> excessive, since strlen is checked in strprefixeq macro
> internally. Thus, 'strlen(child->name) == p-path'
> conjunct duplicates after macro expansion and could
> be removed.
>
> Signed-off-by: Denis Efremov <efremov@linux.com>
> ---
> scripts/dtc/livetree.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/scripts/dtc/livetree.c b/scripts/dtc/livetree.c
> index 0c039993953a..032df5878ccc 100644
> --- a/scripts/dtc/livetree.c
> +++ b/scripts/dtc/livetree.c
> @@ -526,8 +526,7 @@ struct node *get_node_by_path(struct node *tree, const char *path)
> p = strchr(path, '/');
>
> for_each_child(tree, child) {
> - if (p && (strlen(child->name) == p-path) &&
> - strprefixeq(path, p - path, child->name))
> + if (p && strprefixeq(path, p - path, child->name))
> return get_node_by_path(child, p+1);
> else if (!p && streq(path, child->name))
> return child;
>
livetree.c is maintained in the upstream dtc project. We pull changes
from that project into the Linux kernel source tree.
Info on submitting patches is in the upstream file "Documentation/manual.txt":
1) Sources
Source code for the Device Tree Compiler can be found at git.kernel.org.
The upstream repository is here:
git://git.kernel.org/pub/scm/utils/dtc/dtc.git
https://git.kernel.org/pub/scm/utils/dtc/dtc.git
The gitweb interface for the upstream respository is:
https://git.kernel.org/cgit/utils/dtc/dtc.git/
1.1) Submitting Patches
Patches should be sent to the maintainers:
David Gibson <david@gibson.dropbear.id.au>
Jon Loeliger <jdl@jdl.com>
and CCed to <devicetree-compiler@vger.kernel.org>.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-27 18:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-27 14:57 [PATCH] scripts/dtc: Simplify condition in get_node_by_path Denis Efremov
2019-08-27 18:46 ` Frank Rowand
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).