Patchwork [U-Boot,RFC,14/44] image: Export fit_conf_get_prop_node()

login
register
mail settings
Submitter Simon Glass
Date Jan. 5, 2013, 1:51 a.m.
Message ID <1357350734-13737-15-git-send-email-sjg@chromium.org>
Download mbox | patch
Permalink /patch/209611/
State Superseded, archived
Headers show

Comments

Simon Glass - Jan. 5, 2013, 1:51 a.m.
This function will be needed by signature checking code, so export it,
and also add docs.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 common/image-fit.c |    8 ++++----
 include/image.h    |   15 +++++++++++++++
 2 files changed, 19 insertions(+), 4 deletions(-)
Marek Vasut - Jan. 5, 2013, 8:12 a.m.
Dear Simon Glass,

> This function will be needed by signature checking code, so export it,
> and also add docs.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
[...]

> +/**
> + * fit_conf_get_prop_node() - Get node refered to by a configuration
> + *
> + * The conf@ nodes contain references to other nodes, using properties
> + * like 'kernel = "kernel@1"'. Given such a property name (e.g. "kernel"),
> + * return the offset of the node referred to (e.g. offset of node
> + * "/images/kernel@1".
> + *
> + * @fit:	FIT to check
> + * @noffset:	Offset of conf@xxx node to check
> + * @prop_name:	Property to read from the conf node

This parameter list is swapped with the description.

> + */
> +int fit_conf_get_prop_node(const void *fit, int noffset,
> +		const char *prop_name);
> +
>  void fit_conf_print(const void *fit, int noffset, const char *p);
> 
>  int fit_check_ramdisk(const void *fit, int os_noffset,

Best regards,
Marek Vasut
Simon Glass - March 18, 2013, 8:40 p.m.
Hi Marek,

On Sat, Jan 5, 2013 at 12:12 AM, Marek Vasut <marex@denx.de> wrote:
> Dear Simon Glass,
>
>> This function will be needed by signature checking code, so export it,
>> and also add docs.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
> [...]
>
>> +/**
>> + * fit_conf_get_prop_node() - Get node refered to by a configuration
>> + *
>> + * The conf@ nodes contain references to other nodes, using properties
>> + * like 'kernel = "kernel@1"'. Given such a property name (e.g. "kernel"),
>> + * return the offset of the node referred to (e.g. offset of node
>> + * "/images/kernel@1".
>> + *
>> + * @fit:     FIT to check
>> + * @noffset: Offset of conf@xxx node to check
>> + * @prop_name:       Property to read from the conf node
>
> This parameter list is swapped with the description.

Sorry, can you please explain that a bit more. I'm not sure what you
are pointing to.

>
>> + */
>> +int fit_conf_get_prop_node(const void *fit, int noffset,
>> +             const char *prop_name);
>> +
>>  void fit_conf_print(const void *fit, int noffset, const char *p);
>>
>>  int fit_check_ramdisk(const void *fit, int os_noffset,
>
> Best regards,
> Marek Vasut

Regards,
Simon
Marek Vasut - March 18, 2013, 9:19 p.m.
Dear Simon Glass,

> Hi Marek,
> 
> On Sat, Jan 5, 2013 at 12:12 AM, Marek Vasut <marex@denx.de> wrote:
> > Dear Simon Glass,
> > 
> >> This function will be needed by signature checking code, so export it,
> >> and also add docs.
> >> 
> >> Signed-off-by: Simon Glass <sjg@chromium.org>
> > 
> > [...]
> > 
> >> +/**
> >> + * fit_conf_get_prop_node() - Get node refered to by a configuration
> >> + *
> >> + * The conf@ nodes contain references to other nodes, using properties
> >> + * like 'kernel = "kernel@1"'. Given such a property name (e.g.
> >> "kernel"), + * return the offset of the node referred to (e.g. offset
> >> of node + * "/images/kernel@1".
> >> + *
> >> + * @fit:     FIT to check
> >> + * @noffset: Offset of conf@xxx node to check
> >> + * @prop_name:       Property to read from the conf node
> > 
> > This parameter list is swapped with the description.
> 
> Sorry, can you please explain that a bit more. I'm not sure what you
> are pointing to.

Tough question, especially if asked after such time ;-) I believe I meant the 
form of the comment should be like this:

/*
 * foo() - Do baz and bar
 * @parm1: Number of sharks with lasers
 * @parm2: Make the result even cooler
 *
 * Long boring description of the function doing baz and bar.
 */

I think it makes more sense to stick the function param explanation just 
underneath the function name, no?

> >> + */
> >> +int fit_conf_get_prop_node(const void *fit, int noffset,
> >> +             const char *prop_name);
> >> +
> >> 
> >>  void fit_conf_print(const void *fit, int noffset, const char *p);
> >>  
> >>  int fit_check_ramdisk(const void *fit, int os_noffset,
> > 
> > Best regards,
> > Marek Vasut
> 
> Regards,
> Simon

Best regards,
Marek Vasut
Simon Glass - March 18, 2013, 9:57 p.m.
Hi Marek,

On Mon, Mar 18, 2013 at 2:19 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Simon Glass,
>
>> Hi Marek,
>>
>> On Sat, Jan 5, 2013 at 12:12 AM, Marek Vasut <marex@denx.de> wrote:
>> > Dear Simon Glass,
>> >
>> >> This function will be needed by signature checking code, so export it,
>> >> and also add docs.
>> >>
>> >> Signed-off-by: Simon Glass <sjg@chromium.org>
>> >
>> > [...]
>> >
>> >> +/**
>> >> + * fit_conf_get_prop_node() - Get node refered to by a configuration
>> >> + *
>> >> + * The conf@ nodes contain references to other nodes, using properties
>> >> + * like 'kernel = "kernel@1"'. Given such a property name (e.g.
>> >> "kernel"), + * return the offset of the node referred to (e.g. offset
>> >> of node + * "/images/kernel@1".
>> >> + *
>> >> + * @fit:     FIT to check
>> >> + * @noffset: Offset of conf@xxx node to check
>> >> + * @prop_name:       Property to read from the conf node
>> >
>> > This parameter list is swapped with the description.
>>
>> Sorry, can you please explain that a bit more. I'm not sure what you
>> are pointing to.
>
> Tough question, especially if asked after such time ;-) I believe I meant the
> form of the comment should be like this:
>
> /*
>  * foo() - Do baz and bar
>  * @parm1: Number of sharks with lasers
>  * @parm2: Make the result even cooler
>  *
>  * Long boring description of the function doing baz and bar.
>  */
>
> I think it makes more sense to stick the function param explanation just
> underneath the function name, no?

Aha I see, thank you.

Yes it has been a while - I feel people have had enough time to take a
look and raise questions and it is time for v2.

Regards,
Simon

Patch

diff --git a/common/image-fit.c b/common/image-fit.c
index 19942e2..db5382d 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1322,7 +1322,7 @@  int fit_conf_get_node(const void *fit, const char *conf_uname)
 	return noffset;
 }
 
-static int __fit_conf_get_prop_node(const void *fit, int noffset,
+int fit_conf_get_prop_node(const void *fit, int noffset,
 		const char *prop_name)
 {
 	char *uname;
@@ -1352,7 +1352,7 @@  static int __fit_conf_get_prop_node(const void *fit, int noffset,
  */
 int fit_conf_get_kernel_node(const void *fit, int noffset)
 {
-	return __fit_conf_get_prop_node(fit, noffset, FIT_KERNEL_PROP);
+	return fit_conf_get_prop_node(fit, noffset, FIT_KERNEL_PROP);
 }
 
 /**
@@ -1371,7 +1371,7 @@  int fit_conf_get_kernel_node(const void *fit, int noffset)
  */
 int fit_conf_get_ramdisk_node(const void *fit, int noffset)
 {
-	return __fit_conf_get_prop_node(fit, noffset, FIT_RAMDISK_PROP);
+	return fit_conf_get_prop_node(fit, noffset, FIT_RAMDISK_PROP);
 }
 
 /**
@@ -1390,7 +1390,7 @@  int fit_conf_get_ramdisk_node(const void *fit, int noffset)
  */
 int fit_conf_get_fdt_node(const void *fit, int noffset)
 {
-	return __fit_conf_get_prop_node(fit, noffset, FIT_FDT_PROP);
+	return fit_conf_get_prop_node(fit, noffset, FIT_FDT_PROP);
 }
 
 /**
diff --git a/include/image.h b/include/image.h
index ed351ef..d933bad 100644
--- a/include/image.h
+++ b/include/image.h
@@ -626,6 +626,21 @@  int fit_conf_get_kernel_node(const void *fit, int noffset);
 int fit_conf_get_ramdisk_node(const void *fit, int noffset);
 int fit_conf_get_fdt_node(const void *fit, int noffset);
 
+/**
+ * fit_conf_get_prop_node() - Get node refered to by a configuration
+ *
+ * The conf@ nodes contain references to other nodes, using properties
+ * like 'kernel = "kernel@1"'. Given such a property name (e.g. "kernel"),
+ * return the offset of the node referred to (e.g. offset of node
+ * "/images/kernel@1".
+ *
+ * @fit:	FIT to check
+ * @noffset:	Offset of conf@xxx node to check
+ * @prop_name:	Property to read from the conf node
+ */
+int fit_conf_get_prop_node(const void *fit, int noffset,
+		const char *prop_name);
+
 void fit_conf_print(const void *fit, int noffset, const char *p);
 
 int fit_check_ramdisk(const void *fit, int os_noffset,