Skip to contentSkip to conversation

net: can: Disable flexcan driver build for big endian CPU on ARM

PATCH Arnd Bergmann 2 participants 2 messages Jan 14, 2014 – Jan 16, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw
Quoted 8 lines · Guenter Roeck
Quoted 7 lines

Building arm:allmodconfig fails with

flexcan.c: In function 'flexcan_read':
flexcan.c:243:2: error: implicit declaration of function 'in_be32' flexcan.c: In function 'flexcan_write':
flexcan.c:248:2: error: implicit declaration of function 'out_be32'

Quoted 6 lines
Quoted 4 lines

in_be32 and out_be32 do not (or no longer) exist for ARM targets. Disable the build for ARM on big endian CPUs.

Applied to can-next.

Sorry, this patch was wrong.

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.

drivers/net/can/flexcan.c +5 -2
index aaed97b..320bef2 100644
@@ -235,9 +235,12 @@ static const struct can_bittiming_const flexcan_bittiming_const = {
 };
 
 /*
- * Abstract off the read/write for arm versus ppc.
+ * Abstract off the read/write for arm versus ppc. This
+ * assumes that PPC uses big-endian registers and everything
+ * else uses little-endian registers, independent of CPU
+ * endianess.
  */
-#if defined(__BIG_ENDIAN)
+#if defined(CONFIG_PPC)
 static inline u32 flexcan_read(void __iomem *addr)
 {
 	return in_be32(addr);
#1 lore raw
Quoted 27 lines · Arnd Bergmann
Quoted 8 lines · Guenter Roeck
Quoted 7 lines

Building arm:allmodconfig fails with

flexcan.c: In function 'flexcan_read':
flexcan.c:243:2: error: implicit declaration of function 'in_be32' flexcan.c: In function 'flexcan_write':
flexcan.c:248:2: error: implicit declaration of function 'out_be32'

Quoted 6 lines
Quoted 4 lines

in_be32 and out_be32 do not (or no longer) exist for ARM targets. Disable the build for ARM on big endian CPUs.

Applied to can-next.

Sorry, this patch was wrong.

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.

Quoted 1 line

Thanks Arnd, I've squashed in the revert of Guenter's patch.

Marc

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |