[PATCH v2 019/113] block: virtio: assign virtio-mmio device tree node to cdevs
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Mar 4 10:59:04 PST 2024
All block devices except for virtio-mmio have a pointer to the hardware
device tree node if available, so add it to virtio-mmio as well.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/block/virtio_blk.c | 1 +
drivers/virtio/virtio.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 11e52d9e6457..625daf6879c0 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -99,6 +99,7 @@ static int virtio_blk_probe(struct virtio_device *vdev)
devnum = cdev_find_free_index("virtioblk");
priv->blk.cdev.name = xasprintf("virtioblk%d", devnum);
+ cdev_set_of_node(&priv->blk.cdev, vdev->dev.device_node);
priv->blk.dev = &vdev->dev;
priv->blk.blockbits = SECTOR_SHIFT;
virtio_cread(vdev, struct virtio_blk_config, capacity, &cap);
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index aeca04aa9237..c4854e7d11aa 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -289,6 +289,7 @@ int register_virtio_device(struct virtio_device *dev)
dev->dev.bus = &virtio_bus;
dev->dev.id = DEVICE_ID_DYNAMIC;
dev->dev.name = "virtio";
+ dev->dev.device_node = dev_of_node(dev->dev.parent);
spin_lock_init(&dev->config_lock);
dev->config_enabled = false;
--
2.39.2
More information about the barebox
mailing list