All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: linux-can@vger.kernel.org
Cc: kernel@pengutronix.de, Dan Murphy <dmurphy@ti.com>,
	Sean Nyekjaer <sean@geanix.com>,
	Sriram Dash <sriram.dash@samsung.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [can-next-rfc 5/7] can: m_can: m_can_clk_start(): make use of pm_runtime_resume_and_get()
Date: Sat, 12 Dec 2020 18:55:16 +0100	[thread overview]
Message-ID: <20201212175518.139651-6-mkl@pengutronix.de> (raw)
In-Reply-To: <20201212175518.139651-1-mkl@pengutronix.de>

With patch

| dd8088d5a896 PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter

the usual pm_runtime_get_sync() and pm_runtime_put_noidle() in-case-of-error
dance is no longer needed. Convert the m_can driver to use this function.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/m_can/m_can.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index b1ed925ead63..d556cd95bd8e 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -612,18 +612,10 @@ static int __m_can_get_berr_counter(const struct net_device *dev,
 
 static int m_can_clk_start(struct m_can_classdev *cdev)
 {
-	int err;
-
 	if (cdev->pm_clock_support == 0)
 		return 0;
 
-	err = pm_runtime_get_sync(cdev->dev);
-	if (err < 0) {
-		pm_runtime_put_noidle(cdev->dev);
-		return err;
-	}
-
-	return 0;
+	return pm_runtime_resume_and_get(cdev->dev);
 }
 
 static void m_can_clk_stop(struct m_can_classdev *cdev)
-- 
2.29.2



  parent reply	other threads:[~2020-12-12 17:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-12 17:55 [RFC] m_can: cleanups Marc Kleine-Budde
2020-12-12 17:55 ` [can-next-rfc 1/7] can: m_can: update link to M_CAN user manual Marc Kleine-Budde
2020-12-14  8:11   ` Sean Nyekjaer
2020-12-14  8:25     ` Marc Kleine-Budde
2020-12-14  9:31   ` Oliver Hartkopp
2020-12-14  9:37     ` Marc Kleine-Budde
2020-12-14  9:55       ` Oliver Hartkopp
2020-12-14 10:10         ` Marc Kleine-Budde
2020-12-14 13:11           ` Oliver Hartkopp
2020-12-14 13:19             ` Marc Kleine-Budde
2020-12-14 13:20               ` Oliver Hartkopp
2020-12-12 17:55 ` [can-next-rfc 2/7] can: m_can: convert indention to kernel coding style Marc Kleine-Budde
2020-12-14  8:12   ` Sean Nyekjaer
2020-12-12 17:55 ` [can-next-rfc 3/7] can: m_can: use cdev as name for struct m_can_classdev uniformly Marc Kleine-Budde
2020-12-14  8:12   ` Sean Nyekjaer
2020-12-12 17:55 ` [can-next-rfc 4/7] can: m_can: m_can_config_endisable(): mark as static Marc Kleine-Budde
2020-12-14  8:12   ` Sean Nyekjaer
2020-12-12 17:55 ` Marc Kleine-Budde [this message]
2020-12-14  8:12   ` [can-next-rfc 5/7] can: m_can: m_can_clk_start(): make use of pm_runtime_resume_and_get() Sean Nyekjaer
2020-12-12 17:55 ` [can-next-rfc 6/7] can: m_can: let m_can_class_allocate_dev() allocate driver specific private data Marc Kleine-Budde
2020-12-14  8:13   ` Sean Nyekjaer
2020-12-12 17:55 ` [can-next-rfc 7/7] can: m_can: use struct m_can_classdev as drvdata Marc Kleine-Budde
2020-12-14  8:13   ` Sean Nyekjaer
2020-12-14 13:22 ` [RFC] m_can: cleanups Dan Murphy

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=20201212175518.139651-6-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=dmurphy@ti.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=sean@geanix.com \
    --cc=sriram.dash@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.