diff options
author | Kim Phillips <kim.phillips@freescale.com> | 2012-06-22 20:48:55 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2012-06-27 02:42:07 -0400 |
commit | a8ea07c21d40cf17dd9cbe3cbf87d477b26c354f (patch) | |
tree | eaa4fd8691ab7d1a2a12d24341af2c98a874e635 /drivers/crypto/caam | |
parent | 4bba1e9f41d68279ff2c17db53fbd379692b10bc (diff) |
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>
Diffstat (limited to 'drivers/crypto/caam')
-rw-r--r-- | drivers/crypto/caam/jr.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index 11d93f243705..7ae5e51a0597 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c | |||
@@ -59,15 +59,15 @@ static void caam_jr_dequeue(unsigned long devarg) | |||
59 | u32 *userdesc, userstatus; | 59 | u32 *userdesc, userstatus; |
60 | void *userarg; | 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); | 64 | head = ACCESS_ONCE(jrp->head); |
65 | sw_idx = tail = jrp->tail; | ||
66 | 65 | ||
67 | while (CIRC_CNT(head, tail, JOBR_DEPTH) >= 1 && | 66 | spin_lock_bh(&jrp->outlock); |
68 | rd_reg32(&jrp->rregs->outring_used)) { | ||
69 | 67 | ||
68 | sw_idx = tail = jrp->tail; | ||
70 | hw_idx = jrp->out_ring_read_index; | 69 | hw_idx = jrp->out_ring_read_index; |
70 | |||
71 | for (i = 0; CIRC_CNT(head, tail + i, JOBR_DEPTH) >= 1; i++) { | 71 | for (i = 0; CIRC_CNT(head, tail + i, JOBR_DEPTH) >= 1; i++) { |
72 | sw_idx = (tail + i) & (JOBR_DEPTH - 1); | 72 | sw_idx = (tail + i) & (JOBR_DEPTH - 1); |
73 | 73 | ||
@@ -121,15 +121,8 @@ static void caam_jr_dequeue(unsigned long devarg) | |||
121 | 121 | ||
122 | /* Finally, execute user's callback */ | 122 | /* Finally, execute user's callback */ |
123 | usercall(dev, userdesc, userstatus, userarg); | 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 | 125 | ||
131 | spin_unlock_bh(&jrp->outlock); | ||
132 | |||
133 | /* reenable / unmask IRQs */ | 126 | /* reenable / unmask IRQs */ |
134 | clrbits32(&jrp->rregs->rconfig_lo, JRCFG_IMSK); | 127 | clrbits32(&jrp->rregs->rconfig_lo, JRCFG_IMSK); |
135 | } | 128 | } |