Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp830553pxb; Tue, 3 Nov 2020 13:47:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJzWMVG+fXhDxI8kD918RpghYmjM021P0fJaMhU6ZG+7o7pkZQZZMjToQVkcsYoTTO5snDa0 X-Received: by 2002:a17:906:60c4:: with SMTP id f4mr3743430ejk.336.1604440042045; Tue, 03 Nov 2020 13:47:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604440042; cv=none; d=google.com; s=arc-20160816; b=MWQdITS/U542pTk7g4t4Lo0BqlPIpkR7jmUPRdTjywhQNmGJrpOmL48RADAZpelZt1 uo84knuq3KeJzq7tXplgZIyp/a+e5Vy55u2nlyHQW+oiDgXGyN4OZ6HIARCa5QFvUQH2 +oHRtNqNRgjvRhdu9UirTrXWc9U0WKEU5rexL/0A9tUUALtoNlOlbjk494AAt9UfndBv eNJEdsXFu/zJGDHsqK2+B0ENalDSim7kd8ABzCXM2P//ufN7XtAMrOEPyxd/JFczF+/7 lX+85d7nSnYGzBF/ow/4MQlB4AOmVDGQtAFaseDaToId31GdzLhUGQVVZLeDEFfSd4qq VYhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QDkcHHicvXRveRmBQ+QhZ3He3TXLnl7ZRFW347m8qBs=; b=R1RE6KM5toXxkL7FIGZYGzbG0e1tOEcvpVGpkQ8eC05KfkKvzfrfBs9WgY/H4HN8Ux tusFchSAM/7irNuDejqOjfWZz/oxfpLbbRBf0bWBZQGZfIwNQ4HuiYOKiuxDl9djUcGK CTbT+MTiUDEspDNMXNJ9117AGTV9Ifzs3ILcaVtDPs2wyOnaDXcc6YItkmOncXO7Gwq/ WzakVXNNg44nLubSoXnoW9kFY73VEsw260TS04CJiZ5aAZ0sFpj3AmDu89+Q7MwEf85m bholD/NIXctAdN1QqsGlxVZ7mJZbeIQMjnIezeJekaHkNRODF7jjb8CIjatAvJdDKkjc vAfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nLUJheRK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l14si12237715edq.543.2020.11.03.13.46.59; Tue, 03 Nov 2020 13:47:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nLUJheRK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733005AbgKCVm6 (ORCPT + 99 others); Tue, 3 Nov 2020 16:42:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:55318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732227AbgKCUzL (ORCPT ); Tue, 3 Nov 2020 15:55:11 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3CE9C223BD; Tue, 3 Nov 2020 20:55:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436910; bh=Yccps9gYgPKpigz26JRSlXIy0z/IxumpcoIbGKZUwcg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nLUJheRKFwMW6kv/OA4LdG9oEV3C0vpPSiR6FlqppYIjynfJDodYg5Dzltex8SD2Q 71Aaeufh+SpZEtTMN4SqEDp4iYqH16/oVwdnFMrOlCXioZ0i9+a5XpOOFEfiTLfn10 d5DsSZyz0fmfl62+zY14dx+8AcwOGYQRHojwuRso= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joakim Zhang , Sean Nyekjaer , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.4 063/214] can: flexcan: disable clocks during stop mode Date: Tue, 3 Nov 2020 21:35:11 +0100 Message-Id: <20201103203256.273290458@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joakim Zhang [ Upstream commit 02f71c6605e1f8259c07f16178330db766189a74 ] Disable clocks while CAN core is in stop mode. Signed-off-by: Joakim Zhang Tested-by: Sean Nyekjaer Link: https://lore.kernel.org/r/20191210085721.9853-2-qiangqing.zhang@nxp.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/flexcan.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index aaa7ed1dc97ee..d59c6c87164f4 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -1703,8 +1703,6 @@ static int __maybe_unused flexcan_suspend(struct device *device) err = flexcan_chip_disable(priv); if (err) return err; - - err = pm_runtime_force_suspend(device); } netif_stop_queue(dev); netif_device_detach(dev); @@ -1730,10 +1728,6 @@ static int __maybe_unused flexcan_resume(struct device *device) if (err) return err; } else { - err = pm_runtime_force_resume(device); - if (err) - return err; - err = flexcan_chip_enable(priv); } } @@ -1764,8 +1758,16 @@ static int __maybe_unused flexcan_noirq_suspend(struct device *device) struct net_device *dev = dev_get_drvdata(device); struct flexcan_priv *priv = netdev_priv(dev); - if (netif_running(dev) && device_may_wakeup(device)) - flexcan_enable_wakeup_irq(priv, true); + if (netif_running(dev)) { + int err; + + if (device_may_wakeup(device)) + flexcan_enable_wakeup_irq(priv, true); + + err = pm_runtime_force_suspend(device); + if (err) + return err; + } return 0; } @@ -1775,8 +1777,16 @@ static int __maybe_unused flexcan_noirq_resume(struct device *device) struct net_device *dev = dev_get_drvdata(device); struct flexcan_priv *priv = netdev_priv(dev); - if (netif_running(dev) && device_may_wakeup(device)) - flexcan_enable_wakeup_irq(priv, false); + if (netif_running(dev)) { + int err; + + err = pm_runtime_force_resume(device); + if (err) + return err; + + if (device_may_wakeup(device)) + flexcan_enable_wakeup_irq(priv, false); + } return 0; } -- 2.27.0