Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d78867a9 authored by Antoine Tenart's avatar Antoine Tenart Committed by Herbert Xu
Browse files

crypto: sun4i-ss - use GENMASK to generate masks



Use the GENMASK helper instead of custom calculations to generate masks,
It also helps the readability.

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 303391d6
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -384,12 +384,15 @@ 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;
		if (nbw) {
			wb = *(u32 *)(op->buf + nwait * 4);
		wb &= (0xFFFFFFFF >> (4 - nbw) * 8);
			wb &= GENMASK((nbw * 8) - 1, 0);

			op->byte_count += nbw;
		}
	}

	/* write the remaining bytes of the nbw buffer */
	wb |= ((1 << 7) << (nbw * 8));