Re: [PATCH 3/3] net: dsa: mt7530: add GPIOLIB dependency

From: Arnd Bergmann
Date: Thu Feb 25 2021 - 11:18:06 EST


On Thu, Feb 25, 2021 at 4:52 PM DENG Qingfang <dqfext@xxxxxxxxx> wrote:
>
> Hi Arnd,
>
> On Thu, Feb 25, 2021 at 10:40 PM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
> >
> > From: Arnd Bergmann <arnd@xxxxxxxx>
> >
> > The new gpio support may be optional at runtime, but it requires
> > building against gpiolib:
> >
> > ERROR: modpost: "gpiochip_get_data" [drivers/net/dsa/mt7530.ko] undefined!
> > ERROR: modpost: "devm_gpiochip_add_data_with_key" [drivers/net/dsa/mt7530.ko] undefined!
> >
> > Add a Kconfig dependency to enforce this.
>
> I think wrapping the GPIO code block with #ifdef CONFIG_GPIOLIB ...
> #endif may be a better idea.

In practice there is little difference, as most configurations have GPIOLIB
enabled anyway, in particular every configuration in which this driver is
used.

If you want to send an alternative patch to add the #ifdef, please include

Reported-by: Arnd Bergmann <arnd@xxxxxxxx>

Arnd