History

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.

Dave Jiang committed 4 years ago

Commit 439b5e71 parent 96144c81 file · +9 −9Browse files

Unified · Split

drivers/dma/idxd/dma.c+9−9
@@ -291,13 +291,6 @@ static int idxd_dmaengine_drv_probe(struct idxd_dev *idxd_dev) · 290 unmodified lines
291291 mutex_lock(&wq->wq_lock);
292292 wq->type = IDXD_WQT_KERNEL;
293293
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−
301294 rc = __drv_enable_wq(wq);
302295 if (rc < 0) {
303296 dev_dbg(dev, "Enable wq %d failed: %d\n", wq->id, rc);
@@ -305,6 +298,13 @@ static int idxd_dmaengine_drv_probe(struct idxd_dev *idxd_dev) · 1 unmodified line
305298 goto err;
306299 }
307300
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+ }
307+
308308 rc = idxd_wq_alloc_resources(wq);
309309 if (rc < 0) {
310310 idxd->cmd_status = IDXD_SCMD_WQ_RES_ALLOC_ERR;
@@ -336,10 +336,10 @@ err_dma: · 25 unmodified lines
336336 err_ref:
337337 idxd_wq_free_resources(wq);
338338 err_res_alloc:
339− __drv_disable_wq(wq);
340−err:
341339 idxd_wq_free_irq(wq);
342340 err_irq:
341+ __drv_disable_wq(wq);
342+err:
343343 wq->type = IDXD_WQT_NONE;
344344 mutex_unlock(&wq->wq_lock);
345345 return rc;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t