All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: linux-can@vger.kernel.org
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	Thomas Kopp <thomas.kopp@microchip.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH 03/15] can: mcp251xfd: mcp251xfd_unregister(): simplify runtime PM handling
Date: Mon,  7 Feb 2022 14:10:35 +0100	[thread overview]
Message-ID: <20220207131047.282110-4-mkl@pengutronix.de> (raw)
In-Reply-To: <20220207131047.282110-1-mkl@pengutronix.de>

The mcp251xfd driver supports runtime PM enabled kernels, but also
works on !CONFIG_PM configurations.

This patch simplifies the runtime PM handling in the
mcp251xfd_unregister(). In the CONFIG_PM case, runtime PM has been
enabled in the mcp251xfd_probe() function, so we can disable it here.
For !CONFIG_PM builds call mcp251xfd_clks_and_vdd_disable() directly.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
index 7e0c4e662381..49ce5ff34903 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
@@ -1768,10 +1768,10 @@ static inline void mcp251xfd_unregister(struct mcp251xfd_priv *priv)
 
 	unregister_candev(ndev);
 
-	pm_runtime_get_sync(ndev->dev.parent);
-	pm_runtime_put_noidle(ndev->dev.parent);
-	mcp251xfd_clks_and_vdd_disable(priv);
-	pm_runtime_disable(ndev->dev.parent);
+	if (pm_runtime_enabled(ndev->dev.parent))
+		pm_runtime_disable(ndev->dev.parent);
+	else
+		mcp251xfd_clks_and_vdd_disable(priv);
 }
 
 static const struct of_device_id mcp251xfd_of_match[] = {
-- 
2.34.1



  parent reply	other threads:[~2022-02-07 13:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07 13:10 [PATCH 00/15] can: mcp251xfd: add PLL support Marc Kleine-Budde
2022-02-07 13:10 ` [PATCH 01/15] can: mcp251xfd: mcp251xfd_reg_invalid(): rename from mcp251xfd_osc_invalid() Marc Kleine-Budde
2022-02-07 13:10 ` [PATCH 02/15] can: mcp251xfd: mcp251xfd_regmap_crc_read(): ignore CRC error only if solely OSC register is read Marc Kleine-Budde
2022-02-07 13:10 ` Marc Kleine-Budde [this message]
2022-02-07 13:10 ` [PATCH 04/15] can: mcp251xfd: mcp251xfd_chip_sleep(): introduce function to bring chip into sleep mode Marc Kleine-Budde
2022-02-07 13:10 ` [PATCH 05/15] can: mcp251xfd: mcp251xfd_chip_stop(): convert to a void function Marc Kleine-Budde
2022-02-07 13:10 ` [PATCH 06/15] can: mcp251xfd: mcp251xfd_chip_wait_for_osc_ready(): factor out into separate function Marc Kleine-Budde
2022-02-07 13:10 ` [PATCH 07/15] can: mcp251xfd: mcp251xfd_chip_wait_for_osc_ready(): improve chip detection and error handling Marc Kleine-Budde
2022-02-07 13:10 ` [PATCH 08/15] can: mcp251xfd: mcp251xfd_chip_wait_for_osc_ready(): prepare for PLL support Marc Kleine-Budde
2022-02-07 13:10 ` [PATCH 09/15] can: mcp251xfd: mcp251xfd_chip_softreset_check(): wait for OSC ready before accessing chip Marc Kleine-Budde
2022-02-07 13:10 ` [PATCH 10/15] can: mcp251xfd: mcp251xfd_chip_timestamp_init(): factor out into separate function Marc Kleine-Budde
2022-02-07 13:10 ` [PATCH 11/15] can: mcp251xfd: mcp251xfd_chip_wake(): renamed from mcp251xfd_chip_clock_enable() Marc Kleine-Budde
2022-02-07 13:10 ` [PATCH 12/15] can: mcp251xfd: __mcp251xfd_chip_set_mode(): prepare for PLL support: improve error handling and diagnostics Marc Kleine-Budde
2022-02-07 13:10 ` [PATCH 13/15] can: mcp251xfd: mcp251xfd_chip_clock_init(): prepare for PLL support, wait for OSC ready Marc Kleine-Budde
2022-02-07 13:10 ` [PATCH 14/15] can: mcp251xfd: mcp251xfd_register(): prepare to activate PLL after softreset Marc Kleine-Budde
2022-02-07 13:10 ` [PATCH 15/15] can: mcp251xfd: add support for internal PLL Marc Kleine-Budde

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=20220207131047.282110-4-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=thomas.kopp@microchip.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.