* [PATCH 0/2] Trivial code cleanup for DT resolver
@ 2017-10-13 7:35 Stephen Boyd
2017-10-13 7:35 ` [PATCH 1/2] of/resolver: Simplify to be32_add_cpu() Stephen Boyd
2017-10-13 7:35 ` [PATCH 2/2] of/resolver: Replace kmalloc + memcpy with kmemdup() Stephen Boyd
0 siblings, 2 replies; 6+ messages in thread
From: Stephen Boyd @ 2017-10-13 7:35 UTC (permalink / raw)
To: Rob Herring, Frank Rowand; +Cc: linux-kernel, devicetree
Two trivial patches to the DT resolver code.
Stephen Boyd (2):
of/resolver: Simplify to be32_add_cpu()
of/resolver: Replace kmalloc + memcpy with kmemdup()
drivers/of/resolver.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
--
2.14.GIT
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] of/resolver: Simplify to be32_add_cpu()
2017-10-13 7:35 [PATCH 0/2] Trivial code cleanup for DT resolver Stephen Boyd
@ 2017-10-13 7:35 ` Stephen Boyd
[not found] ` <20171013073558.11518-2-stephen.boyd-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-10-13 7:35 ` [PATCH 2/2] of/resolver: Replace kmalloc + memcpy with kmemdup() Stephen Boyd
1 sibling, 1 reply; 6+ messages in thread
From: Stephen Boyd @ 2017-10-13 7:35 UTC (permalink / raw)
To: Rob Herring, Frank Rowand; +Cc: linux-kernel, devicetree
This is the same as be32_add_cpu(), so simplify the code and
remove the now unused local variable.
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
---
drivers/of/resolver.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c
index 99309cb7d372..2d58253bf2f7 100644
--- a/drivers/of/resolver.c
+++ b/drivers/of/resolver.c
@@ -165,7 +165,6 @@ static int adjust_local_phandle_references(struct device_node *local_fixups,
struct property *prop_fix, *prop;
int err, i, count;
unsigned int off;
- phandle phandle;
if (!local_fixups)
return 0;
@@ -195,9 +194,7 @@ static int adjust_local_phandle_references(struct device_node *local_fixups,
if ((off + 4) > prop->length)
return -EINVAL;
- phandle = be32_to_cpu(*(__be32 *)(prop->value + off));
- phandle += phandle_delta;
- *(__be32 *)(prop->value + off) = cpu_to_be32(phandle);
+ be32_add_cpu(prop->value + off, phandle_delta);
}
}
--
2.14.GIT
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] of/resolver: Replace kmalloc + memcpy with kmemdup()
2017-10-13 7:35 [PATCH 0/2] Trivial code cleanup for DT resolver Stephen Boyd
2017-10-13 7:35 ` [PATCH 1/2] of/resolver: Simplify to be32_add_cpu() Stephen Boyd
@ 2017-10-13 7:35 ` Stephen Boyd
[not found] ` <20171013073558.11518-3-stephen.boyd-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
1 sibling, 1 reply; 6+ messages in thread
From: Stephen Boyd @ 2017-10-13 7:35 UTC (permalink / raw)
To: Rob Herring, Frank Rowand; +Cc: linux-kernel, devicetree
Save one line.
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
---
drivers/of/resolver.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c
index 2d58253bf2f7..bd21a66f6930 100644
--- a/drivers/of/resolver.c
+++ b/drivers/of/resolver.c
@@ -84,10 +84,9 @@ static int update_usages_of_a_phandle_reference(struct device_node *overlay,
int offset, len;
int err = 0;
- value = kmalloc(prop_fixup->length, GFP_KERNEL);
+ value = kmemdup(prop_fixup->value, prop_fixup->length, GFP_KERNEL);
if (!value)
return -ENOMEM;
- memcpy(value, prop_fixup->value, prop_fixup->length);
/* prop_fixup contains a list of tuples of path:property_name:offset */
end = value + prop_fixup->length;
--
2.14.GIT
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] of/resolver: Replace kmalloc + memcpy with kmemdup()
[not found] ` <20171013073558.11518-3-stephen.boyd-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2017-10-13 22:33 ` Frank Rowand
2017-10-16 21:48 ` Rob Herring
1 sibling, 0 replies; 6+ messages in thread
From: Frank Rowand @ 2017-10-13 22:33 UTC (permalink / raw)
To: Stephen Boyd, Rob Herring
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA
On 10/13/17 00:35, Stephen Boyd wrote:
> Save one line.
>
> Signed-off-by: Stephen Boyd <stephen.boyd-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> drivers/of/resolver.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c
> index 2d58253bf2f7..bd21a66f6930 100644
> --- a/drivers/of/resolver.c
> +++ b/drivers/of/resolver.c
> @@ -84,10 +84,9 @@ static int update_usages_of_a_phandle_reference(struct device_node *overlay,
> int offset, len;
> int err = 0;
>
> - value = kmalloc(prop_fixup->length, GFP_KERNEL);
> + value = kmemdup(prop_fixup->value, prop_fixup->length, GFP_KERNEL);
> if (!value)
> return -ENOMEM;
> - memcpy(value, prop_fixup->value, prop_fixup->length);
>
> /* prop_fixup contains a list of tuples of path:property_name:offset */
> end = value + prop_fixup->length;
>
Reviewed-by: Frank Rowand <frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] of/resolver: Simplify to be32_add_cpu()
[not found] ` <20171013073558.11518-2-stephen.boyd-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2017-10-13 22:52 ` Frank Rowand
0 siblings, 0 replies; 6+ messages in thread
From: Frank Rowand @ 2017-10-13 22:52 UTC (permalink / raw)
To: Stephen Boyd, Rob Herring
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA
On 10/13/17 00:35, Stephen Boyd wrote:
> This is the same as be32_add_cpu(), so simplify the code and
> remove the now unused local variable.
>
> Signed-off-by: Stephen Boyd <stephen.boyd-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> drivers/of/resolver.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c
> index 99309cb7d372..2d58253bf2f7 100644
> --- a/drivers/of/resolver.c
> +++ b/drivers/of/resolver.c
> @@ -165,7 +165,6 @@ static int adjust_local_phandle_references(struct device_node *local_fixups,
> struct property *prop_fix, *prop;
> int err, i, count;
> unsigned int off;
> - phandle phandle;
>
> if (!local_fixups)
> return 0;
> @@ -195,9 +194,7 @@ static int adjust_local_phandle_references(struct device_node *local_fixups,
> if ((off + 4) > prop->length)
> return -EINVAL;
>
> - phandle = be32_to_cpu(*(__be32 *)(prop->value + off));
> - phandle += phandle_delta;
> - *(__be32 *)(prop->value + off) = cpu_to_be32(phandle);
> + be32_add_cpu(prop->value + off, phandle_delta);
> }
> }
>
>
Reviewed-by: Frank Rowand <frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] of/resolver: Replace kmalloc + memcpy with kmemdup()
[not found] ` <20171013073558.11518-3-stephen.boyd-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-10-13 22:33 ` Frank Rowand
@ 2017-10-16 21:48 ` Rob Herring
1 sibling, 0 replies; 6+ messages in thread
From: Rob Herring @ 2017-10-16 21:48 UTC (permalink / raw)
To: Stephen Boyd
Cc: Frank Rowand, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA
On Fri, Oct 13, 2017 at 12:35:58AM -0700, Stephen Boyd wrote:
> Save one line.
>
> Signed-off-by: Stephen Boyd <stephen.boyd-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> drivers/of/resolver.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Both applied. Thanks.
Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-16 21:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-13 7:35 [PATCH 0/2] Trivial code cleanup for DT resolver Stephen Boyd
2017-10-13 7:35 ` [PATCH 1/2] of/resolver: Simplify to be32_add_cpu() Stephen Boyd
[not found] ` <20171013073558.11518-2-stephen.boyd-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-10-13 22:52 ` Frank Rowand
2017-10-13 7:35 ` [PATCH 2/2] of/resolver: Replace kmalloc + memcpy with kmemdup() Stephen Boyd
[not found] ` <20171013073558.11518-3-stephen.boyd-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-10-13 22:33 ` Frank Rowand
2017-10-16 21:48 ` 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).