Skip to content

Commit e22a4b7

Browse files
Tang Bingregkh
authored andcommitted
virtio-mmio: Use to_virtio_mmio_device() to simply code
[ Upstream commit da98b54 ] 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> Stable-dep-of: 55c91fe ("virtio-mmio: don't break lifecycle of vm_dev") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 432429d commit e22a4b7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/virtio/virtio_mmio.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,7 @@ static void virtio_mmio_release_dev(struct device *_d)
542542
{
543543
struct virtio_device *vdev =
544544
container_of(_d, struct virtio_device, dev);
545-
struct virtio_mmio_device *vm_dev =
546-
container_of(vdev, struct virtio_mmio_device, vdev);
545+
struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
547546
struct platform_device *pdev = vm_dev->pdev;
548547

549548
devm_kfree(&pdev->dev, vm_dev);

0 commit comments

Comments
 (0)