summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2019-11-14 09:52:21 +0100
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2020-02-09 22:38:58 +0100
commit75058aafd57b2b084b3c7685c020ef3763b8f1a9 (patch)
tree80437e791914fd2205d79666082e84759fadd7f5
parentf67f726d1b12300d6e0241d923b91d979eb11d20 (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);