diff options
author | Simon Glass <sjg@chromium.org> | 2022-08-11 19:34:59 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-09-16 11:05:16 -0400 |
commit | e33a5c6be55e7c012b2851f9bdf90e7f607e72bf (patch) | |
tree | 19041e9f1b54a5d2811c96e88132ba44fe31243b /drivers/block/sandbox.c | |
parent | adbfe8edc3389ba635229195a95217d8b0dfa182 (diff) | |
download | u-boot-e33a5c6be55e7c012b2851f9bdf90e7f607e72bf.zip u-boot-e33a5c6be55e7c012b2851f9bdf90e7f607e72bf.tar.gz u-boot-e33a5c6be55e7c012b2851f9bdf90e7f607e72bf.tar.bz2 |
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 <sjg@chromium.org>
Diffstat (limited to 'drivers/block/sandbox.c')
-rw-r--r-- | drivers/block/sandbox.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c index 1388498..2de12e0 100644 --- a/drivers/block/sandbox.c +++ b/drivers/block/sandbox.c @@ -98,7 +98,7 @@ int host_dev_bind(int devnum, char *filename, bool removable) int ret, fd; /* Remove and unbind the old device, if any */ - ret = blk_get_device(IF_TYPE_HOST, devnum, &dev); + ret = blk_get_device(UCLASS_ROOT, devnum, &dev); if (ret == 0) { ret = device_remove(dev, DM_REMOVE_NORMAL); if (ret) @@ -135,7 +135,7 @@ int host_dev_bind(int devnum, char *filename, bool removable) } } ret = blk_create_device(gd->dm_root, "sandbox_host_blk", str, - IF_TYPE_HOST, devnum, 512, + UCLASS_ROOT, devnum, 512, os_lseek(fd, 0, OS_SEEK_END) / 512, &dev); if (ret) goto err_file; @@ -150,7 +150,7 @@ int host_dev_bind(int devnum, char *filename, bool removable) goto err_file; } - desc = blk_get_devnum_by_type(IF_TYPE_HOST, devnum); + desc = blk_get_devnum_by_type(UCLASS_ROOT, devnum); desc->removable = removable; snprintf(desc->vendor, BLK_VEN_SIZE, "U-Boot"); snprintf(desc->product, BLK_PRD_SIZE, "hostfile"); @@ -192,7 +192,7 @@ int host_dev_bind(int dev, char *filename, bool removable) } struct blk_desc *blk_dev = &host_dev->blk_dev; - blk_dev->if_type = IF_TYPE_HOST; + blk_dev->if_type = UCLASS_ROOT; blk_dev->priv = host_dev; blk_dev->blksz = 512; blk_dev->lba = os_lseek(host_dev->fd, 0, OS_SEEK_END) / blk_dev->blksz; @@ -216,7 +216,7 @@ int host_get_dev_err(int devnum, struct blk_desc **blk_devp) struct udevice *dev; int ret; - ret = blk_get_device(IF_TYPE_HOST, devnum, &dev); + ret = blk_get_device(UCLASS_ROOT, devnum, &dev); if (ret) return ret; *blk_devp = dev_get_uclass_plat(dev); @@ -263,7 +263,7 @@ U_BOOT_DRIVER(sandbox_host_blk) = { #else U_BOOT_LEGACY_BLK(sandbox_host) = { .if_typename = "host", - .if_type = IF_TYPE_HOST, + .if_type = UCLASS_ROOT, .max_devs = SANDBOX_HOST_MAX_DEVICES, .get_dev = host_get_dev_err, }; |