summaryrefslogtreecommitdiff
path: root/drivers
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-12 11:06:10 +0100
commit7e70e3cd082c7b876c8d50f9ac56f28f44bcfced (patch)
tree165affef998fdd44de9375cadbcc4113f659353b /drivers
parent0ecab00b0e4c1ceb266799749860b034c21c63f9 (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>
Diffstat (limited to 'drivers')
-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);