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

soc: fsl: qbman: Add helper for sanity checking cgr ops

This breaks out/combines get_affine_portal and the cgr sanity check in
preparation for the next commit. No functional change intended.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Acked-by: Camelia Groza <camelia.groza@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Sean Anderson and committed by
David S. Miller
d0e17a46 fca4804f

+19 -10
+19 -10
drivers/soc/fsl/qbman/qman.c
··· 2483 2483 } 2484 2484 EXPORT_SYMBOL(qman_create_cgr); 2485 2485 2486 - int qman_delete_cgr(struct qman_cgr *cgr) 2486 + static struct qman_portal *qman_cgr_get_affine_portal(struct qman_cgr *cgr) 2487 2487 { 2488 - unsigned long irqflags; 2489 - struct qm_mcr_querycgr cgr_state; 2490 - struct qm_mcc_initcgr local_opts; 2491 - int ret = 0; 2492 - struct qman_cgr *i; 2493 2488 struct qman_portal *p = get_affine_portal(); 2494 2489 2495 2490 if (cgr->chan != p->config->channel) { ··· 2492 2497 dev_err(p->config->dev, "CGR not owned by current portal"); 2493 2498 dev_dbg(p->config->dev, " create 0x%x, delete 0x%x\n", 2494 2499 cgr->chan, p->config->channel); 2495 - 2496 - ret = -EINVAL; 2497 - goto put_portal; 2500 + put_affine_portal(); 2501 + return NULL; 2498 2502 } 2503 + 2504 + return p; 2505 + } 2506 + 2507 + int qman_delete_cgr(struct qman_cgr *cgr) 2508 + { 2509 + unsigned long irqflags; 2510 + struct qm_mcr_querycgr cgr_state; 2511 + struct qm_mcc_initcgr local_opts; 2512 + int ret = 0; 2513 + struct qman_cgr *i; 2514 + struct qman_portal *p = qman_cgr_get_affine_portal(cgr); 2515 + 2516 + if (!p) 2517 + return -EINVAL; 2518 + 2499 2519 memset(&local_opts, 0, sizeof(struct qm_mcc_initcgr)); 2500 2520 spin_lock_irqsave(&p->cgr_lock, irqflags); 2501 2521 list_del(&cgr->node); ··· 2538 2528 list_add(&cgr->node, &p->cgr_cbs); 2539 2529 release_lock: 2540 2530 spin_unlock_irqrestore(&p->cgr_lock, irqflags); 2541 - put_portal: 2542 2531 put_affine_portal(); 2543 2532 return ret; 2544 2533 }