Skip to content

Commit

Permalink
blk: Rename if_type to uclass_id
Browse files Browse the repository at this point in the history
Use the word 'uclass' instead of 'if_type' to complete the conversion.

Signed-off-by: Simon Glass <[email protected]>
  • Loading branch information
sjg20 committed Sep 25, 2022
1 parent a2a9317 commit 8149b15
Show file tree
Hide file tree
Showing 28 changed files with 231 additions and 232 deletions.
2 changes: 1 addition & 1 deletion board/st/common/stm32mp_dfu.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static void board_get_alt_info_mmc(struct udevice *dev, char *buf)
if (!desc)
return;

name = blk_get_if_type_name(desc->if_type);
name = blk_get_uclass_name(desc->uclass_id);
devnum = desc->devnum;
len = strlen(buf);

Expand Down
4 changes: 2 additions & 2 deletions cmd/bcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static int __bcb_load(int devnum, const char *partp)
char *endp;
int part, ret;

desc = blk_get_devnum_by_type(UCLASS_MMC, devnum);
desc = blk_get_devnum_by_uclass_id(UCLASS_MMC, devnum);
if (!desc) {
ret = -ENODEV;
goto err_read_fail;
Expand Down Expand Up @@ -287,7 +287,7 @@ static int __bcb_store(void)
u64 cnt;
int ret;

desc = blk_get_devnum_by_type(UCLASS_MMC, bcb_dev);
desc = blk_get_devnum_by_uclass_id(UCLASS_MMC, bcb_dev);
if (!desc) {
ret = -ENODEV;
goto err;
Expand Down
18 changes: 9 additions & 9 deletions cmd/blk_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@
#include <blk.h>
#include <command.h>

int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,
int blk_common_cmd(int argc, char *const argv[], enum uclass_id uclass_id,
int *cur_devnump)
{
const char *if_name = blk_get_if_type_name(if_type);
const char *if_name = blk_get_uclass_name(uclass_id);

switch (argc) {
case 0:
case 1:
return CMD_RET_USAGE;
case 2:
if (strncmp(argv[1], "inf", 3) == 0) {
blk_list_devices(if_type);
blk_list_devices(uclass_id);
return 0;
} else if (strncmp(argv[1], "dev", 3) == 0) {
if (blk_print_device_num(if_type, *cur_devnump)) {
if (blk_print_device_num(uclass_id, *cur_devnump)) {
printf("\nno %s devices available\n", if_name);
return CMD_RET_FAILURE;
}
return 0;
} else if (strncmp(argv[1], "part", 4) == 0) {
if (blk_list_part(if_type))
if (blk_list_part(uclass_id))
printf("\nno %s partition table available\n",
if_name);
return 0;
Expand All @@ -42,7 +42,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,
if (strncmp(argv[1], "dev", 3) == 0) {
int dev = (int)dectoul(argv[2], NULL);

if (!blk_show_device(if_type, dev)) {
if (!blk_show_device(uclass_id, dev)) {
*cur_devnump = dev;
printf("... is now current device\n");
} else {
Expand All @@ -52,7 +52,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,
} else if (strncmp(argv[1], "part", 4) == 0) {
int dev = (int)dectoul(argv[2], NULL);

if (blk_print_part_devnum(if_type, dev)) {
if (blk_print_part_devnum(uclass_id, dev)) {
printf("\n%s device %d not available\n",
if_name, dev);
return CMD_RET_FAILURE;
Expand All @@ -71,7 +71,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,
printf("\n%s read: device %d block # "LBAFU", count %lu ... ",
if_name, *cur_devnump, blk, cnt);

n = blk_read_devnum(if_type, *cur_devnump, blk, cnt,
n = blk_read_devnum(uclass_id, *cur_devnump, blk, cnt,
(ulong *)addr);

printf("%ld blocks read: %s\n", n,
Expand All @@ -86,7 +86,7 @@ int blk_common_cmd(int argc, char *const argv[], enum uclass_id if_type,
printf("\n%s write: device %d block # "LBAFU", count %lu ... ",
if_name, *cur_devnump, blk, cnt);

n = blk_write_devnum(if_type, *cur_devnump, blk, cnt,
n = blk_write_devnum(uclass_id, *cur_devnump, blk, cnt,
(ulong *)addr);

printf("%ld blocks written: %s\n", n,
Expand Down
2 changes: 1 addition & 1 deletion cmd/lsblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static int do_lsblk(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv
continue;
desc = dev_get_uclass_plat(udev);
printf("%c %s %u", i ? ',' : ':',
blk_get_if_type_name(desc->if_type),
blk_get_uclass_name(desc->uclass_id),
desc->devnum);
i++;
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static struct mmc *__init_mmc_device(int dev, bool force_init,

#ifdef CONFIG_BLOCK_CACHE
struct blk_desc *bd = mmc_get_blk_desc(mmc);
blkcache_invalidate(bd->if_type, bd->devnum);
blkcache_invalidate(bd->uclass_id, bd->devnum);
#endif

return mmc;
Expand Down Expand Up @@ -530,7 +530,7 @@ static int do_mmc_part(struct cmd_tbl *cmdtp, int flag,
if (!mmc)
return CMD_RET_FAILURE;

mmc_dev = blk_get_devnum_by_type(UCLASS_MMC, curr_device);
mmc_dev = blk_get_devnum_by_uclass_id(UCLASS_MMC, curr_device);
if (mmc_dev != NULL && mmc_dev->type != DEV_TYPE_UNKNOWN) {
part_print(mmc_dev);
return CMD_RET_SUCCESS;
Expand Down
2 changes: 1 addition & 1 deletion common/spl/spl_sata.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static int spl_sata_load_image(struct spl_image_info *spl_image,

/* try to recognize storage devices immediately */
scsi_scan(false);
stor_dev = blk_get_devnum_by_type(UCLASS_SCSI, 0);
stor_dev = blk_get_devnum_by_uclass_id(UCLASS_SCSI, 0);
if (!stor_dev)
return -ENODEV;

Expand Down
2 changes: 1 addition & 1 deletion common/spl/spl_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int spl_usb_load(struct spl_image_info *spl_image,

/* try to recognize storage devices immediately */
usb_stor_curr_dev = usb_stor_scan(1);
stor_dev = blk_get_devnum_by_type(UCLASS_USB, usb_stor_curr_dev);
stor_dev = blk_get_devnum_by_uclass_id(UCLASS_USB, usb_stor_curr_dev);
if (!stor_dev)
return -ENODEV;

Expand Down
6 changes: 3 additions & 3 deletions common/usb_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static int usb_stor_probe_device(struct usb_device *udev)

blkdev = &usb_dev_desc[usb_max_devs];
memset(blkdev, '\0', sizeof(struct blk_desc));
blkdev->if_type = UCLASS_USB;
blkdev->uclass_id = UCLASS_USB;
blkdev->devnum = usb_max_devs;
blkdev->part_type = PART_TYPE_UNKNOWN;
blkdev->target = 0xff;
Expand Down Expand Up @@ -1577,8 +1577,8 @@ U_BOOT_DRIVER(usb_storage_blk) = {
};
#else
U_BOOT_LEGACY_BLK(usb) = {
.if_typename = "usb",
.if_type = UCLASS_USB,
.uclass_idname = "usb",
.uclass_id = UCLASS_USB,
.max_devs = USB_MAX_STOR_DEV,
.desc = usb_dev_desc,
};
Expand Down
8 changes: 4 additions & 4 deletions disk/disk-uclass.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ unsigned long dev_read(struct udevice *dev, lbaint_t start,
start_in_disk += part->gpt_part_info.start;
}

if (blkcache_read(block_dev->if_type, block_dev->devnum,
if (blkcache_read(block_dev->uclass_id, block_dev->devnum,
start_in_disk, blkcnt, block_dev->blksz, buffer))
return blkcnt;
blks_read = ops->read(dev, start, blkcnt, buffer);
if (blks_read == blkcnt)
blkcache_fill(block_dev->if_type, block_dev->devnum,
blkcache_fill(block_dev->uclass_id, block_dev->devnum,
start_in_disk, blkcnt, block_dev->blksz, buffer);

return blks_read;
Expand All @@ -216,7 +216,7 @@ unsigned long dev_write(struct udevice *dev, lbaint_t start,
if (!ops->write)
return -ENOSYS;

blkcache_invalidate(block_dev->if_type, block_dev->devnum);
blkcache_invalidate(block_dev->uclass_id, block_dev->devnum);

return ops->write(dev, start, blkcnt, buffer);
}
Expand All @@ -235,7 +235,7 @@ unsigned long dev_erase(struct udevice *dev, lbaint_t start,
if (!ops->erase)
return -ENOSYS;

blkcache_invalidate(block_dev->if_type, block_dev->devnum);
blkcache_invalidate(block_dev->uclass_id, block_dev->devnum);

return ops->erase(dev, start, blkcnt);
}
Expand Down
14 changes: 7 additions & 7 deletions disk/part.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart)

if (!blk_enabled())
return NULL;
dev_desc = blk_get_devnum_by_typename(ifname, dev);
dev_desc = blk_get_devnum_by_uclass_idname(ifname, dev);
if (!dev_desc) {
debug("%s: No device for iface '%s', dev %d\n", __func__,
ifname, dev);
Expand Down Expand Up @@ -120,7 +120,7 @@ void dev_print(struct blk_desc *dev_desc)
return;
}

switch (dev_desc->if_type) {
switch (dev_desc->uclass_id) {
case UCLASS_SCSI:
printf ("(%d:%d) Vendor: %s Prod.: %s Rev: %s\n",
dev_desc->target,dev_desc->lun,
Expand Down Expand Up @@ -155,7 +155,7 @@ void dev_print(struct blk_desc *dev_desc)
puts("device type unknown\n");
return;
default:
printf("Unhandled device type: %i\n", dev_desc->if_type);
printf("Unhandled device type: %i\n", dev_desc->uclass_id);
return;
}
puts (" Type: ");
Expand Down Expand Up @@ -225,7 +225,7 @@ void part_init(struct blk_desc *dev_desc)
const int n_ents = ll_entry_count(struct part_driver, part_driver);
struct part_driver *entry;

blkcache_invalidate(dev_desc->if_type, dev_desc->devnum);
blkcache_invalidate(dev_desc->uclass_id, dev_desc->devnum);

dev_desc->part_type = PART_TYPE_UNKNOWN;
for (entry = drv; entry != drv + n_ents; entry++) {
Expand All @@ -248,7 +248,7 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc)
CONFIG_IS_ENABLED(AMIGA_PARTITION) || \
CONFIG_IS_ENABLED(EFI_PARTITION)
puts ("\nPartition Map for ");
switch (dev_desc->if_type) {
switch (dev_desc->uclass_id) {
case UCLASS_IDE:
puts ("IDE");
break;
Expand Down Expand Up @@ -408,7 +408,7 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,
* Always should be done, otherwise hw partition 0 will return
* stale data after displaying a non-zero hw partition.
*/
if ((*dev_desc)->if_type == UCLASS_MMC)
if ((*dev_desc)->uclass_id == UCLASS_MMC)
part_init(*dev_desc);
}

Expand Down Expand Up @@ -762,7 +762,7 @@ void part_set_generic_name(const struct blk_desc *dev_desc,
{
char *devtype;

switch (dev_desc->if_type) {
switch (dev_desc->uclass_id) {
case UCLASS_IDE:
case UCLASS_AHCI:
devtype = "hd";
Expand Down
2 changes: 1 addition & 1 deletion doc/usage/partitions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ generic syntax.
interface
The interface used to access the partition's device, like ``mmc`` or
``scsi``. For a full list of supported interfaces, consult the
``if_typename_str`` array in ``drivers/block/blk-uclass.c``
``uclass_idname_str`` array in ``drivers/block/blk-uclass.c``

devnum
The device number. This defaults to 0.
Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/sata.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ int __sata_initialize(void)

for (i = 0; i < CONFIG_SYS_SATA_MAX_DEVICE; i++) {
memset(&sata_dev_desc[i], 0, sizeof(struct blk_desc));
sata_dev_desc[i].if_type = UCLASS_AHCI;
sata_dev_desc[i].uclass_id = UCLASS_AHCI;
sata_dev_desc[i].devnum = i;
sata_dev_desc[i].part_type = PART_TYPE_UNKNOWN;
sata_dev_desc[i].type = DEV_TYPE_HARDDISK;
Expand Down
Loading

0 comments on commit 8149b15

Please sign in to comment.