Re: [PATCH] pinctrl: pinconf-generic: check error value EOPNOTSUPP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 05, 2024 at 02:13:28AM +0000, Peng Fan wrote:
> > On Thu, Apr 04, 2024 at 01:44:50PM +0200, Linus Walleij wrote:
> > > On Mon, Apr 1, 2024 at 4:02 PM Peng Fan (OSS) <peng.fan@xxxxxxxxxxx>
> > wrote:

...

> > > >                         ret = pin_config_get_for_pin(pctldev, pin, &config);
> > > >                 /* These are legal errors */
> > > > -               if (ret == -EINVAL || ret == -ENOTSUPP)
> > > > +               if (ret == -EINVAL || ret == -ENOTSUPP || ret ==
> > > > + -EOPNOTSUPP)
> > >
> > > TBH it's a bit odd to call an in-kernel API such as
> > > pin_config_get_for_pin() and get -EOPNOTSUPP back. But it's not like I care
> > a lot, so patch applied.
> > 
> > Hmm... I would like actually to get this being consistent. The documentation
> > explicitly says that in-kernel APIs uses Linux error code and not POSIX one.
> 
> Would you please share me the documentation?

Sure.
https://elixir.bootlin.com/linux/latest/source/include/linux/pinctrl/pinconf.h#L24
https://elixir.bootlin.com/linux/latest/source/drivers/gpio/gpiolib.c#L2825
https://elixir.bootlin.com/linux/latest/source/drivers/gpio/gpiolib.c#L2845

I admit that this is not the best documented, feel free to produce a proper
documentation.

> > This check opens a Pandora box.
> > 
> > FWIW, it just like dozen or so drivers that needs to be fixed, I prefer to have
> > them being moved to ENOTSUPP, rather this patch.
> 
> I see many patches convert to use EOPNOTSUPP by checking git log.

How is that related? You mean for GPIO/pin control drivers?

> And checkpatch.pl reports warning for using ENOTSUPP.

checkpatch has false-positives, this is just one of them.

> BTW: is there any issue if using EOPNOTSUPP here?

Yes. we don't want to be inconsistent. Using both in one subsystem is asking
for troubles. If you want EOPNOTSUPP, please convert *all* users and drop
ENOTSUPP completely (series out of ~100+ patches I believe :-), which probably
will be not welcome).

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux