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

crypto: caam - only query h/w in job ring dequeue path

Code was needlessly checking the s/w job ring when there
would be nothing to process if the h/w's output completion
ring were empty anyway.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Kim Phillips and committed by
Herbert Xu
a8ea07c2 4bba1e9f

+5 -12
+5 -12
drivers/crypto/caam/jr.c
··· 59 59 u32 *userdesc, userstatus; 60 60 void *userarg; 61 61 62 - spin_lock_bh(&jrp->outlock); 62 + while (rd_reg32(&jrp->rregs->outring_used)) { 63 63 64 - head = ACCESS_ONCE(jrp->head); 65 - sw_idx = tail = jrp->tail; 64 + head = ACCESS_ONCE(jrp->head); 66 65 67 - while (CIRC_CNT(head, tail, JOBR_DEPTH) >= 1 && 68 - rd_reg32(&jrp->rregs->outring_used)) { 66 + spin_lock_bh(&jrp->outlock); 69 67 68 + sw_idx = tail = jrp->tail; 70 69 hw_idx = jrp->out_ring_read_index; 70 + 71 71 for (i = 0; CIRC_CNT(head, tail + i, JOBR_DEPTH) >= 1; i++) { 72 72 sw_idx = (tail + i) & (JOBR_DEPTH - 1); 73 73 ··· 121 121 122 122 /* Finally, execute user's callback */ 123 123 usercall(dev, userdesc, userstatus, userarg); 124 - 125 - spin_lock_bh(&jrp->outlock); 126 - 127 - head = ACCESS_ONCE(jrp->head); 128 - sw_idx = tail = jrp->tail; 129 124 } 130 - 131 - spin_unlock_bh(&jrp->outlock); 132 125 133 126 /* reenable / unmask IRQs */ 134 127 clrbits32(&jrp->rregs->rconfig_lo, JRCFG_IMSK);