mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
vfio: get rid of open-coding kref_put_mutex
Acked-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
8ad5db8a8d
commit
6d2cd3ce81
1 changed files with 2 additions and 7 deletions
|
@ -264,6 +264,7 @@ static struct vfio_group *vfio_create_group(struct iommu_group *iommu_group)
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* called with vfio.group_lock held */
|
||||||
static void vfio_group_release(struct kref *kref)
|
static void vfio_group_release(struct kref *kref)
|
||||||
{
|
{
|
||||||
struct vfio_group *group = container_of(kref, struct vfio_group, kref);
|
struct vfio_group *group = container_of(kref, struct vfio_group, kref);
|
||||||
|
@ -287,13 +288,7 @@ static void vfio_group_release(struct kref *kref)
|
||||||
|
|
||||||
static void vfio_group_put(struct vfio_group *group)
|
static void vfio_group_put(struct vfio_group *group)
|
||||||
{
|
{
|
||||||
mutex_lock(&vfio.group_lock);
|
kref_put_mutex(&group->kref, vfio_group_release, &vfio.group_lock);
|
||||||
/*
|
|
||||||
* Release needs to unlock to unregister the notifier, so only
|
|
||||||
* unlock if not released.
|
|
||||||
*/
|
|
||||||
if (!kref_put(&group->kref, vfio_group_release))
|
|
||||||
mutex_unlock(&vfio.group_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assume group_lock or group reference is held */
|
/* Assume group_lock or group reference is held */
|
||||||
|
|
Loading…
Reference in a new issue