summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2019-11-14 09:52:21 +0100
committerMax Krummenacher <max.krummenacher@toradex.com>2019-12-02 14:22:42 +0100
commit545640fd4f033db8ddf50add8ad0d8f8730fa6f7 (patch)
treee1e70b78e445cdcd99e60584df8c434e457d8a7d
parent40bc7dcd5ef4398a280a6bc8b510ed9802c90fe7 (diff)
can: mcp25xxfd: backport missing helper functions
Backport helper functions not available from the 4.14 kernel from 5.3. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
-rw-r--r--drivers/net/can/spi/mcp25xxfd/mcp25xxfd_cmd.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd_cmd.h b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd_cmd.h
index a60a14c4f3b7..01246a6b5a63 100644
--- a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd_cmd.h
+++ b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd_cmd.h
@@ -23,6 +23,22 @@
/* a bit to use CRC commands if possible */
#define MCP25XXFD_ADDRESS_WITH_CRC BIT(31)
+static inline void cpu_to_le32_array(u32 *buf, unsigned int words)
+{
+ while (words--) {
+ __cpu_to_le32s(buf);
+ buf++;
+ }
+}
+
+static inline void le32_to_cpu_array(u32 *buf, unsigned int words)
+{
+ while (words--) {
+ __le32_to_cpus(buf);
+ buf++;
+ }
+}
+
static inline void mcp25xxfd_cmd_convert_to_cpu(u32 *data, int n)
{
le32_to_cpu_array(data, n);