From e33a5c6be55e7c012b2851f9bdf90e7f607e72bf Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 11 Aug 2022 19:34:59 -0600 Subject: blk: Switch over to using uclass IDs We currently have an if_type (interface type) and a uclass id. These are closely related and we don't need to have both. Drop the if_type values and use the uclass ones instead. Maintain the existing, subtle, one-way conversion between UCLASS_USB and UCLASS_MASS_STORAGE for now, and add a comment. Signed-off-by: Simon Glass --- cmd/bcb.c | 4 ++-- cmd/ide.c | 2 +- cmd/mmc.c | 8 ++++---- cmd/mvebu/bubt.c | 2 +- cmd/nvme.c | 4 ++-- cmd/pvblock.c | 2 +- cmd/sata.c | 4 ++-- cmd/scsi.c | 2 +- cmd/usb.c | 2 +- cmd/virtio.c | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) (limited to 'cmd') diff --git a/cmd/bcb.c b/cmd/bcb.c index 1bbd1fae99..8b87aa062f 100644 --- a/cmd/bcb.c +++ b/cmd/bcb.c @@ -122,7 +122,7 @@ static int __bcb_load(int devnum, const char *partp) char *endp; int part, ret; - desc = blk_get_devnum_by_type(IF_TYPE_MMC, devnum); + desc = blk_get_devnum_by_type(UCLASS_MMC, devnum); if (!desc) { ret = -ENODEV; goto err_read_fail; @@ -287,7 +287,7 @@ static int __bcb_store(void) u64 cnt; int ret; - desc = blk_get_devnum_by_type(IF_TYPE_MMC, bcb_dev); + desc = blk_get_devnum_by_type(UCLASS_MMC, bcb_dev); if (!desc) { ret = -ENODEV; goto err; diff --git a/cmd/ide.c b/cmd/ide.c index b78c38e159..6739f0b12d 100644 --- a/cmd/ide.c +++ b/cmd/ide.c @@ -37,7 +37,7 @@ int do_ide(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } } - return blk_common_cmd(argc, argv, IF_TYPE_IDE, &curr_device); + return blk_common_cmd(argc, argv, UCLASS_IDE, &curr_device); } int do_diskboot(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/cmd/mmc.c b/cmd/mmc.c index 7bd4cd9e01..0f1f4e0a71 100644 --- a/cmd/mmc.c +++ b/cmd/mmc.c @@ -331,13 +331,13 @@ static int do_mmcrpmb(struct cmd_tbl *cmdtp, int flag, #else original_part = mmc_get_blk_desc(mmc)->hwpart; #endif - if (blk_select_hwpart_devnum(IF_TYPE_MMC, curr_device, MMC_PART_RPMB) != + if (blk_select_hwpart_devnum(UCLASS_MMC, curr_device, MMC_PART_RPMB) != 0) return CMD_RET_FAILURE; ret = cp->cmd(cmdtp, flag, argc, argv); /* Return to original partition */ - if (blk_select_hwpart_devnum(IF_TYPE_MMC, curr_device, original_part) != + if (blk_select_hwpart_devnum(UCLASS_MMC, curr_device, original_part) != 0) return CMD_RET_FAILURE; return ret; @@ -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(IF_TYPE_MMC, curr_device); + mmc_dev = blk_get_devnum_by_type(UCLASS_MMC, curr_device); if (mmc_dev != NULL && mmc_dev->type != DEV_TYPE_UNKNOWN) { part_print(mmc_dev); return CMD_RET_SUCCESS; @@ -580,7 +580,7 @@ static int do_mmc_dev(struct cmd_tbl *cmdtp, int flag, if (!mmc) return CMD_RET_FAILURE; - ret = blk_select_hwpart_devnum(IF_TYPE_MMC, dev, part); + ret = blk_select_hwpart_devnum(UCLASS_MMC, dev, part); printf("switch to partitions #%d, %s\n", part, (!ret) ? "OK" : "ERROR"); if (ret) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index 2136af6416..825d4beb89 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -412,7 +412,7 @@ static size_t usb_read_file(const char *file_name) } /* Try to recognize storage devices immediately */ - blk_first_device(IF_TYPE_USB, &dev); + blk_first_device(UCLASS_USB, &dev); if (!dev) { printf("Error: USB storage device not found\n"); return 0; diff --git a/cmd/nvme.c b/cmd/nvme.c index e715c570a3..09d5f438fb 100644 --- a/cmd/nvme.c +++ b/cmd/nvme.c @@ -28,7 +28,7 @@ static int do_nvme(struct cmd_tbl *cmdtp, int flag, int argc, if (strncmp(argv[1], "deta", 4) == 0) { struct udevice *udev; - ret = blk_get_device(IF_TYPE_NVME, nvme_curr_dev, + ret = blk_get_device(UCLASS_NVME, nvme_curr_dev, &udev); if (ret < 0) return CMD_RET_FAILURE; @@ -39,7 +39,7 @@ static int do_nvme(struct cmd_tbl *cmdtp, int flag, int argc, } } - return blk_common_cmd(argc, argv, IF_TYPE_NVME, &nvme_curr_dev); + return blk_common_cmd(argc, argv, UCLASS_NVME, &nvme_curr_dev); } U_BOOT_CMD( diff --git a/cmd/pvblock.c b/cmd/pvblock.c index 56ce8b18d5..1b604c3737 100644 --- a/cmd/pvblock.c +++ b/cmd/pvblock.c @@ -14,7 +14,7 @@ static int pvblock_curr_device; int do_pvblock(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - return blk_common_cmd(argc, argv, IF_TYPE_PVBLOCK, + return blk_common_cmd(argc, argv, UCLASS_PVBLOCK, &pvblock_curr_device); } diff --git a/cmd/sata.c b/cmd/sata.c index 76da1906b7..9c9fe111d1 100644 --- a/cmd/sata.c +++ b/cmd/sata.c @@ -27,7 +27,7 @@ int sata_remove(int devnum) struct udevice *dev; int rc; - blk_unbind_all(IF_TYPE_SATA); + blk_unbind_all(UCLASS_AHCI); rc = uclass_find_device(UCLASS_AHCI, devnum, &dev); if (!rc && !dev) @@ -111,7 +111,7 @@ static int do_sata(struct cmd_tbl *cmdtp, int flag, int argc, sata_curr_device = 0; } - return blk_common_cmd(argc, argv, IF_TYPE_SATA, &sata_curr_device); + return blk_common_cmd(argc, argv, UCLASS_AHCI, &sata_curr_device); } U_BOOT_CMD( diff --git a/cmd/scsi.c b/cmd/scsi.c index 5f710d2895..4549995ba7 100644 --- a/cmd/scsi.c +++ b/cmd/scsi.c @@ -50,7 +50,7 @@ static int do_scsi(struct cmd_tbl *cmdtp, int flag, int argc, } } - return blk_common_cmd(argc, argv, IF_TYPE_SCSI, &scsi_curr_dev); + return blk_common_cmd(argc, argv, UCLASS_SCSI, &scsi_curr_dev); } U_BOOT_CMD( diff --git a/cmd/usb.c b/cmd/usb.c index 3d87376525..2ba056982c 100644 --- a/cmd/usb.c +++ b/cmd/usb.c @@ -719,7 +719,7 @@ static int do_usb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) if (strncmp(argv[1], "stor", 4) == 0) return usb_stor_info(); - return blk_common_cmd(argc, argv, IF_TYPE_USB, &usb_stor_curr_dev); + return blk_common_cmd(argc, argv, UCLASS_USB, &usb_stor_curr_dev); #else return CMD_RET_USAGE; #endif /* CONFIG_USB_STORAGE */ diff --git a/cmd/virtio.c b/cmd/virtio.c index ea3ed2e631..ec87d4f02c 100644 --- a/cmd/virtio.c +++ b/cmd/virtio.c @@ -40,7 +40,7 @@ static int do_virtio(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_SUCCESS; } - return blk_common_cmd(argc, argv, IF_TYPE_VIRTIO, &virtio_curr_dev); + return blk_common_cmd(argc, argv, UCLASS_VIRTIO, &virtio_curr_dev); } U_BOOT_CMD( -- cgit v1.2.3