diff mbox series

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

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

Commit Message

William Tu Sept. 25, 2024, 5:22 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 */