1
0
Fork 0

dm: blk: Rename get_dev() to blk_get_dev()

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

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
utp
Simon Glass 2016-02-29 15:25:42 -07:00
parent fb1b7be953
commit db1d9e78e6
6 changed files with 16 additions and 14 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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");

View File

@ -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;
}

View File

@ -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; }