Skip to content

Commit fa37213

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. Signed-off-by: Jason Gunthorpe <[email protected]> Signed-off-by: Vivek Kasireddy <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 3318280 commit fa37213

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
@@ -293,6 +293,8 @@ static inline void vfio_put_device(struct vfio_device *device)
293293
int vfio_register_group_dev(struct vfio_device *device);
294294
int vfio_register_emulated_iommu_dev(struct vfio_device *device);
295295
void vfio_unregister_group_dev(struct vfio_device *device);
296+
bool vfio_device_try_get_registration(struct vfio_device *device);
297+
void vfio_device_put_registration(struct vfio_device *device);
296298

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

0 commit comments

Comments
 (0)