[PATCH 13/15] gpio: sodaville: use new generic GPIO chip API
Andy Shevchenko
andriy.shevchenko at intel.com
Tue Sep 9 06:13:04 PDT 2025
On Tue, Sep 09, 2025 at 01:35:04PM +0200, Bartosz Golaszewski wrote:
> On Tue, Sep 9, 2025 at 1:31 PM Andy Shevchenko
> <andriy.shevchenko at intel.com> wrote:
> > On Tue, Sep 09, 2025 at 11:15:40AM +0200, Bartosz Golaszewski wrote:
...
> > > + config = (typeof(config)){
> >
> > This looks unusual. Why can't properly formed compound literal be used as in
> > many other places in the kernel?
>
> It is correct C
If it compiles, it doesn't mean it's correct C, it might be non-standard.
Have you checked with the standard (note, I read that part in the past,
but I may forgot the details, so I don't know the answer to this)?
> and checkpatch doesn't raise any warnings.
checkpatch is far from being useful in the questions like this.
It false positively complains for for_each*() macros all over
the kernel, for example.
> It's the
> same kind of argument as between kmalloc(sizeof(struct foo)) vs
> kmalloc(sizeof(f)).
Maybe, but it introduces a new style while all other cases use the other,
_established_ style. So we have a precedent and the form the code is written
in is against the de facto usage of the compound literals.
> I guess it's personal taste but I like this version better.
In kernel we also try to be consistent. This add inconsistency. Am I wrong?
> > > + .dev = &pdev->dev,
> > > + .sz = 4,
> > > + .dat = sd->gpio_pub_base + GPINR,
> > > + .set = sd->gpio_pub_base + GPOUTR,
> > > + .dirout = sd->gpio_pub_base + GPOER,
> > > + };
--
With Best Regards,
Andy Shevchenko
More information about the linux-riscv
mailing list