Skip to content

Commit 7d7b937

Browse files
vivekkreddykawasaki
authored andcommitted
vfio: Export vfio device get and put registration helpers
These helpers are useful for managing additional references taken on the device from other associated VFIO modules. Original-patch-by: Jason Gunthorpe <[email protected]> Signed-off-by: Vivek Kasireddy <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 5829586 commit 7d7b937

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/vfio/vfio_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,13 @@ void vfio_device_put_registration(struct vfio_device *device)
171171
if (refcount_dec_and_test(&device->refcount))
172172
complete(&device->comp);
173173
}
174+
EXPORT_SYMBOL_GPL(vfio_device_put_registration);
174175

175176
bool vfio_device_try_get_registration(struct vfio_device *device)
176177
{
177178
return refcount_inc_not_zero(&device->refcount);
178179
}
180+
EXPORT_SYMBOL_GPL(vfio_device_try_get_registration);
179181

180182
/*
181183
* VFIO driver API

include/linux/vfio.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ static inline void vfio_put_device(struct vfio_device *device)
297297
int vfio_register_group_dev(struct vfio_device *device);
298298
int vfio_register_emulated_iommu_dev(struct vfio_device *device);
299299
void vfio_unregister_group_dev(struct vfio_device *device);
300+
bool vfio_device_try_get_registration(struct vfio_device *device);
301+
void vfio_device_put_registration(struct vfio_device *device);
300302

301303
int vfio_assign_device_set(struct vfio_device *device, void *set_id);
302304
unsigned int vfio_device_set_open_count(struct vfio_device_set *dev_set);

0 commit comments

Comments
 (0)