Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp916358pxx; Tue, 27 Oct 2020 03:56:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzC5suSTUpuRCdj4SiV5FJJ7SGkGToRy6oxljB4WpgHvsdODsIEmJLf7KEmTwvQN7/p4fD/ X-Received: by 2002:a17:906:3e48:: with SMTP id t8mr1765699eji.104.1603796185939; Tue, 27 Oct 2020 03:56:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603796185; cv=none; d=google.com; s=arc-20160816; b=XkPumdUOE1Df63DbRGBTYsr4bhrPoIia7HrQp9iw8IQGAwvilNIixDN4+fONuHJj6v 0vAPFl+kNeri7Bz1mZVLPZbE2+gIANp16WZHdyV2qMiIKsUR9KZ6WGlNvmTXEBpOU9dO GVEF0a8+nB0HDlRT/QmTEmZBYaOe4ZiT7UYsrlMHL3zQMgpijDnuX57BduZx+gVltQwx NBR1TiEN0IC1A8iVGAqQJT50ePSgg+3RkKho0Q7sfdTkM5sN/IEg2zaIQeGE/tqqj7wJ mqiKTHQhFAVHBY9pgKrwk6FI/DsEqN829+Eo8VsDIXrUMb46DiFthhhIQirVppZhvZ8U DUvg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GLZhWOj6RpN0vvQ7MLlHOPYkG+eczxL8e6UcqF0DM14=; b=ztSk78e4q7e+cNP8UJHVB4sJZTYkyT4JAeSLXABQl1L6PIKfeXDN171hfn87Nd8E57 Nj85TGr80wTg8leiYTA+7CQoopgVJLbXuS/2fUqYZQY0s+QECFBP+8lxtnbw3FlWGlI8 zr0a7VhgWxPCr4P0ndzIP21yfJyEQiTrsOb76UdW4r2ijI10uEZwoI0P/tka0xuhkvUG JT5uimdmHebs3QKi6IrTqyRo3NP4Bzj/LpYUlI+YOHyFOMZxNk8Uj/1rYuZvrcj7A5fp rEoE0JECjo81JS3MKzXtbxyt6iKnhF4eDH7GSOD9SrCfKFqtEYLGfetJhwyXp1Ou7v0M VJFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SCkrmFkP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j15si661029ejy.366.2020.10.27.03.56.03; Tue, 27 Oct 2020 03:56:25 -0700 (PDT) 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=SCkrmFkP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437484AbgJ0AC4 (ORCPT + 99 others); Mon, 26 Oct 2020 20:02:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:34788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2411048AbgJZX4N (ORCPT ); Mon, 26 Oct 2020 19:56:13 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6440F20B1F; Mon, 26 Oct 2020 23:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756570; bh=OpIFis7+wh8rI++WHbem2rOCrI9SOsDtNkCi7Absdqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SCkrmFkPsF2NCc3x/uzv2DwMzauekmMdYf68eDNjsnn3ywAwDyqx53vDGhuKgBcE7 +VLD5/OTt6Eh/tW5wchFImIW4xq2c9RZBGeYMqJkOaSSw6/A5HbDHJ1WWFDQn5IsFq 7adLsMBDwUlX1ArtgyGgS8zuLARcdSJFzfGsq/Ck= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Joakim Zhang , Sean Nyekjaer , Marc Kleine-Budde , Sasha Levin , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 44/80] can: flexcan: disable clocks during stop mode Date: Mon, 26 Oct 2020 19:54:40 -0400 Message-Id: <20201026235516.1025100-44-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026235516.1025100-1-sashal@kernel.org> References: <20201026235516.1025100-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 e5c207ad3c77d..ae05ed57211df 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -1681,8 +1681,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); @@ -1708,10 +1706,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); } } @@ -1742,8 +1736,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; } @@ -1753,8 +1755,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.25.1