aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vfio/mdev/mdev_core.c
diff options
context:
space:
mode:
authorChristoph Hellwig <[email protected]>2022-09-23 09:26:44 +0000
committerAlex Williamson <[email protected]>2022-10-04 18:06:58 +0000
commitcbf3bb28aaeaee425ca7b9c537a3efff1f8c98ae (patch)
treedc6a12ff81eed0ecb9c3c48b13b89c267188098c /drivers/vfio/mdev/mdev_core.c
parentvfio/mdev: simplify mdev_type handling (diff)
downloadkernel-cbf3bb28aaeaee425ca7b9c537a3efff1f8c98ae.tar.gz
kernel-cbf3bb28aaeaee425ca7b9c537a3efff1f8c98ae.zip
vfio/mdev: remove mdev_from_dev
Just open code it in the only caller. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Reviewed-by: Kirti Wankhede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alex Williamson <[email protected]>
Diffstat (limited to 'drivers/vfio/mdev/mdev_core.c')
-rw-r--r--drivers/vfio/mdev/mdev_core.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c
index 2d95a497fd3b..bde7ce620dae 100644
--- a/drivers/vfio/mdev/mdev_core.c
+++ b/drivers/vfio/mdev/mdev_core.c
@@ -53,10 +53,8 @@ static void mdev_device_remove_common(struct mdev_device *mdev)
static int mdev_device_remove_cb(struct device *dev, void *data)
{
- struct mdev_device *mdev = mdev_from_dev(dev);
-
- if (mdev)
- mdev_device_remove_common(mdev);
+ if (dev->bus == &mdev_bus_type)
+ mdev_device_remove_common(to_mdev_device(dev));
return 0;
}