Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vfio/mdev: remove mdev_from_dev

Just open code it in the only caller.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com>
Link: https://lore.kernel.org/r/20220923092652.100656-7-hch@lst.de
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>

authored by

Christoph Hellwig and committed by
Alex Williamson
cbf3bb28 da44c340

+2 -8
+2 -4
drivers/vfio/mdev/mdev_core.c
··· 53 53 54 54 static int mdev_device_remove_cb(struct device *dev, void *data) 55 55 { 56 - struct mdev_device *mdev = mdev_from_dev(dev); 57 - 58 - if (mdev) 59 - mdev_device_remove_common(mdev); 56 + if (dev->bus == &mdev_bus_type) 57 + mdev_device_remove_common(to_mdev_device(dev)); 60 58 return 0; 61 59 } 62 60
-4
include/linux/mdev.h
··· 102 102 { 103 103 return &mdev->dev; 104 104 } 105 - static inline struct mdev_device *mdev_from_dev(struct device *dev) 106 - { 107 - return dev->bus == &mdev_bus_type ? to_mdev_device(dev) : NULL; 108 - } 109 105 110 106 #endif /* MDEV_H */