[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210122030214.166334-1-suyanjun218@gmail.com>
Date: Fri, 22 Jan 2021 11:02:14 +0800
From: Su Yanjun <suyanjun218@...il.com>
To: mkl@...gutronix.de, manivannan.sadhasivam@...aro.org,
thomas.kopp@...rochip.com, wg@...ndegger.com, davem@...emloft.net,
kuba@...nel.org, lgirdwood@...il.com, broonie@...nel.org
Cc: linux-can@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Su Yanjun <suyanjun218@...il.com>
Subject: [PATCH v1] can: mcp251xfd: use regmap_bulk_write for compatibility
Recently i use mcp2518fd on 4.x kernel which multiple write is not
backported, regmap_raw_write will cause old kernel crash because the
tx buffer in driver is smaller then 2K. Use regmap_bulk_write instead
for compatibility.
Signed-off-by: Su Yanjun <suyanjun218@...il.com>
---
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
index 3dde52669343..ab8aad0a7594 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
@@ -932,6 +932,7 @@ static int mcp251xfd_chip_ecc_init(struct mcp251xfd_priv *priv)
void *ram;
u32 val = 0;
int err;
+ int val_bytes = regmap_get_val_bytes(priv->map_reg);
ecc->ecc_stat = 0;
@@ -947,8 +948,8 @@ static int mcp251xfd_chip_ecc_init(struct mcp251xfd_priv *priv)
if (!ram)
return -ENOMEM;
- err = regmap_raw_write(priv->map_reg, MCP251XFD_RAM_START, ram,
- MCP251XFD_RAM_SIZE);
+ err = regmap_bulk_write(priv->map_reg, MCP251XFD_RAM_START, ram,
+ MCP251XFD_RAM_SIZE / val_bytes);
kfree(ram);
return err;
--
2.25.1
Powered by blists - more mailing lists