]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.4
authorSasha Levin <sashal@kernel.org>
Tue, 8 Apr 2025 00:42:41 +0000 (20:42 -0400)
committerSasha Levin <sashal@kernel.org>
Tue, 8 Apr 2025 00:42:41 +0000 (20:42 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.4/can-flexcan-only-change-can-state-when-link-up-in-sy.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/can-flexcan-only-change-can-state-when-link-up-in-sy.patch b/queue-5.4/can-flexcan-only-change-can-state-when-link-up-in-sy.patch
new file mode 100644 (file)
index 0000000..a365d05
--- /dev/null
@@ -0,0 +1,75 @@
+From 56a590c9375c5e4c29e8afacfdc64314c4051614 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 14 Mar 2025 19:01:44 +0800
+Subject: can: flexcan: only change CAN state when link up in system PM
+
+From: Haibo Chen <haibo.chen@nxp.com>
+
+[ Upstream commit fd99d6ed20234b83d65b9c5417794343577cf3e5 ]
+
+After a suspend/resume cycle on a down interface, it will come up as
+ERROR-ACTIVE.
+
+$ ip -details -s -s a s dev flexcan0
+3: flexcan0: <NOARP,ECHO> mtu 16 qdisc pfifo_fast state DOWN group default qlen 10
+    link/can  promiscuity 0 allmulti 0 minmtu 0 maxmtu 0
+    can state STOPPED (berr-counter tx 0 rx 0) restart-ms 1000
+
+$ sudo systemctl suspend
+
+$ ip -details -s -s a s dev flexcan0
+3: flexcan0: <NOARP,ECHO> mtu 16 qdisc pfifo_fast state DOWN group default qlen 10
+    link/can  promiscuity 0 allmulti 0 minmtu 0 maxmtu 0
+    can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 1000
+
+And only set CAN state to CAN_STATE_ERROR_ACTIVE when resume process
+has no issue, otherwise keep in CAN_STATE_SLEEPING as suspend did.
+
+Fixes: 4de349e786a3 ("can: flexcan: fix resume function")
+Cc: stable@vger.kernel.org
+Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
+Link: https://patch.msgid.link/20250314110145.899179-1-haibo.chen@nxp.com
+Reported-by: Marc Kleine-Budde <mkl@pengutronix.de>
+Closes: https://lore.kernel.org/all/20250314-married-polar-elephant-b15594-mkl@pengutronix.de
+[mkl: add newlines]
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/can/flexcan.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
+index 7ec15cb356c01..69b4318b1a77e 100644
+--- a/drivers/net/can/flexcan.c
++++ b/drivers/net/can/flexcan.c
+@@ -1723,8 +1723,9 @@ static int __maybe_unused flexcan_suspend(struct device *device)
+               }
+               netif_stop_queue(dev);
+               netif_device_detach(dev);
++
++              priv->can.state = CAN_STATE_SLEEPING;
+       }
+-      priv->can.state = CAN_STATE_SLEEPING;
+       return err;
+ }
+@@ -1735,7 +1736,6 @@ static int __maybe_unused flexcan_resume(struct device *device)
+       struct flexcan_priv *priv = netdev_priv(dev);
+       int err = 0;
+-      priv->can.state = CAN_STATE_ERROR_ACTIVE;
+       if (netif_running(dev)) {
+               netif_device_attach(dev);
+               netif_start_queue(dev);
+@@ -1747,6 +1747,8 @@ static int __maybe_unused flexcan_resume(struct device *device)
+               } else {
+                       err = flexcan_chip_enable(priv);
+               }
++
++              priv->can.state = CAN_STATE_ERROR_ACTIVE;
+       }
+       return err;
+-- 
+2.39.5
+
index 865109b0243300844d006b385ec4a73aae8dfbaf..d0562aff9dbca459494a63ef199e543026eff87d 100644 (file)
@@ -143,3 +143,4 @@ vsock-avoid-timeout-during-connect-if-the-socket-is-.patch
 ipv6-fix-omitted-netlink-attributes-when-using-rtext.patch
 net-dsa-mv88e6xxx-propperly-shutdown-ppu-re-enable-t.patch
 arcnet-add-null-check-in-com20020pci_probe.patch
+can-flexcan-only-change-can-state-when-link-up-in-sy.patch