From: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
To: haibo.chen@nxp.com, mkl@pengutronix.de
Cc: ciprianmarian.costea@oss.nxp.com, u.kleine-koenig@baylibre.com,
linux-can@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev
Subject: Re: [PATCH] can: flexcan: disable transceiver during system PM
Date: Tue, 4 Mar 2025 13:06:10 +0900 [thread overview]
Message-ID: <01b6fbe7-6e49-4ac2-af2f-a512ae865eae@wanadoo.fr> (raw)
In-Reply-To: <20250304033731.1762899-1-haibo.chen@nxp.com>
On 04/03/2025 at 12:37, haibo.chen@nxp.com wrote:
> From: Haibo Chen <haibo.chen@nxp.com>
>
> During system PM, if no wakeup requirement, disable transceiver to
> save power.
>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>> ---
> drivers/net/can/flexcan/flexcan-core.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
> index b347a1c93536..74f3137295fb 100644
> --- a/drivers/net/can/flexcan/flexcan-core.c
> +++ b/drivers/net/can/flexcan/flexcan-core.c
> @@ -2292,6 +2292,7 @@ static int __maybe_unused flexcan_suspend(struct device *device)
> return err;
>
> flexcan_chip_interrupts_disable(dev);
> + flexcan_transceiver_disable(priv);
flexcan_transceiver_disable() may return an error. Can you check its
return value?
> err = pinctrl_pm_select_sleep_state(device);
> if (err)
> @@ -2325,6 +2326,10 @@ static int __maybe_unused flexcan_resume(struct device *device)
> if (err)
> return err;
>
> + err = flexcan_transceiver_enable(priv);
> + if (err)
> + return err;
> +
> err = flexcan_chip_start(dev);
> if (err)
> return err;
If flexcan_chip_start() fails, shouldn't you have a clean-up branch that
will flexcan_transceiver_disable()? Or do you consider that it is
acceptable to keep the transceiver enabled if an error occurs?
Speaking of which, if flexcan_resume() fails, priv->can.state would
still be set to CAN_STATE_ERROR_ACTIVE.
Yours sincerely,
Vincent Mailhol
next prev parent reply other threads:[~2025-03-04 4:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-04 3:37 haibo.chen
2025-03-04 4:06 ` Vincent Mailhol [this message]
2025-03-04 4:24 ` Bough Chen
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=01b6fbe7-6e49-4ac2-af2f-a512ae865eae@wanadoo.fr \
--to=mailhol.vincent@wanadoo.fr \
--cc=ciprianmarian.costea@oss.nxp.com \
--cc=haibo.chen@nxp.com \
--cc=imx@lists.linux.dev \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=u.kleine-koenig@baylibre.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®