Message ID | 20220603063328.3715-6-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/8] vfio/mdev: make mdev.h standalone includable | expand |
On Fri, Jun 03, 2022 at 08:33:25AM +0200, Christoph Hellwig wrote: > Just open code it in the only caller. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > drivers/vfio/mdev/mdev_core.c | 6 ++---- > include/linux/mdev.h | 4 ---- > 2 files changed, 2 insertions(+), 8 deletions(-) Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Jason
> From: Christoph Hellwig > Sent: Friday, June 3, 2022 2:33 PM > > Just open code it in the only caller. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Kevin Tian <kevin.tian@intel.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 34b01d45cfe9f..3575e893b5e43 100644 > --- a/drivers/vfio/mdev/mdev_core.c > +++ b/drivers/vfio/mdev/mdev_core.c > @@ -56,10 +56,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 cbb53dcd20d9d..5811b5a52a511 100644 > --- a/include/linux/mdev.h > +++ b/include/linux/mdev.h > @@ -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 */ > -- > 2.30.2
diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c index 34b01d45cfe9f..3575e893b5e43 100644 --- a/drivers/vfio/mdev/mdev_core.c +++ b/drivers/vfio/mdev/mdev_core.c @@ -56,10 +56,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 cbb53dcd20d9d..5811b5a52a511 100644 --- a/include/linux/mdev.h +++ b/include/linux/mdev.h @@ -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 */
Just open code it in the only caller. Signed-off-by: Christoph Hellwig <hch@lst.de> --- drivers/vfio/mdev/mdev_core.c | 6 ++---- include/linux/mdev.h | 4 ---- 2 files changed, 2 insertions(+), 8 deletions(-)