dmaengine: idxd: make idxd_wq_enable() return 0 if wq is already enabled
authorDave Jiang <dave.jiang@intel.com>
Mon, 25 Apr 2022 18:03:29 +0000 (11:03 -0700)
committerVinod Koul <vkoul@kernel.org>
Thu, 19 May 2022 18:13:41 +0000 (23:43 +0530)
When calling idxd_wq_enable() and wq is already enabled, code should return 0
and indicate function is successful instead of return error code and fail.
This should also put idxd_wq_enable() in sync with idxd_wq_disable() where
it returns 0 if wq is already disabled.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/165090980906.1378449.1939401700832432886.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/idxd/device.c

index 1143886f4a80247bd58b77b28be6ed33e4f56c61..dd6a05eccb189600cb2eb479114dab1a555fc264 100644 (file)
@@ -184,7 +184,7 @@ int idxd_wq_enable(struct idxd_wq *wq)
 
        if (wq->state == IDXD_WQ_ENABLED) {
                dev_dbg(dev, "WQ %d already enabled\n", wq->id);
-               return -ENXIO;
+               return 0;
        }
 
        idxd_cmd_exec(idxd, IDXD_CMD_ENABLE_WQ, wq->id, &status);