Re: [PATCH v2] can: tcan4x5x: put tcan into sleep when removing driver
Sean Nyekjaer <[email protected]> Mon, 03 Aug 2026 11:32:15 +0000
| Newsgroups | org.kernel.vger.linux-can,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <qeNtat9LVO8NCBxGCR2a4Lr0ugJ5k1TYM5OqX6V2hjWgKVArdIkxm8wX_DaFd_fQZbF3EyZ-Pv5CsRiy3LgrNiBlX0uw-rn9CawvevVQ6_8=@geanix.com> |
On Monday, 3 August 2026 at 13:27, Marc Kleine-Budde <[email protected]> w= rote: > 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]> >=20 > Seems you patch is not complete: >=20 > | drivers/net/can/m_can/tcan4x5x-core.c: In function =E2=80=98tcan4x5x_ca= n_remove=E2=80=99: > | drivers/net/can/m_can/tcan4x5x-core.c:552:35: error: passing argument 1= of =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= =98struct tcan4x5x_priv *=E2=80=99 but argument is of type =E2=80=98struct = regulator *=E2=80=99 > | 214 | static int tcan4x5x_power_enable(struct tcan4x5x_priv *priv, in= t enable) > | | ~~~~~~~~~~~~~~~~~~~~~~^~~~ Yes. >=20 > > --- > > 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_class= dev *cdev, > > =09return regmap_bulk_write(priv->regmap, TCAN4X5X_MRAM_START + addr_o= ffset, val, val_count); > > } > > > > -static int tcan4x5x_power_enable(struct regulator *reg, int enable) > > +static int tcan4x5x_power_enable(struct tcan4x5x_priv *priv, int enabl= e) > > { >=20 > If you add: >=20 > struct regulator *reg =3D priv->power; >=20 > the diff should be smaller. Yes. >=20 > > -=09if (IS_ERR_OR_NULL(reg)) > > +=09if (IS_ERR_OR_NULL(priv->power)) { >=20 > Can you please add a comment that the reset GPIO is needed to get the > device out of sleep mode. Will do! Sorry first day after vacation. /Sean