On 06/25/2014 09:00 PM, Marc Kleine-Budde wrote: >> How does this look (a bit messed up, so I am open for comments): > > What about: > > static u32 flexcan_read_le(void __iomem *addr) > { > return ioread32(addr); > } > > static u32 flexcan_read_be(void __iomem *addr) > { > return ioread32be(addr); > } > > flexcan_probe () > { > bool core_is_little = true; > > /* or #ifdef __BIG_ENDIAN ... #endif instead of IS_ENABLED() */ > if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) || > of_property_read_bool(dev->dev.of_node, "big-endian")) > core_is_little = false; if (of_property_read_bool(dev->dev.of_node, "little-endian")) core_is_little = true; > if (core_is_little) > priv->read = flexcan_read_le; > else > priv->read = flexcan_read_be; > > } Marc -- 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 |