public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2 v2] fdt: Add a do_fixup_by_path_string() function
@ 2011-08-16  7:33 Chunhe Lan
  2011-08-16 16:33 ` Scott Wood
  0 siblings, 1 reply; 3+ messages in thread
From: Chunhe Lan @ 2011-08-16  7:33 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>
---
 common/fdt_support.c  |    8 +++++++-
 include/fdt_support.h |    2 ++
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 19b2ef6..99ff84f 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -2,7 +2,7 @@
  * (C) Copyright 2007
  * Gerald Van Baren, Custom IDEAS, vanbaren at cideas.com
  *
- * Copyright 2010 Freescale Semiconductor, Inc.
+ * Copyright 2010-2011 Freescale Semiconductor, Inc.
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -307,6 +307,12 @@ void do_fixup_by_path_u32(void *fdt, const char *path, const char *prop,
 	do_fixup_by_path(fdt, path, prop, &val, sizeof(val), create);
 }
 
+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,
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 863024f..06d6a51 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -36,6 +36,8 @@ 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);
+void do_fixup_by_path_string(void *fdt, const char *path, const char *prop,
+			     const char *status);
 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] 3+ messages in thread

* [U-Boot] [PATCH 1/2 v2] fdt: Add a do_fixup_by_path_string() function
  2011-08-16  7:33 [U-Boot] [PATCH 1/2 v2] fdt: Add a do_fixup_by_path_string() function Chunhe Lan
@ 2011-08-16 16:33 ` Scott Wood
  2011-08-17  3:47   ` Lan Chunhe
  0 siblings, 1 reply; 3+ messages in thread
From: Scott Wood @ 2011-08-16 16:33 UTC (permalink / raw)
  To: u-boot

On 08/16/2011 02:33 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.
> 
> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> ---
>  common/fdt_support.c  |    8 +++++++-
>  include/fdt_support.h |    2 ++
>  2 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index 19b2ef6..99ff84f 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -2,7 +2,7 @@
>   * (C) Copyright 2007
>   * Gerald Van Baren, Custom IDEAS, vanbaren at cideas.com
>   *
> - * Copyright 2010 Freescale Semiconductor, Inc.
> + * Copyright 2010-2011 Freescale Semiconductor, Inc.
>   *
>   * See file CREDITS for list of people who contributed to this
>   * project.
> @@ -307,6 +307,12 @@ void do_fixup_by_path_u32(void *fdt, const char *path, const char *prop,
>  	do_fixup_by_path(fdt, path, prop, &val, sizeof(val), create);
>  }
>  
> +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);
> +}
> +

Put this in a header file as an inline function, so that strlen() can
evaluate to a constant if the string is constant.

-Scott

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH 1/2 v2] fdt: Add a do_fixup_by_path_string() function
  2011-08-16 16:33 ` Scott Wood
@ 2011-08-17  3:47   ` Lan Chunhe
  0 siblings, 0 replies; 3+ messages in thread
From: Lan Chunhe @ 2011-08-17  3:47 UTC (permalink / raw)
  To: u-boot

On Wed, 17 Aug 2011 00:33:30 +0800, Scott Wood <scottwood@freescale.com>  
wrote:

> On 08/16/2011 02:33 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.
>>
>> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
>> ---
>>  common/fdt_support.c  |    8 +++++++-
>>  include/fdt_support.h |    2 ++
>>  2 files changed, 9 insertions(+), 1 deletions(-)
>>
>> diff --git a/common/fdt_support.c b/common/fdt_support.c
>> index 19b2ef6..99ff84f 100644
>> --- a/common/fdt_support.c
>> +++ b/common/fdt_support.c
>> @@ -2,7 +2,7 @@
>>   * (C) Copyright 2007
>>   * Gerald Van Baren, Custom IDEAS, vanbaren at cideas.com
>>   *
>> - * Copyright 2010 Freescale Semiconductor, Inc.
>> + * Copyright 2010-2011 Freescale Semiconductor, Inc.
>>   *
>>   * See file CREDITS for list of people who contributed to this
>>   * project.
>> @@ -307,6 +307,12 @@ void do_fixup_by_path_u32(void *fdt, const char  
>> *path, const char *prop,
>>  	do_fixup_by_path(fdt, path, prop, &val, sizeof(val), create);
>>  }
>>
>> +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);
>> +}
>> +
>
> Put this in a header file as an inline function, so that strlen() can
> evaluate to a constant if the string is constant.

         OK.
         Thanks.

         -Jack Lan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-17  3:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-16  7:33 [U-Boot] [PATCH 1/2 v2] fdt: Add a do_fixup_by_path_string() function Chunhe Lan
2011-08-16 16:33 ` Scott Wood
2011-08-17  3:47   ` Lan Chunhe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox