[U-Boot] [RFC PATCH 10/44] image: Convert fit_image_hash_set_value() to static, and rename

Simon Glass sjg at chromium.org
Sat Jan 5 02:51:39 CET 2013


This function doesn't need to be exported, and with verification
we want to use it for setting the 'value' property in any node,
so rename it.

Signed-off-by: Simon Glass <sjg at chromium.org>
---
 include/image.h    |    2 -
 tools/image-host.c |   62 ++++++++++++++++++++++++++--------------------------
 2 files changed, 31 insertions(+), 33 deletions(-)

diff --git a/include/image.h b/include/image.h
index 819b131..f723b62 100644
--- a/include/image.h
+++ b/include/image.h
@@ -611,8 +611,6 @@ int fit_image_hash_get_ignore(const void *fit, int noffset, int *ignore);
 int fit_set_timestamp(void *fit, int noffset, time_t timestamp);
 int fit_set_hashes(void *fit);
 int fit_image_set_hashes(void *fit, int image_noffset);
-int fit_image_hash_set_value(void *fit, int noffset, uint8_t *value,
-				int value_len);
 
 int fit_image_check_hashes(const void *fit, int noffset);
 int fit_all_image_check_hashes(const void *fit);
diff --git a/tools/image-host.c b/tools/image-host.c
index da96ab1..d127fc1 100644
--- a/tools/image-host.c
+++ b/tools/image-host.c
@@ -79,6 +79,36 @@ int fit_set_hashes(void *fit)
 }
 
 /**
+ * fit_set_hash_value - set hash value in requested has node
+ * @fit: pointer to the FIT format image header
+ * @noffset: hash node offset
+ * @value: hash value to be set
+ * @value_len: hash value length
+ *
+ * fit_set_hash_value() attempts to set hash value in a node at offset
+ * given and returns operation status to the caller.
+ *
+ * returns
+ *     0, on success
+ *     -1, on failure
+ */
+static int fit_set_hash_value(void *fit, int noffset, uint8_t *value,
+				int value_len)
+{
+	int ret;
+
+	ret = fdt_setprop(fit, noffset, FIT_VALUE_PROP, value, value_len);
+	if (ret) {
+		printf("Can't set hash '%s' property for '%s' node(%s)\n",
+			FIT_VALUE_PROP, fit_get_name(fit, noffset, NULL),
+			fdt_strerror(ret));
+		return -1;
+	}
+
+	return 0;
+}
+
+/**
  * fit_image_process_hash - Process a single subnode of the images/ node
  *
  * Check each subnode and process accordingly. For hash nodes we generate
@@ -123,7 +153,7 @@ static int fit_image_process_hash(void *fit, const char *image_name,
 		return -1;
 	}
 
-	if (fit_image_hash_set_value(fit, noffset, value,
+	if (fit_set_hash_value(fit, noffset, value,
 					value_len)) {
 		printf("Can't set hash value for "
 			"'%s' hash node in '%s' image node\n",
@@ -193,33 +223,3 @@ int fit_image_set_hashes(void *fit, int image_noffset)
 
 	return 0;
 }
-
-/**
- * fit_image_hash_set_value - set hash value in requested has node
- * @fit: pointer to the FIT format image header
- * @noffset: hash node offset
- * @value: hash value to be set
- * @value_len: hash value length
- *
- * fit_image_hash_set_value() attempts to set hash value in a node at offset
- * given and returns operation status to the caller.
- *
- * returns
- *     0, on success
- *     -1, on failure
- */
-int fit_image_hash_set_value(void *fit, int noffset, uint8_t *value,
-				int value_len)
-{
-	int ret;
-
-	ret = fdt_setprop(fit, noffset, FIT_VALUE_PROP, value, value_len);
-	if (ret) {
-		printf("Can't set hash '%s' property for '%s' node(%s)\n",
-			FIT_VALUE_PROP, fit_get_name(fit, noffset, NULL),
-			fdt_strerror(ret));
-		return -1;
-	}
-
-	return 0;
-}
-- 
1.7.7.3



More information about the U-Boot mailing list