Re: [PATCH] memory: renesas-rpc-if: Avoid unaligned bus access for HyperFlash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andrew,

thanks for this patch!

> +	const int maxw = (IS_ENABLED(CONFIG_64BIT)) ? 8 : 4;
> +	u8 buf[2];

I could imagine the code becomes more readable if we make use of
something like:

	unsigned long from_ul = from;

and then use it throughout the function?

> +#ifdef CONFIG_64BIT
> +		*(u64 *)to = __raw_readq(from);
> +#else
> +		*(u32 *)to = __raw_readl(from);
> +#endif

To keep the ifdeffery minimal:

	if (maxw == 8)
		*(u64 *)to = __raw_readq(from);
	else
 		*(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.

Happy hacking,

   Wolfram

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux