[U-Boot] [RFC PATCH v3 08/16] cmd: gpt: remove blk_desc parameter in static function

Patrick Delaunay patrick.delaunay at st.com
Mon Feb 6 09:06:48 UTC 2017


Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
---

Changes in v3: None
Changes in v2: None

 cmd/gpt.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/cmd/gpt.c b/cmd/gpt.c
index 196f506..57eb29f 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -164,7 +164,8 @@ static bool found_key(const char *str, const char *key)
  * @return - zero on success, otherwise error
  *
  */
-static int set_gpt_info(struct blk_desc *dev_desc,
+static int set_gpt_info(unsigned int lba,
+			unsigned int blksz,
 			const char *str_part,
 			char **str_disk_guid,
 			disk_partition_t **partitions,
@@ -179,8 +180,7 @@ static int set_gpt_info(struct blk_desc *dev_desc,
 	uint64_t size_ll, start_ll;
 	lbaint_t offset = 0;
 
-	debug("%s:  lba num: 0x%x %d\n", __func__,
-	      (unsigned int)dev_desc->lba, (unsigned int)dev_desc->lba);
+	debug("%s:  lba num: 0x%x %d\n", __func__, lba, lba);
 
 	if (str_part == NULL)
 		return -1;
@@ -298,7 +298,7 @@ static int set_gpt_info(struct blk_desc *dev_desc,
 			parts[i].size = 0;
 		} else {
 			size_ll = ustrtoull(p, &p, 0);
-			parts[i].size = lldiv(size_ll, dev_desc->blksz);
+			parts[i].size = lldiv(size_ll, blksz);
 		}
 
 		free(val);
@@ -309,7 +309,7 @@ static int set_gpt_info(struct blk_desc *dev_desc,
 			if (extract_env(val, &p))
 				p = val;
 			start_ll = ustrtoull(p, &p, 0);
-			parts[i].start = lldiv(start_ll, dev_desc->blksz);
+			parts[i].start = lldiv(start_ll, blksz);
 			free(val);
 		}
 
@@ -341,7 +341,7 @@ static int gpt_default(struct blk_desc *blk_dev_desc, const char *str_part)
 	disk_partition_t *partitions = NULL;
 
 	/* fill partitions */
-	ret = set_gpt_info(blk_dev_desc, str_part,
+	ret = set_gpt_info(blk_dev_desc->lba, blk_dev_desc->blksz, str_part,
 			&str_disk_guid, &partitions, &part_count);
 	if (ret) {
 		if (ret == -1)
@@ -372,7 +372,7 @@ static int gpt_verify(struct blk_desc *blk_dev_desc, const char *str_part)
 	int ret = 0;
 
 	/* fill partitions */
-	ret = set_gpt_info(blk_dev_desc, str_part,
+	ret = set_gpt_info(blk_dev_desc->lba, blk_dev_desc->blksz, str_part,
 			&str_disk_guid, &partitions, &part_count);
 	if (ret) {
 		if (ret == -1) {
-- 
1.9.1



More information about the U-Boot mailing list