[Intel-gfx] [PATCH v2 8/9] vfio: Export vfio_device_try_get()

Jason Gunthorpe
2021-09-09T19:39:33Z

vfio_ccw will need it.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
drivers/vfio/vfio.c | 3 ++-
include/linux/vfio.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index c3ca33e513c8e9..e78278a0b98a96 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -603,10 +603,11 @@ void vfio_device_put(struct vfio_device *device)
}
EXPORT_SYMBOL_GPL(vfio_device_put);

-static bool vfio_device_try_get(struct vfio_device *device)
+bool vfio_device_try_get(struct vfio_device *device)
{
return refcount_inc_not_zero(&device->refcount);
}
+EXPORT_SYMBOL_GPL(vfio_device_try_get);

static struct vfio_device *vfio_group_get_device(struct vfio_group *group,
struct device *dev)
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index e65137a708f185..69df8bcc49aaf4 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -80,6 +80,7 @@ void vfio_uninit_group_dev(struct vfio_device *device);
int vfio_register_group_dev(struct vfio_device *device);
void vfio_unregister_group_dev(struct vfio_device *device);
extern struct vfio_device *vfio_device_get_from_dev(struct device *dev);
+bool vfio_device_try_get(struct vfio_device *device);
extern void vfio_device_put(struct vfio_device *device);

int vfio_assign_device_set(struct vfio_device *device, void *set_id);
--
2.33.0