
From: Simon Glass <sjg@chromium.org> It is confusing to use decimal values in device names. For example, with virtio: => dm tree ... pci 5 [ + ] pci_bridge_drv | |-- pci_0:1.5 virtio 5 [ + ] virtio-pci.m | | `-- virtio-pci.m#5 blk 0 [ + ] virtio-blk | | |-- virtio-blk#5 partition 0 [ + ] blk_partition | | | |-- virtio-blk#5:1 partition 1 [ + ] blk_partition | | | |-- virtio-blk#5:14 partition 2 [ + ] blk_partition | | | |-- virtio-blk#5:15 partition 3 [ + ] blk_partition | | | `-- virtio-blk#5:16 bootdev 2 [ + ] virtio_bootdev | | `-- virtio-blk#5.bootdev pci 6 [ + ] pci_bridge_drv | |-- pci_0:1.6 ... => ls virtio 0:14 ** Invalid partition 20 ** Couldn't find partition virtio 0:14 Fix this by using hex for both the block-device number and the partition. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/block/blk-uclass.c | 2 +- drivers/virtio/virtio-uclass.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index f3ac8db9464..f06b2ce3887 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -822,7 +822,7 @@ static int part_create_block_devices(struct udevice *blk_dev) for (count = 0, part = 1; part <= MAX_SEARCH_PARTITIONS; part++) { if (part_get_info(desc, part, &info)) continue; - snprintf(devname, sizeof(devname), "%s:%d", blk_dev->name, + snprintf(devname, sizeof(devname), "%s:%x", blk_dev->name, part); ret = device_bind_driver(blk_dev, "blk_partition", diff --git a/drivers/virtio/virtio-uclass.c b/drivers/virtio/virtio-uclass.c index 1dbc1a56aa2..17ef47df030 100644 --- a/drivers/virtio/virtio-uclass.c +++ b/drivers/virtio/virtio-uclass.c @@ -230,7 +230,7 @@ static int virtio_uclass_post_probe(struct udevice *udev) return 0; } - snprintf(dev_name, sizeof(dev_name), "%s#%d", name, dev_seq(udev)); + snprintf(dev_name, sizeof(dev_name), "%s#%x", name, dev_seq(udev)); str = strdup(dev_name); if (!str) return -ENOMEM; -- 2.43.0