Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

can: flexcan: fix flexcan driver build for big endian on ARM and little endian on PowerPc

There is no reason to disallow building the driver on big-endian ARM kernels.
Furthermore, the current behavior is actually broken on little-endian PowerPC
as well.

The choice of register accessor functions must purely depend on the CPU
architecture, not which endianess the CPU is running on. Note that we nowadays
allow both big-endian ARM and little-endian PowerPC kernels.

With this patch applied, we will do the right thing in all four combinations.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Lothar Waßmann <LW@KARO-electronics.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

authored by

Arnd Bergmann and committed by
Marc Kleine-Budde
0e4b949e c044dc21

+6 -3
+1 -1
drivers/net/can/Kconfig
··· 104 104 105 105 config CAN_FLEXCAN 106 106 tristate "Support for Freescale FLEXCAN based chips" 107 - depends on (ARM && CPU_LITTLE_ENDIAN) || PPC 107 + depends on ARM || PPC 108 108 ---help--- 109 109 Say Y here if you want to support for Freescale FlexCAN. 110 110
+5 -2
drivers/net/can/flexcan.c
··· 235 235 }; 236 236 237 237 /* 238 - * Abstract off the read/write for arm versus ppc. 238 + * Abstract off the read/write for arm versus ppc. This 239 + * assumes that PPC uses big-endian registers and everything 240 + * else uses little-endian registers, independent of CPU 241 + * endianess. 239 242 */ 240 - #if defined(__BIG_ENDIAN) 243 + #if defined(CONFIG_PPC) 241 244 static inline u32 flexcan_read(void __iomem *addr) 242 245 { 243 246 return in_be32(addr);