On 06/25/2014 12:29 PM, David Laight wrote: >> Ok. Or should I create two functions for read and write - one does it in LE way and the other >> in BE way and parse the DT to understand which endianness the module supports. > > An indirect call is likely to be slower than a conditional. > The conditional inside a non-inlined function is likely to get > predicted correctly on any code paths that matter. > Unfortunately using a real function increases register pressure. > > Maybe a compile-time option for BE, LE or both. > So a 'generic' kernel can work, but a SoC specific one will be faster. > Then have the driver load/attach/init fail if it is the wrong endianness. Don't overengineer, CAN is max 1 MiB/s. 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 |