mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Quentin Schulz <quentin.schulz@free-electrons.com>
To: wg@grandegger.com, mkl@pengutronix.de, mario.huettel@gmx.net,
	socketcan@hartkopp.net
Cc: Quentin Schulz <quentin.schulz@free-electrons.com>,
	linux-can@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	alexandre.belloni@free-electrons.com,
	thomas.petazzoni@free-electrons.com
Subject: [PATCH v4 2/4] can: m_can: make m_can_start and m_can_stop symmetric
Date: Fri,  5 May 2017 15:50:31 +0200	[thread overview]
Message-ID: <20170505135033.8349-2-quentin.schulz@free-electrons.com> (raw)
In-Reply-To: <20170505135033.8349-1-quentin.schulz@free-electrons.com>

This moves clocks gating outside of the m_can_stop function as the
m_can_start function does not (and cannot, at least in current
implementation) ungate clocks. This way, both functions can now be used
symmetrically.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
---

added in v4

 drivers/net/can/m_can/m_can.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 5da1bdb202a3..6115dede671e 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -1324,9 +1324,6 @@ static void m_can_stop(struct net_device *dev)
 	/* disable all interrupts */
 	m_can_disable_all_interrupts(priv);
 
-	clk_disable_unprepare(priv->hclk);
-	clk_disable_unprepare(priv->cclk);
-
 	/* set the state as STOPPED */
 	priv->can.state = CAN_STATE_STOPPED;
 }
@@ -1338,6 +1335,8 @@ static int m_can_close(struct net_device *dev)
 	netif_stop_queue(dev);
 	napi_disable(&priv->napi);
 	m_can_stop(dev);
+	clk_disable_unprepare(priv->hclk);
+	clk_disable_unprepare(priv->cclk);
 	free_irq(dev->irq, dev);
 	close_candev(dev);
 	can_led_event(dev, CAN_LED_EVENT_STOP);
-- 
2.11.0

  reply	other threads:[~2017-05-05 13:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-05 13:50 [PATCH v4 1/4] can: m_can: move Message RAM initialization to function Quentin Schulz
2017-05-05 13:50 ` Quentin Schulz [this message]
2017-05-05 13:50 ` [PATCH v4 3/4] can: m_can: factorize clock gating and ungating Quentin Schulz
2017-05-05 13:50 ` [PATCH v4 4/4] can: m_can: add deep Suspend/Resume support Quentin Schulz
2017-05-12  6:37 ` [PATCH v4 1/4] can: m_can: move Message RAM initialization to function Quentin Schulz
2017-05-15 13:50   ` Marc Kleine-Budde
2017-05-16  3:51     ` Oliver Hartkopp
2017-05-16  8:00       ` Alexandre Belloni
2017-05-16 13:16         ` Oliver Hartkopp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170505135033.8349-2-quentin.schulz@free-electrons.com \
    --to=quentin.schulz@free-electrons.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.huettel@gmx.net \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=socketcan@hartkopp.net \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®