From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7365267706; Tue, 25 Mar 2025 12:30:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742905813; cv=none; b=rn3pxuKTSoqX0cLoeqWHoYBVYAaQapjNUyLBwk6RARlVPeMu5xKpvdsm1F9/DqzZmB+drB4VY94FqtJ9Jtr5fNKMknAqdCHibKaTwz/eG4oZwhkcE7m/pJqlkpjk2zy8KAhkoFXEB3o0erkYdqKFUyHDKWUg6SSpVlzydwahVtQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742905813; c=relaxed/simple; bh=pVgAqK2lcITxhvecXujQJFhvAjcA7jX95KLkBu1L7GI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PGnKFgiwboasdMkpEuUr66YEmKPHrr4VdYBvdmtOMa0tLKpMbx62ckNZsECO8hdxpjMXVGlhpcHhFhtGz3inKalCkCQcTnymvCNS17nVG7SGd5fp4SZ//unJ1/ISjNVwv6b9n1Tdv2uZ2PdY9Juht5lRBLpHdzpxsY+yw9on4ME= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=H+ZPNqlz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="H+ZPNqlz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15268C4CEE4; Tue, 25 Mar 2025 12:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1742905813; bh=pVgAqK2lcITxhvecXujQJFhvAjcA7jX95KLkBu1L7GI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H+ZPNqlzz18hj5sUuirqQkQWBrgicPlDD42aDSMO6aFjiopcOZy0p3vhp6cMULVb9 eeyzuK3NXcU9qDXP/Gqe27Nb6S23SisWKLOJfaUtxpIdk4yUna5rU4EJYlnSuzIFk/ GRj211t40Aczn0FTMMF2nnyJThKYSkSsAlIJDPLw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Haibo Chen , Marc Kleine-Budde Subject: [PATCH 6.1 170/198] can: flexcan: only change CAN state when link up in system PM Date: Tue, 25 Mar 2025 08:22:12 -0400 Message-ID: <20250325122201.107986275@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250325122156.633329074@linuxfoundation.org> References: <20250325122156.633329074@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Haibo Chen commit fd99d6ed20234b83d65b9c5417794343577cf3e5 upstream. 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: 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: 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 Link: https://patch.msgid.link/20250314110145.899179-1-haibo.chen@nxp.com Reported-by: Marc Kleine-Budde Closes: https://lore.kernel.org/all/20250314-married-polar-elephant-b15594-mkl@pengutronix.de [mkl: add newlines] Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/flexcan/flexcan-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/net/can/flexcan/flexcan-core.c +++ b/drivers/net/can/flexcan/flexcan-core.c @@ -2236,8 +2236,9 @@ static int __maybe_unused flexcan_suspen } netif_stop_queue(dev); netif_device_detach(dev); + + priv->can.state = CAN_STATE_SLEEPING; } - priv->can.state = CAN_STATE_SLEEPING; return 0; } @@ -2248,7 +2249,6 @@ static int __maybe_unused flexcan_resume struct flexcan_priv *priv = netdev_priv(dev); int err; - priv->can.state = CAN_STATE_ERROR_ACTIVE; if (netif_running(dev)) { netif_device_attach(dev); netif_start_queue(dev); @@ -2268,6 +2268,8 @@ static int __maybe_unused flexcan_resume flexcan_chip_interrupts_enable(dev); } + + priv->can.state = CAN_STATE_ERROR_ACTIVE; } return 0;