Re: [PATCH v2 13/14] regulator: add pm8008 pmic regulator driver

From: Johan Hovold
Date: Thu May 30 2024 - 04:56:38 EST


On Thu, May 30, 2024 at 11:46:12AM +0300, Andy Shevchenko wrote:
> On Thu, May 30, 2024 at 11:14 AM Johan Hovold <johan@xxxxxxxxxx> wrote:
> > On Wed, May 29, 2024 at 11:02:57PM +0300, Andy Shevchenko wrote:
> > > On Wed, May 29, 2024 at 7:30 PM Johan Hovold <johan+linaro@xxxxxxxxxx> wrote:
>
> ...
>
> > > > +#include <linux/array_size.h>
> > > > +#include <linux/bits.h>
> > > > +#include <linux/device.h>
> > > > +#include <linux/math.h>
> > > > +#include <linux/module.h>
> > >
> > > > +#include <linux/of.h>
> > > > +#include <linux/platform_device.h>
> > > > +#include <linux/regmap.h>
> > > > +#include <linux/regulator/driver.h>
> > >
> > > + types.h
> >
> > This one is already pulled in indirectly and I'm not going to respin for
> > this.
> >
> > > + asm/byteorder.h
> >
> > Already explicitly included in the code you left out.
>
> Is there any guarantee it will be like this? I don't think so. That's
> why there is an IWYU principle to give more flexibility of reshuffling
> the (core) headers. And I believe you know that we have way too far
> dependency hell in the headers in the kernel. Have you seen what Ingo
> tried to do and what the potential achievements are?

The driver is using cpu_to_le16() from asm/byteorder.h so the __le16
type definition will be pulled in.

>
> ...
>
> > > > + rdev = devm_regulator_register(dev, desc, &config);
> > > > + if (IS_ERR(rdev)) {
> > > > + ret = PTR_ERR(rdev);
> > > > + dev_err(dev, "failed to register regulator %s: %d\n",
> > > > + desc->name, ret);
> > > > + return ret;
> > >
> > > It's possible to use
> > >
> > > return dev_err_probe(...);
> > >
> > > even for non-probe functions.
>
> (this should be "non-probe deferred functions")
>
> > This is a probe function(), but as I've told you repeatedly I'm not
> > going to use dev_err_probe() here.
>
> Yeah, I got it, some developers are leaving in the previous decades to
> make code very verbose for no benefit, no problem.

And some developers write unreadable code just to save a few lines of
code. I prefer clarity.

Johan