Skip to content

Commit

Permalink
crypto: sun4i-ss - use lower/upper_32_bits helpers
Browse files Browse the repository at this point in the history
Replace custom bit shifts and masks with lower/upper_32_bits helpers.

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 a595e60 commit 11be010
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/crypto/sunxi-ss/sun4i-ss-hash.c
Original file line number Diff line number Diff line change
@@ -188,7 +188,6 @@ static int sun4i_hash(struct ahash_request *areq)
struct sg_mapping_iter mi;
int in_r, err = 0, zeros;
size_t copied = 0;
__be64 bits;

dev_dbg(ss->dev, "%s %s bc=%llu len=%u mode=%x wl=%u h0=%0x",
__func__, crypto_tfm_alg_name(areq->base.tfm),
@@ -423,12 +422,13 @@ static int sun4i_hash(struct ahash_request *areq)

/* write the length of data */
if (op->mode == SS_OP_SHA1) {
bits = cpu_to_be64(op->byte_count << 3);
bf[j++] = bits & 0xffffffff;
bf[j++] = (bits >> 32) & 0xffffffff;
__be64 bits = cpu_to_be64(op->byte_count << 3);
bf[j++] = lower_32_bits(bits);
bf[j++] = upper_32_bits(bits);
} else {
bf[j++] = (op->byte_count << 3) & 0xffffffff;
bf[j++] = (op->byte_count >> 29) & 0xffffffff;
__le64 bits = op->byte_count << 3;
bf[j++] = lower_32_bits(bits);
bf[j++] = upper_32_bits(bits);
}
writesl(ss->base + SS_RXFIFO, bf, j);

0 comments on commit 11be010

Please sign in to comment.