* [U-Boot] [PATCH 1/2 v3] fdt: Add a do_fixup_by_path_string() function
@ 2011-08-17 6:24 Chunhe Lan
2011-08-18 0:29 ` Jerry Van Baren
2011-08-28 18:15 ` Kumar Gala
0 siblings, 2 replies; 6+ messages in thread
From: Chunhe Lan @ 2011-08-17 6:24 UTC (permalink / raw)
To: u-boot
The do_fixup_by_path_string() will set the specified
node's property to the value contained in "status".
It would just be a wrapper for do_fixup_by_path()
that calls strlen on the argument.
Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
---
include/fdt_support.h | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 863024f..1de4a1d 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -36,6 +36,13 @@ void do_fixup_by_path(void *fdt, const char *path, const char *prop,
const void *val, int len, int create);
void do_fixup_by_path_u32(void *fdt, const char *path, const char *prop,
u32 val, int create);
+
+static inline void do_fixup_by_path_string(void *fdt, const char *path,
+ const char *prop, const char *status)
+{
+ do_fixup_by_path(fdt, path, prop, status, strlen(status) + 1, 1);
+}
+
void do_fixup_by_prop(void *fdt,
const char *pname, const void *pval, int plen,
const char *prop, const void *val, int len,
--
1.5.6.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/2 v3] fdt: Add a do_fixup_by_path_string() function
2011-08-17 6:24 [U-Boot] [PATCH 1/2 v3] fdt: Add a do_fixup_by_path_string() function Chunhe Lan
@ 2011-08-18 0:29 ` Jerry Van Baren
2011-08-18 6:32 ` Lan Chunhe
2011-08-18 15:14 ` Scott Wood
2011-08-28 18:15 ` Kumar Gala
1 sibling, 2 replies; 6+ messages in thread
From: Jerry Van Baren @ 2011-08-18 0:29 UTC (permalink / raw)
To: u-boot
Hi Chunhe Lan,
On 08/17/2011 02:24 AM, Chunhe Lan wrote:
[snip]
> +
> +static inline void do_fixup_by_path_string(void *fdt, const char *path,
> + const char *prop, const char *status)
> +{
> + do_fixup_by_path(fdt, path, prop, status, strlen(status) + 1, 1);
> +}
> +
After all the good advice from Scott et al., the patch turns into a
pretty trivial one-liner. I am questioning the advantage of calling
do_fixup_by_path_string(fdt, path, prop, status);
vs. simply calling
do_fixup_by_path(fdt, path, prop, status, strlen(status) + 1, 1);
The do_fixup_by_path_string() saves two parameters
"strlen(status) + 1, 1"
at the cost of Yet Another Function. Is it worth it?
Thanks,
gvb
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/2 v3] fdt: Add a do_fixup_by_path_string() function
2011-08-18 0:29 ` Jerry Van Baren
@ 2011-08-18 6:32 ` Lan Chunhe
2011-08-18 15:14 ` Scott Wood
1 sibling, 0 replies; 6+ messages in thread
From: Lan Chunhe @ 2011-08-18 6:32 UTC (permalink / raw)
To: u-boot
On Thu, 18 Aug 2011 08:29:51 +0800, Jerry Van Baren <gvb.uboot@gmail.com>
wrote:
> Hi Chunhe Lan,
>
> On 08/17/2011 02:24 AM, Chunhe Lan wrote:
>
> [snip]
>
>> +
>> +static inline void do_fixup_by_path_string(void *fdt, const char *path,
>> + const char *prop, const char *status)
>> +{
>> + do_fixup_by_path(fdt, path, prop, status, strlen(status) + 1, 1);
>> +}
>> +
>
> After all the good advice from Scott et al., the patch turns into a
> pretty trivial one-liner. I am questioning the advantage of calling
> do_fixup_by_path_string(fdt, path, prop, status);
> vs. simply calling
> do_fixup_by_path(fdt, path, prop, status, strlen(status) + 1, 1);
>
> The do_fixup_by_path_string() saves two parameters
> "strlen(status) + 1, 1"
> at the cost of Yet Another Function. Is it worth it?
Yes, I think that it is worth. The encapsulation of function is used
for that purpose.
Please refer to do_fixup_by_path_u32(), and it only has two
lines code.
Thanks.
-Jack Lan
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/2 v3] fdt: Add a do_fixup_by_path_string() function
2011-08-18 0:29 ` Jerry Van Baren
2011-08-18 6:32 ` Lan Chunhe
@ 2011-08-18 15:14 ` Scott Wood
1 sibling, 0 replies; 6+ messages in thread
From: Scott Wood @ 2011-08-18 15:14 UTC (permalink / raw)
To: u-boot
On 08/17/2011 07:29 PM, Jerry Van Baren wrote:
> Hi Chunhe Lan,
>
> On 08/17/2011 02:24 AM, Chunhe Lan wrote:
>
> [snip]
>
>> +
>> +static inline void do_fixup_by_path_string(void *fdt, const char *path,
>> + const char *prop, const char *status)
>> +{
>> + do_fixup_by_path(fdt, path, prop, status, strlen(status) + 1, 1);
>> +}
>> +
>
> After all the good advice from Scott et al., the patch turns into a
> pretty trivial one-liner. I am questioning the advantage of calling
> do_fixup_by_path_string(fdt, path, prop, status);
> vs. simply calling
> do_fixup_by_path(fdt, path, prop, status, strlen(status) + 1, 1);
>
> The do_fixup_by_path_string() saves two parameters
> "strlen(status) + 1, 1"
> at the cost of Yet Another Function. Is it worth it?
I think it's a nice convenience, with no runtime cost. It avoids any
chance of a mismatch between the string passed to do_fixup_by_path and
the string passed to strlen.
More functions versus open-coding is not generally a bad thing.
-Scott
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/2 v3] fdt: Add a do_fixup_by_path_string() function
2011-08-17 6:24 [U-Boot] [PATCH 1/2 v3] fdt: Add a do_fixup_by_path_string() function Chunhe Lan
2011-08-18 0:29 ` Jerry Van Baren
@ 2011-08-28 18:15 ` Kumar Gala
2011-08-29 2:54 ` Chunhe Lan
1 sibling, 1 reply; 6+ messages in thread
From: Kumar Gala @ 2011-08-28 18:15 UTC (permalink / raw)
To: u-boot
On Aug 17, 2011, at 1:24 AM, Chunhe Lan wrote:
> The do_fixup_by_path_string() will set the specified
> node's property to the value contained in "status".
> It would just be a wrapper for do_fixup_by_path()
> that calls strlen on the argument.
>
Fix where you break the line, should like more like (use upto 75 chars per line):
The do_fixup_by_path_string() will set the specified node's property to the
value contained in "status". It would just be a wrapper for
do_fixup_by_path() that calls strlen on the argument.
> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> ---
> include/fdt_support.h | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/include/fdt_support.h b/include/fdt_support.h
> index 863024f..1de4a1d 100644
> --- a/include/fdt_support.h
> +++ b/include/fdt_support.h
> @@ -36,6 +36,13 @@ void do_fixup_by_path(void *fdt, const char *path, const char *prop,
> const void *val, int len, int create);
> void do_fixup_by_path_u32(void *fdt, const char *path, const char *prop,
> u32 val, int create);
> +
> +static inline void do_fixup_by_path_string(void *fdt, const char *path,
> + const char *prop, const char *status)
> +{
> + do_fixup_by_path(fdt, path, prop, status, strlen(status) + 1, 1);
> +}
> +
> void do_fixup_by_prop(void *fdt,
> const char *pname, const void *pval, int plen,
> const char *prop, const void *val, int len,
> --
> 1.5.6.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/2 v3] fdt: Add a do_fixup_by_path_string() function
2011-08-28 18:15 ` Kumar Gala
@ 2011-08-29 2:54 ` Chunhe Lan
0 siblings, 0 replies; 6+ messages in thread
From: Chunhe Lan @ 2011-08-29 2:54 UTC (permalink / raw)
To: u-boot
On Mon, 29 Aug 2011 02:15:15 +0800, Kumar Gala <kumar.gala@freescale.com>
wrote:
>
> On Aug 17, 2011, at 1:24 AM, Chunhe Lan wrote:
>
>> The do_fixup_by_path_string() will set the specified
>> node's property to the value contained in "status".
>> It would just be a wrapper for do_fixup_by_path()
>> that calls strlen on the argument.
>>
>
> Fix where you break the line, should like more like (use upto 75 chars
> per line):
OK.
Thanks.
-Jack Lan
> The do_fixup_by_path_string() will set the specified node's property
> to the
> value contained in "status". It would just be a wrapper for
> do_fixup_by_path() that calls strlen on the argument.
>
>
>> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
>> ---
>> include/fdt_support.h | 7 +++++++
>> 1 files changed, 7 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/fdt_support.h b/include/fdt_support.h
>> index 863024f..1de4a1d 100644
>> --- a/include/fdt_support.h
>> +++ b/include/fdt_support.h
>> @@ -36,6 +36,13 @@ void do_fixup_by_path(void *fdt, const char *path,
>> const char *prop,
>> const void *val, int len, int create);
>> void do_fixup_by_path_u32(void *fdt, const char *path, const char *prop,
>> u32 val, int create);
>> +
>> +static inline void do_fixup_by_path_string(void *fdt, const char *path,
>> + const char *prop, const char *status)
>> +{
>> + do_fixup_by_path(fdt, path, prop, status, strlen(status) + 1, 1);
>> +}
>> +
>> void do_fixup_by_prop(void *fdt,
>> const char *pname, const void *pval, int plen,
>> const char *prop, const void *val, int len,
>> --
>> 1.5.6.5
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-08-29 2:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-17 6:24 [U-Boot] [PATCH 1/2 v3] fdt: Add a do_fixup_by_path_string() function Chunhe Lan
2011-08-18 0:29 ` Jerry Van Baren
2011-08-18 6:32 ` Lan Chunhe
2011-08-18 15:14 ` Scott Wood
2011-08-28 18:15 ` Kumar Gala
2011-08-29 2:54 ` Chunhe Lan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.