Re: [PATCH v6 5/6] can: mcp251xfd: add gpio functionality

From: Bartosz Golaszewski
Date: Wed Oct 01 2025 - 10:12:17 EST


On Wed, Oct 1, 2025 at 3:59 PM Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> wrote:
>
> On 01.10.2025 15:52:56, Bartosz Golaszewski wrote:
> > On Wed, Oct 1, 2025 at 11:10 AM Viken Dadhaniya
> > <viken.dadhaniya@xxxxxxxxxxxxxxxx> wrote:
> > > +
> > > + if (!device_property_present(&priv->spi->dev, "gpio-controller"))
> > > + return 0;
> > > +
> >
> > Hi! I didn't notice this before you're returning 0 here, meaning the
> > device will be attached to the driver even though it doesn't do
> > anything. It would make more sense to return -ENODEV.
>
> I consider the GPIO functionality of the mcp251xfd CAN controllers
> optional. So if the DT doesn't contain gpio-controller, continue without
> GPIO functionality.
>

Ah, sorry, I thought this was the driver's probe() callback. It's
actually just a function. This could probably be registered as an
auxiliary device for less build-time dependencies but whatever.
Nevermind my last comment.

Bart