diff options
author | Max Gurtovoy <mgurtovoy@nvidia.com> | 2021-05-18 22:21:32 +0300 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2021-06-15 23:12:15 +0300 |
commit | 9dcf01d95721261844d8c07c142efc143f7d38e3 (patch) | |
tree | 779e6b75b40ed6b96acf52fff59111ee09c37119 /drivers/vfio/pci | |
parent | 009c9aa5be652675a06d5211e1640e02bbb1c33d (diff) | |
download | linux-9dcf01d95721261844d8c07c142efc143f7d38e3.tar.xz |
vfio: centralize module refcount in subsystem layer
Remove code duplication and move module refcounting to the subsystem
module.
Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Link: https://lore.kernel.org/r/20210518192133.59195-2-mgurtovoy@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/pci')
-rw-r--r-- | drivers/vfio/pci/vfio_pci.c | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index bd7c482c948a..f6729baa1bf4 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -558,8 +558,6 @@ static void vfio_pci_release(struct vfio_device *core_vdev) } mutex_unlock(&vdev->reflck->lock); - - module_put(THIS_MODULE); } static int vfio_pci_open(struct vfio_device *core_vdev) @@ -568,9 +566,6 @@ static int vfio_pci_open(struct vfio_device *core_vdev) container_of(core_vdev, struct vfio_pci_device, vdev); int ret = 0; - if (!try_module_get(THIS_MODULE)) - return -ENODEV; - mutex_lock(&vdev->reflck->lock); if (!vdev->refcnt) { @@ -584,8 +579,6 @@ static int vfio_pci_open(struct vfio_device *core_vdev) vdev->refcnt++; error: mutex_unlock(&vdev->reflck->lock); - if (ret) - module_put(THIS_MODULE); return ret; } |