Skip to content

Commit

Permalink
crypto: sun4i-ss - use GENMASK to generate masks
Browse files Browse the repository at this point in the history
Use the GENMASK helper instead of custom calculations to generate masks,
It also helps the readability.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Antoine Ténart authored and Herbert Xu committed Jun 19, 2017
1 parent 303391d commit d78867a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/crypto/sunxi-ss/sun4i-ss-hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,14 @@ static int sun4i_hash(struct ahash_request *areq)
writesl(ss->base + SS_RXFIFO, op->buf, nwait);
op->byte_count += 4 * nwait;
}

nbw = op->len - 4 * nwait;
wb = *(u32 *)(op->buf + nwait * 4);
wb &= (0xFFFFFFFF >> (4 - nbw) * 8);
if (nbw) {
wb = *(u32 *)(op->buf + nwait * 4);
wb &= GENMASK((nbw * 8) - 1, 0);

op->byte_count += nbw;
op->byte_count += nbw;
}
}

/* write the remaining bytes of the nbw buffer */
Expand Down

0 comments on commit d78867a

Please sign in to comment.