diff mbox series

[stable-kernel-only,5.15.y,5.10.y] serial: sc16is7xx: the reg needs to shift in regmap_noinc

Message ID 20241207001225.203262-1-hui.wang@canonical.com
State New
Headers show
Series [stable-kernel-only,5.15.y,5.10.y] serial: sc16is7xx: the reg needs to shift in regmap_noinc | expand

Commit Message

Hui Wang Dec. 7, 2024, 12:12 a.m. UTC
Recently we found the fifo_read() and fifo_write() are broken in our
5.15 and 5.4 kernels after cherry-pick the commit e635f652696e
("serial: sc16is7xx: convert from _raw_ to _noinc_ regmap functions
for FIFO"), that is because the reg needs to shift if we don't
cherry-pick a prerequiste commit 3837a0379533 ("serial: sc16is7xx:
improve regmap debugfs by using one regmap per port").

Here fix it by shifting the reg as regmap_volatile() does.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
 drivers/tty/serial/sc16is7xx.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Greg KH Dec. 7, 2024, 6:31 a.m. UTC | #1
On Sat, Dec 07, 2024 at 08:12:25AM +0800, Hui Wang wrote:
> Recently we found the fifo_read() and fifo_write() are broken in our
> 5.15 and 5.4 kernels after cherry-pick the commit e635f652696e
> ("serial: sc16is7xx: convert from _raw_ to _noinc_ regmap functions
> for FIFO"), that is because the reg needs to shift if we don't
> cherry-pick a prerequiste commit 3837a0379533 ("serial: sc16is7xx:
> improve regmap debugfs by using one regmap per port").
> 
> Here fix it by shifting the reg as regmap_volatile() does.
> 
> Signed-off-by: Hui Wang <hui.wang@canonical.com>
> ---
>  drivers/tty/serial/sc16is7xx.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)

Why not take the proper upstream commit instead?
Hui Wang Dec. 7, 2024, 1:47 p.m. UTC | #2
On 12/7/24 14:31, Greg KH wrote:
> On Sat, Dec 07, 2024 at 08:12:25AM +0800, Hui Wang wrote:
>> Recently we found the fifo_read() and fifo_write() are broken in our
>> 5.15 and 5.4 kernels after cherry-pick the commit e635f652696e
>> ("serial: sc16is7xx: convert from _raw_ to _noinc_ regmap functions
>> for FIFO"), that is because the reg needs to shift if we don't
>> cherry-pick a prerequiste commit 3837a0379533 ("serial: sc16is7xx:
>> improve regmap debugfs by using one regmap per port").
>>
>> Here fix it by shifting the reg as regmap_volatile() does.
>>
>> Signed-off-by: Hui Wang <hui.wang@canonical.com>
>> ---
>>   drivers/tty/serial/sc16is7xx.c | 9 ++++++++-
>>   1 file changed, 8 insertions(+), 1 deletion(-)
> Why not take the proper upstream commit instead?

The prerequisite commit 3837a0379533 will introduce significant change 
and significant conflict if backport it to 5.15.y/5.10.y, It is more 
likely to bring new regression.


>
diff mbox series

Patch

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index d274a847c6ab..87e34099f369 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -487,7 +487,14 @@  static bool sc16is7xx_regmap_precious(struct device *dev, unsigned int reg)
 
 static bool sc16is7xx_regmap_noinc(struct device *dev, unsigned int reg)
 {
-	return reg == SC16IS7XX_RHR_REG;
+	switch (reg >> SC16IS7XX_REG_SHIFT) {
+	case SC16IS7XX_RHR_REG:
+		return true;
+	default:
+		break;
+	}
+
+	return false;
 }
 
 /*