[PATCH 05/13] vfio/mdev: remove mdev_from_dev
Kirti Wankhede
kwankhede at nvidia.com
Wed Jun 15 20:06:27 UTC 2022
On 6/14/2022 10:24 AM, Christoph Hellwig wrote:
> Just open code it in the only caller.
>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> Reviewed-by: Jason Gunthorpe <jgg at nvidia.com>
> Reviewed-by: Kevin Tian <kevin.tian at intel.com>
Reviewed By: Kirti Wankhede <kwankhede at nvidia.com>
> ---
> drivers/vfio/mdev/mdev_core.c | 6 ++----
> include/linux/mdev.h | 4 ----
> 2 files changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c
> index fe4230b21993d..49a4a26787ce6 100644
> --- a/drivers/vfio/mdev/mdev_core.c
> +++ b/drivers/vfio/mdev/mdev_core.c
> @@ -54,10 +54,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;
> }
>
> diff --git a/include/linux/mdev.h b/include/linux/mdev.h
> index d28ddf0f561a0..409e86d343a05 100644
> --- a/include/linux/mdev.h
> +++ b/include/linux/mdev.h
> @@ -107,9 +107,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 */
More information about the intel-gvt-dev
mailing list