Skip to content

Commit 1b30b98

Browse files
nxa22042herbertx
authored andcommitted
crypto: caam/jr - Removed redundant vars from job ring private data
For each job ring, the variable 'ringsize' is initialised but never used. Similarly variables 'inp_ring_write_index' and 'head' always track the same value and instead of 'inp_ring_write_index', caam_jr_enqueue() can use 'head' itself. Both these variables have been removed. Signed-off-by: Vakul Garg <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent a118dfa commit 1b30b98

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

drivers/crypto/caam/intern.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ struct caam_drv_private_jr {
4949
atomic_t tfm_count ____cacheline_aligned;
5050

5151
/* Job ring info */
52-
int ringsize; /* Size of rings (assume input = output) */
5352
struct caam_jrentry_info *entinfo; /* Alloc'ed 1 per ring entry */
5453
spinlock_t inplock ____cacheline_aligned; /* Input ring index lock */
55-
int inp_ring_write_index; /* Input index "tail" */
5654
u32 inpring_avail; /* Number of free entries in input ring */
5755
int head; /* entinfo (s/w ring) head index */
5856
dma_addr_t *inpring; /* Base of input ring, alloc DMA-safe */

drivers/crypto/caam/jr.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ int caam_jr_enqueue(struct device *dev, u32 *desc,
358358
head_entry->cbkarg = areq;
359359
head_entry->desc_addr_dma = desc_dma;
360360

361-
jrp->inpring[jrp->inp_ring_write_index] = cpu_to_caam_dma(desc_dma);
361+
jrp->inpring[head] = cpu_to_caam_dma(desc_dma);
362362

363363
/*
364364
* Guarantee that the descriptor's DMA address has been written to
@@ -367,8 +367,6 @@ int caam_jr_enqueue(struct device *dev, u32 *desc,
367367
*/
368368
smp_wmb();
369369

370-
jrp->inp_ring_write_index = (jrp->inp_ring_write_index + 1) &
371-
(JOBR_DEPTH - 1);
372370
jrp->head = (head + 1) & (JOBR_DEPTH - 1);
373371

374372
/*
@@ -434,7 +432,6 @@ static int caam_jr_init(struct device *dev)
434432
jrp->entinfo[i].desc_addr_dma = !0;
435433

436434
/* Setup rings */
437-
jrp->inp_ring_write_index = 0;
438435
jrp->out_ring_read_index = 0;
439436
jrp->head = 0;
440437
jrp->tail = 0;
@@ -444,7 +441,6 @@ static int caam_jr_init(struct device *dev)
444441
wr_reg32(&jrp->rregs->inpring_size, JOBR_DEPTH);
445442
wr_reg32(&jrp->rregs->outring_size, JOBR_DEPTH);
446443

447-
jrp->ringsize = JOBR_DEPTH;
448444
jrp->inpring_avail = JOBR_DEPTH;
449445

450446
spin_lock_init(&jrp->inplock);

0 commit comments

Comments
 (0)