In order to optimize FIFO access, especially on m_can cores attached
to slow busses like SPI, in patch
| e39381770ec9 ("can: m_can: Disable IRQs on FIFO bus errors")
bulk read/write support has been added to the m_can_fifo_{read,write}
functions.
That change leads to the tcan driver to call
regmap_bulk_{read,write}() with a length of 0 (for CAN frames with 0
data length). regmap treats this as an error:
| tcan4x5x spi1.0 tcan4x5x0: FIFO write returned -22
This patch fixes the problem by not calling the
cdev->ops->{read,write)_fifo() in case of a 0 length read/write.
Fixes: e39381770ec9 ("can: m_can: Disable IRQs on FIFO bus errors")
Link: https://lore.kernel.org/all/20220114153130.2647738-1-mkl@pengutronix.de
Cc: stable(a)vger.kernel.org
Cc: Matt Kline <matt(a)bitbashing.io>
Cc: Chandrasekar Ramakrishnan <rcsekar(a)samsung.com>
Reported-by: Michael Anochin <anochin(a)photo-meter.com>
Signed-off-by: Marc Kleine-Budde <mkl(a)pengutronix.de>
---
drivers/net/can/m_can/m_can.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 5b47cd867783..1a4b56f6fa8c 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -336,6 +336,9 @@ m_can_fifo_read(struct m_can_classdev *cdev,
u32 addr_offset = cdev->mcfg[MRAM_RXF0].off + fgi * RXF0_ELEMENT_SIZE +
offset;
+ if (val_count == 0)
+ return 0;
+
return cdev->ops->read_fifo(cdev, addr_offset, val, val_count);
}
@@ -346,6 +349,9 @@ m_can_fifo_write(struct m_can_classdev *cdev,
u32 addr_offset = cdev->mcfg[MRAM_TXB].off + fpi * TXB_ELEMENT_SIZE +
offset;
+ if (val_count == 0)
+ return 0;
+
return cdev->ops->write_fifo(cdev, addr_offset, val, val_count);
}
--
2.34.1
In order to optimize FIFO access, especially on m_can cores attached
to slow busses like SPI, in patch
| e39381770ec9 ("can: m_can: Disable IRQs on FIFO bus errors")
bulk read/write support has been added to the m_can_fifo_{read,write}
functions.
That change leads to the tcan driver to call
regmap_bulk_{read,write}() with a length of 0 (for CAN frames with 0
data length). regmap treats this as an error:
| tcan4x5x spi1.0 tcan4x5x0: FIFO write returned -22
This patch fixes the problem by not calling the
cdev->ops->{read,write)_fifo() in case of a 0 length read/write.
Fixes: e39381770ec9 ("can: m_can: Disable IRQs on FIFO bus errors")
Cc: stable(a)vger.kernel.org
Cc: Matt Kline <matt(a)bitbashing.io>
Cc: Chandrasekar Ramakrishnan <rcsekar(a)samsung.com>
Reported-by: Michael Anochin <anochin(a)photo-meter.com>
Signed-off-by: Marc Kleine-Budde <mkl(a)pengutronix.de>
---
drivers/net/can/m_can/m_can.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 5b47cd867783..1a4b56f6fa8c 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -336,6 +336,9 @@ m_can_fifo_read(struct m_can_classdev *cdev,
u32 addr_offset = cdev->mcfg[MRAM_RXF0].off + fgi * RXF0_ELEMENT_SIZE +
offset;
+ if (val_count == 0)
+ return 0;
+
return cdev->ops->read_fifo(cdev, addr_offset, val, val_count);
}
@@ -346,6 +349,9 @@ m_can_fifo_write(struct m_can_classdev *cdev,
u32 addr_offset = cdev->mcfg[MRAM_TXB].off + fpi * TXB_ELEMENT_SIZE +
offset;
+ if (val_count == 0)
+ return 0;
+
return cdev->ops->write_fifo(cdev, addr_offset, val, val_count);
}
--
2.34.1
Hi folks,
Please backport commit f634ca650f72 "kbuild: Add $(KBUILD_HOSTLDFLAGS)
to 'has_libelf' test" to stable series 5.10.y, 5.4.y & 4.19.y.
This backport is needed to fix builds with CONFIG_UNWINDER_ORC=y where
HOSTLDFLAGS is given on the make command line containing library paths
needed to link against libelf. The issue was found when trying to build
stable kernel branches for x86-64 using Yocto Project after commit
7fd06a57a1d9 "kernel: Rework kernel make flag to variable mappings" was
added to openembedded-core back in October.
The backport to 5.10.y is trivial. The backports to 5.4.y & 4.19.y need
a minor tweak so I'll send patches for those following this email.
The build failure is also seen in 4.14.y but I can't see a trivial way
to address this as KBUILD_HOSTLDFLAGS does not exist in 4.14.y and
backporting the commit which introduces KBUILD_HOSTLDFLAGS would change
several other kbuild areas. I'm happy to workaround this locally by
disabling CONFIG_UNWINDER_ORC for 4.14.y builds but it may be worth
considering alternative fixes for this branch.
Let me know if there are any questions.
--
Paul Barker
Principal Software Engineer
SanCloud Ltd
e: paul.barker(a)sancloud.com
w: https://sancloud.co.uk/