diff mbox series

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

Message ID 20240826182938.1945684-3-witu@nvidia.com
State New
Headers show
Series Add VFIO P2P support | expand

Commit Message

William Tu Aug. 26, 2024, 6:29 p.m. UTC
From: Jason Gunthorpe <jgg@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@nvidia.com>
Signed-off-by: William Tu <witu@nvidia.com>
---
 include/linux/vfio.h | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

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 */