Re: [PATCH v2] can: tcan4x5x: put tcan into sleep when removing driver

Marc Kleine-Budde <[email protected]> Mon, 3 Aug 2026 12:59:53 +0200
Newsgroups org.kernel.vger.linux-can,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
--lvdagxrpj53wtz37
Content-Type: text/plain; charset=utf-8; protected-headers=v1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Subject: Re: [PATCH v2] can: tcan4x5x: put tcan into sleep when removing
 driver
MIME-Version: 1.0

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 <[email protected]>

Seems you patch is not complete:

| drivers/net/can/m_can/tcan4x5x-core.c: In function =E2=80=98tcan4x5x_can_=
remove=E2=80=99:
| drivers/net/can/m_can/tcan4x5x-core.c:552:35: error: passing argument 1 o=
f =E2=80=98tcan4x5x_power_enable=E2=80=99 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 =E2=80=98str=
uct tcan4x5x_priv *=E2=80=99 but argument is of type =E2=80=98struct regula=
tor *=E2=80=99
|   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_ca=
n/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_classde=
v *cdev,
>  	return regmap_bulk_write(priv->regmap, TCAN4X5X_MRAM_START + addr_offse=
t, 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 =3D 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

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

--lvdagxrpj53wtz37
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQSl+MghEFFAdY3pYJLMOmT6rpmt0gUCanB0pgAKCRDMOmT6rpmt
0jLeAQC/BESYLGJpBEuo6vbG03HhSo5CsOX+IXs+mC5t1EDbtQD/TbuUv3j6nYlt
YOeVMizxn5rO25KZE3try2HBpv3fMgw=
=cmKb
-----END PGP SIGNATURE-----

--lvdagxrpj53wtz37--