[U-Boot] [PATCH v2 09/32] dm: blk: Rename get_dev() to blk_get_dev()

Simon Glass sjg at chromium.org
Mon Feb 29 23:25:42 CET 2016


The current name is too generic. Add a 'blk_' prefix to aid searching and
make its purpose clearer.

Signed-off-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
---

Changes in v2: None

 api/api_storage.c | 12 +++++++-----
 cmd/gpt.c         |  2 +-
 cmd/read.c        |  2 +-
 common/fb_mmc.c   |  4 ++--
 disk/part.c       |  4 ++--
 include/part.h    |  6 +++---
 6 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/api/api_storage.c b/api/api_storage.c
index 225a6cf..8c30c56 100644
--- a/api/api_storage.c
+++ b/api/api_storage.c
@@ -106,7 +106,7 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
 	struct blk_desc *dd;
 
 	if (first) {
-		di->cookie = (void *)get_dev(specs[type].name, 0);
+		di->cookie = (void *)blk_get_dev(specs[type].name, 0);
 		if (di->cookie == NULL)
 			return 0;
 		else
@@ -119,7 +119,8 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
 
 	} else {
 		for (i = 0; i < specs[type].max_dev; i++)
-			if (di->cookie == (void *)get_dev(specs[type].name, i)) {
+			if (di->cookie ==
+			    (void *)blk_get_dev(specs[type].name, i)) {
 				/* previous cookie found -- advance to the
 				 * next device, if possible */
 
@@ -129,7 +130,8 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
 					break;
 				}
 
-				di->cookie = (void *)get_dev(specs[type].name, i);
+				di->cookie = (void *)blk_get_dev(
+							specs[type].name, i);
 				if (di->cookie == NULL)
 					return 0;
 				else
@@ -174,7 +176,7 @@ static int dev_stor_type(struct blk_desc *dd)
 
 	for (i = ENUM_IDE; i < ENUM_MAX; i++)
 		for (j = 0; j < specs[i].max_dev; j++)
-			if (dd == get_dev(specs[i].name, j))
+			if (dd == blk_get_dev(specs[i].name, j))
 				return i;
 
 	return ENUM_MAX;
@@ -313,7 +315,7 @@ static int dev_stor_is_valid(int type, struct blk_desc *dd)
 	int i;
 
 	for (i = 0; i < specs[type].max_dev; i++)
-		if (dd == get_dev(specs[type].name, i))
+		if (dd == blk_get_dev(specs[type].name, i))
 			if (dd->type != DEV_TYPE_UNKNOWN)
 				return 1;
 
diff --git a/cmd/gpt.c b/cmd/gpt.c
index 881367c..8ffaef3 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -418,7 +418,7 @@ static int do_gpt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		printf("'%s' is not a number\n", argv[3]);
 		return CMD_RET_USAGE;
 	}
-	blk_dev_desc = get_dev(argv[2], dev);
+	blk_dev_desc = blk_get_dev(argv[2], dev);
 	if (!blk_dev_desc) {
 		printf("%s: %s dev %d NOT available\n",
 		       __func__, argv[2], dev);
diff --git a/cmd/read.c b/cmd/read.c
index 6a1e1d9..12ac1659 100644
--- a/cmd/read.c
+++ b/cmd/read.c
@@ -39,7 +39,7 @@ int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		part = (int)simple_strtoul(++ep, NULL, 16);
 	}
 
-	dev_desc = get_dev(argv[1], dev);
+	dev_desc = blk_get_dev(argv[1], dev);
 	if (dev_desc == NULL) {
 		printf("Block device %s %d not supported\n", argv[1], dev);
 		return 1;
diff --git a/common/fb_mmc.c b/common/fb_mmc.c
index fd43085..4324f58 100644
--- a/common/fb_mmc.c
+++ b/common/fb_mmc.c
@@ -106,7 +106,7 @@ void fb_mmc_flash_write(const char *cmd, unsigned int session_id,
 	/* initialize the response buffer */
 	response_str = response;
 
-	dev_desc = get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
+	dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
 	if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) {
 		error("invalid mmc device\n");
 		fastboot_fail(response_str, "invalid mmc device");
@@ -179,7 +179,7 @@ void fb_mmc_erase(const char *cmd, char *response)
 	/* initialize the response buffer */
 	response_str = response;
 
-	dev_desc = get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
+	dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
 	if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) {
 		error("invalid mmc device");
 		fastboot_fail(response_str, "invalid mmc device");
diff --git a/disk/part.c b/disk/part.c
index 7f98d89..2466c3e 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -101,7 +101,7 @@ static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart)
 	return NULL;
 }
 
-struct blk_desc *get_dev(const char *ifname, int dev)
+struct blk_desc *blk_get_dev(const char *ifname, int dev)
 {
 	return get_dev_hwpart(ifname, dev, 0);
 }
@@ -111,7 +111,7 @@ struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart)
 	return NULL;
 }
 
-struct blk_desc *get_dev(const char *ifname, int dev)
+struct blk_desc *blk_get_dev(const char *ifname, int dev)
 {
 	return NULL;
 }
diff --git a/include/part.h b/include/part.h
index 4e70d8d..ddc4422 100644
--- a/include/part.h
+++ b/include/part.h
@@ -54,7 +54,7 @@ typedef struct disk_partition {
 /* Misc _get_dev functions */
 #ifdef CONFIG_PARTITIONS
 /**
- * get_dev() - get a pointer to a block device given its type and number
+ * blk_get_dev() - get a pointer to a block device given its type and number
  *
  * Each interface allocates its own devices and typically struct blk_desc is
  * contained with the interface's data structure. There is no global
@@ -66,7 +66,7 @@ typedef struct disk_partition {
  * @return pointer to the block device, or NULL if not available, or an
  *	   error occurred.
  */
-struct blk_desc *get_dev(const char *ifname, int dev);
+struct blk_desc *blk_get_dev(const char *ifname, int dev);
 struct blk_desc *ide_get_dev(int dev);
 struct blk_desc *sata_get_dev(int dev);
 struct blk_desc *scsi_get_dev(int dev);
@@ -107,7 +107,7 @@ int get_device_and_partition(const char *ifname, const char *dev_part_str,
 			     struct blk_desc **dev_desc,
 			     disk_partition_t *info, int allow_whole_dev);
 #else
-static inline struct blk_desc *get_dev(const char *ifname, int dev)
+static inline struct blk_desc *blk_get_dev(const char *ifname, int dev)
 { return NULL; }
 static inline struct blk_desc *ide_get_dev(int dev) { return NULL; }
 static inline struct blk_desc *sata_get_dev(int dev) { return NULL; }
-- 
2.7.0.rc3.207.g0ac5344



More information about the U-Boot mailing list