[SRU][J:linux-bluefield][PATCH v3 2/6] UBUNTU: SAUCE: vfio: Add vfio_device_get()

William Tu witu at nvidia.com
Fri Sep 6 19:49:04 UTC 2024


From: Jason Gunthorpe <jgg at nvidia.com>

BugLink: https://bugs.launchpad.net/bugs/2077887

To increment a reference the caller already holds. Export
vfio_device_put() to pair with it.

Signed-off-by: Jason Gunthorpe <jgg at nvidia.com>
Signed-off-by: William Tu <witu at nvidia.com>
---
 include/linux/vfio.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index b7275ed44e4c..071cea3871c9 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -82,6 +82,11 @@ void vfio_unregister_group_dev(struct vfio_device *device);
 extern struct vfio_device *vfio_device_get_from_dev(struct device *dev);
 extern void vfio_device_put(struct vfio_device *device);
 
+static inline void vfio_device_get(struct vfio_device *device)
+{
+       refcount_inc(&device->refcount);
+}
+
 int vfio_assign_device_set(struct vfio_device *device, void *set_id);
 
 /* events for the backend driver notify callback */
-- 
2.34.1




More information about the kernel-team mailing list