[PATCH v2] scsi: arm: Convert acornscsi-io.S to C
Bart Van Assche
bvanassche at acm.org
Thu Oct 22 12:22:02 PDT 2026
On 10/22/26 11:52 AM, Breno Rodrigues Alves wrote:
> + while (length >= 16) {
> + u32 w0 = readl(card + 0), w1 = readl(card + 1);
> + u32 w2 = readl(card + 2), w3 = readl(card + 3);
> + u32 w4 = readl(card + 4), w5 = readl(card + 5);
> + u32 w6 = readl(card + 6), w7 = readl(card + 7);
> +
> + card += 8;
> +
> + ((u32 *)buf)[0] = (w0 & 0xffff) | (w1 << 16);
> + ((u32 *)buf)[1] = (w2 & 0xffff) | (w3 << 16);
> + ((u32 *)buf)[2] = (w4 & 0xffff) | (w5 << 16);
> + ((u32 *)buf)[3] = (w6 & 0xffff) | (w7 << 16);
> +
> + buf += 16;
> + length -= 16;
> + }
Why eight readl() calls instead of a loop? Additionally, please use
put_unaligned_be32() instead of open-coding it. Is the code below
equivalent to the loop above?
while (length >= 16) {
for (int i = 0; i < 4; i++) {
u16 w0 = readl(card + 0);
u32 w1 = readl(card + 1);
put_unaligned_be32(w0 | (w1 << 16), buf);
card += 2;
buf += 4;
}
length -= 16;
}
Thanks,
Bart.
More information about the linux-arm-kernel
mailing list