Re: [PATCH] memory: renesas-rpc-if: Avoid unaligned bus access for HyperFlash
From: Wolfram Sang
Date: Sat Sep 25 2021 - 05:55:10 EST
thanks for this patch!
> + const int maxw = (IS_ENABLED(CONFIG_64BIT)) ? 8 : 4;
> + u8 buf;
I could imagine the code becomes more readable if we make use of
unsigned long from_ul = from;
and then use it throughout the function?
> +#ifdef CONFIG_64BIT
> + *(u64 *)to = __raw_readq(from);
> + *(u32 *)to = __raw_readl(from);
To keep the ifdeffery minimal:
if (maxw == 8)
*(u64 *)to = __raw_readq(from);
*(u32 *)to = __raw_readl(from);
and let the compiler do its job.
I wondered if this could be a helper function somewhere instead of open
coded in this driver. However, I did not find any similar code in the
kernel yet, so it might be too early to make this a helper. Have you
looked for similar code? I might have just missed it.
Description: PGP signature