Commit 11be0107 authored by Antoine Ténart's avatar Antoine Ténart Committed by Herbert Xu

crypto: sun4i-ss - use lower/upper_32_bits helpers

Replace custom bit shifts and masks with lower/upper_32_bits helpers.
Signed-off-by: default avatarAntoine Tenart <antoine.tenart@free-electrons.com>
Tested-by: default avatarCorentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: default avatarCorentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent a595e60a
...@@ -188,7 +188,6 @@ static int sun4i_hash(struct ahash_request *areq) ...@@ -188,7 +188,6 @@ static int sun4i_hash(struct ahash_request *areq)
struct sg_mapping_iter mi; struct sg_mapping_iter mi;
int in_r, err = 0, zeros; int in_r, err = 0, zeros;
size_t copied = 0; size_t copied = 0;
__be64 bits;
dev_dbg(ss->dev, "%s %s bc=%llu len=%u mode=%x wl=%u h0=%0x", dev_dbg(ss->dev, "%s %s bc=%llu len=%u mode=%x wl=%u h0=%0x",
__func__, crypto_tfm_alg_name(areq->base.tfm), __func__, crypto_tfm_alg_name(areq->base.tfm),
...@@ -423,12 +422,13 @@ static int sun4i_hash(struct ahash_request *areq) ...@@ -423,12 +422,13 @@ static int sun4i_hash(struct ahash_request *areq)
/* write the length of data */ /* write the length of data */
if (op->mode == SS_OP_SHA1) { if (op->mode == SS_OP_SHA1) {
bits = cpu_to_be64(op->byte_count << 3); __be64 bits = cpu_to_be64(op->byte_count << 3);
bf[j++] = bits & 0xffffffff; bf[j++] = lower_32_bits(bits);
bf[j++] = (bits >> 32) & 0xffffffff; bf[j++] = upper_32_bits(bits);
} else { } else {
bf[j++] = (op->byte_count << 3) & 0xffffffff; __le64 bits = op->byte_count << 3;
bf[j++] = (op->byte_count >> 29) & 0xffffffff; bf[j++] = lower_32_bits(bits);
bf[j++] = upper_32_bits(bits);
} }
writesl(ss->base + SS_RXFIFO, bf, j); writesl(ss->base + SS_RXFIFO, bf, j);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment