virtio-mmio: Use to_virtio_mmio_device() to simply code
authorTang Bin <tangbin@cmss.chinamobile.com>
Mon, 22 Feb 2021 05:57:24 +0000 (13:57 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 14 Mar 2021 08:37:35 +0000 (04:37 -0400)
The file virtio_mmio.c has defined the function to_virtio_mmio_device,
so use it instead of container_of() to simply code.

Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20210222055724.220-1-tangbin@cmss.chinamobile.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/virtio/virtio_mmio.c

index a286d22..56128b9 100644 (file)
@@ -548,8 +548,7 @@ static void virtio_mmio_release_dev(struct device *_d)
 {
        struct virtio_device *vdev =
                        container_of(_d, struct virtio_device, dev);
-       struct virtio_mmio_device *vm_dev =
-                       container_of(vdev, struct virtio_mmio_device, vdev);
+       struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
        struct platform_device *pdev = vm_dev->pdev;
 
        devm_kfree(&pdev->dev, vm_dev);