[PATCH 019/112] block: virtio: assign virtio-mmio device tree node to cdevs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux