]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dmaengine: idxd: Remove a useless mutex
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 2 Nov 2024 11:46:04 +0000 (12:46 +0100)
committerVinod Koul <vkoul@kernel.org>
Mon, 2 Dec 2024 17:03:35 +0000 (22:33 +0530)
ida_alloc()/ida_free() don't need any mutex, so remove this one.

It was introduced by commit e6fd6d7e5f0f ("dmaengine: idxd: add a device to
represent the file opened").

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/e08df764e7046178ada4ec066852c0ce65410373.1730547933.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/idxd/cdev.c

index 57f1bf2ab20be040b477b0062f9e21727baf8526..ff94ee892339d5b98541d229b371deee73180f24 100644 (file)
@@ -28,7 +28,6 @@ struct idxd_cdev_context {
  * global to avoid conflict file names.
  */
 static DEFINE_IDA(file_ida);
-static DEFINE_MUTEX(ida_lock);
 
 /*
  * ictx is an array based off of accelerator types. enum idxd_type
@@ -123,9 +122,7 @@ static void idxd_file_dev_release(struct device *dev)
        struct idxd_device *idxd = wq->idxd;
        int rc;
 
-       mutex_lock(&ida_lock);
        ida_free(&file_ida, ctx->id);
-       mutex_unlock(&ida_lock);
 
        /* Wait for in-flight operations to complete. */
        if (wq_shared(wq)) {
@@ -284,9 +281,7 @@ static int idxd_cdev_open(struct inode *inode, struct file *filp)
        }
 
        idxd_cdev = wq->idxd_cdev;
-       mutex_lock(&ida_lock);
        ctx->id = ida_alloc(&file_ida, GFP_KERNEL);
-       mutex_unlock(&ida_lock);
        if (ctx->id < 0) {
                dev_warn(dev, "ida alloc failure\n");
                goto failed_ida;