vfio/mdev: remove mdev_from_dev
authorChristoph Hellwig <hch@lst.de>
Fri, 23 Sep 2022 09:26:44 +0000 (11:26 +0200)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 4 Oct 2022 18:06:58 +0000 (12:06 -0600)
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>
drivers/vfio/mdev/mdev_core.c
include/linux/mdev.h

index 2d95a49..bde7ce6 100644 (file)
@@ -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;
 }
 
index 19bc93c..4f558de 100644 (file)
@@ -102,9 +102,5 @@ static inline struct device *mdev_dev(struct mdev_device *mdev)
 {
        return &mdev->dev;
 }
-static inline struct mdev_device *mdev_from_dev(struct device *dev)
-{
-       return dev->bus == &mdev_bus_type ? to_mdev_device(dev) : NULL;
-}
 
 #endif /* MDEV_H */