Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: idxd: move wq irq enabling to after device enable

Move the calling of request_irq() and other related irq setup code until
after the WQ is successfully enabled. This reduces the amount of
setup/teardown if the wq is not configured correctly and cannot be enabled.

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

authored by

Dave Jiang and committed by
Vinod Koul
439b5e76 96144c8f

+9 -9
+9 -9
drivers/dma/idxd/dma.c
··· 291 291 mutex_lock(&wq->wq_lock); 292 292 wq->type = IDXD_WQT_KERNEL; 293 293 294 - rc = idxd_wq_request_irq(wq); 295 - if (rc < 0) { 296 - idxd->cmd_status = IDXD_SCMD_WQ_IRQ_ERR; 297 - dev_dbg(dev, "WQ %d irq setup failed: %d\n", wq->id, rc); 298 - goto err_irq; 299 - } 300 - 301 294 rc = __drv_enable_wq(wq); 302 295 if (rc < 0) { 303 296 dev_dbg(dev, "Enable wq %d failed: %d\n", wq->id, rc); 304 297 rc = -ENXIO; 305 298 goto err; 299 + } 300 + 301 + rc = idxd_wq_request_irq(wq); 302 + if (rc < 0) { 303 + idxd->cmd_status = IDXD_SCMD_WQ_IRQ_ERR; 304 + dev_dbg(dev, "WQ %d irq setup failed: %d\n", wq->id, rc); 305 + goto err_irq; 306 306 } 307 307 308 308 rc = idxd_wq_alloc_resources(wq); ··· 336 336 err_ref: 337 337 idxd_wq_free_resources(wq); 338 338 err_res_alloc: 339 - __drv_disable_wq(wq); 340 - err: 341 339 idxd_wq_free_irq(wq); 342 340 err_irq: 341 + __drv_disable_wq(wq); 342 + err: 343 343 wq->type = IDXD_WQT_NONE; 344 344 mutex_unlock(&wq->wq_lock); 345 345 return rc;