Linux CAN drivers development
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Sean Nyekjaer <sean@geanix.com>
Cc: Markus Schneider-Pargmann <msp@baylibre.com>,
	 Vincent Mailhol <mailhol@kernel.org>,
	linux-can@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] can: tcan4x5x: put tcan into sleep when removing driver
Date: Mon, 3 Aug 2026 12:59:53 +0200	[thread overview]
Message-ID: <anB0TXS1xEtYAMxn@pengutronix.de> (raw)
In-Reply-To: <20260803101927.17122-1-sean@geanix.com>

[-- Attachment #1: Type: text/plain, Size: 2474 bytes --]

On 03.08.2026 12:19:26, Sean Nyekjaer wrote:
> Put the tcan4x5x transceiver into sleep mode when the driver is
> removed, instead of leaving it in its current operating mode.
> This reduces power consumption(3mA@12V) once the driver is
> no longer bound to the device.
>
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>

Seems you patch is not complete:

| drivers/net/can/m_can/tcan4x5x-core.c: In function ‘tcan4x5x_can_remove’:
| drivers/net/can/m_can/tcan4x5x-core.c:552:35: error: passing argument 1 of ‘tcan4x5x_power_enable’ from incompatible pointer type [-Wincompatible-pointer-types]
|   552 |         tcan4x5x_power_enable(priv->power, 0);
|       |                               ~~~~^~~~~~~
|       |                                   |
|       |                                   struct regulator *
| drivers/net/can/m_can/tcan4x5x-core.c:214:56: note: expected ‘struct tcan4x5x_priv *’ but argument is of type ‘struct regulator *’
|   214 | static int tcan4x5x_power_enable(struct tcan4x5x_priv *priv, int enable)
|       |                                  ~~~~~~~~~~~~~~~~~~~~~~^~~~

> ---
> Changes since v1:
>  - Moved enter sleep mode into tcan4x5x_power_enable()
>
>  drivers/net/can/m_can/tcan4x5x-core.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/tcan4x5x-core.c
> index 31cc9d0abd45..67902b8b0fab 100644
> --- a/drivers/net/can/m_can/tcan4x5x-core.c
> +++ b/drivers/net/can/m_can/tcan4x5x-core.c
> @@ -211,15 +211,21 @@ static int tcan4x5x_write_fifo(struct m_can_classdev *cdev,
>  	return regmap_bulk_write(priv->regmap, TCAN4X5X_MRAM_START + addr_offset, val, val_count);
>  }
>
> -static int tcan4x5x_power_enable(struct regulator *reg, int enable)
> +static int tcan4x5x_power_enable(struct tcan4x5x_priv *priv, int enable)
>  {

If you add:

        struct regulator *reg = priv->power;

the diff should be smaller.

> -	if (IS_ERR_OR_NULL(reg))
> +	if (IS_ERR_OR_NULL(priv->power)) {

Can you please add a comment that the reset GPIO is needed to get the
device out of sleep mode.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  parent reply	other threads:[~2026-08-03 11:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 10:19 [PATCH v2] can: tcan4x5x: put tcan into sleep when removing driver Sean Nyekjaer
2026-08-03 10:33 ` sashiko-bot
2026-08-03 11:00   ` Marc Kleine-Budde
2026-08-03 11:16   ` Sean Nyekjaer
2026-08-03 10:59 ` Marc Kleine-Budde [this message]
2026-08-03 11:32   ` Sean Nyekjaer

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=anB0TXS1xEtYAMxn@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mailhol@kernel.org \
    --cc=msp@baylibre.com \
    --cc=sean@geanix.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