From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Keguang Zhang <keguang.zhang@gmail.com>,
Alban Bedel <albeu@free.fr>, Doug Berger <opendmb@gmail.com>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Samuel Holland <samuel.holland@sifive.com>,
Yixun Lan <dlan@gentoo.org>, Andy Shevchenko <andy@kernel.org>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mips@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH 13/15] gpio: sodaville: use new generic GPIO chip API
Date: Tue, 9 Sep 2025 16:56:12 +0300 [thread overview]
Message-ID: <aMAx_EwwBteiI9K6@smile.fi.intel.com> (raw)
In-Reply-To: <aMAv3STeZUdSQ14p@smile.fi.intel.com>
On Tue, Sep 09, 2025 at 04:47:09PM +0300, Andy Shevchenko wrote:
> On Tue, Sep 09, 2025 at 04:45:31PM +0300, Andy Shevchenko wrote:
> > On Tue, Sep 09, 2025 at 08:24:23AM -0500, Bartosz Golaszewski wrote:
> > > On Tue, 9 Sep 2025 15:13:04 +0200, Andy Shevchenko
> > > <andriy.shevchenko@intel.com> said:
> > > > 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@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)?
> > >
> > > It's a GNU extension alright
> >
> > clang, I suppose, also okay with this?
> >
> > > but it's supported in the kernel as it evaluates
> > > to a simple cast.
> >
> > There is no cast. And that's make a big difference to what the code tries to do.
> >
> > > >> 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.
> > >
> > > It may not be *very* common but it's hardly new style:
> >
> > I think your statement is incorrect see below why.
> >
> > > $ git grep -P "\(typeof\(.*\)\) ?\{" | wc
> > > 108 529 7315
> >
> > Not correct. The correct output will be closer to
> >
> > $ git grep -l -P "\(typeof\(.*\)\) ?\{" | wc -l
> > 15
> >
> > And if you looked at the output carefully, you see the bug in the RE you used.
> >
> > So, even closer will be this one:
> >
> > $ git grep -l -P "=[[:space:]]+\(typeof\(.*\)\) ?\{" | wc -l
> > 7
> >
> > 2 out of which are related to libeth, effectively makes this 6.
And for of fullness the picture:
$ git grep -l -P "=[[:space:]]+\(struct [^[:space:]]*\) ?\{" | wc -l
501
So, it's 1:100 ratio.
> TBH, I think those 6 all made the same mistake, i.e. thinking of the compound
> literal as a cast. Which is not!
>
> > No, this is completely non-standard and unusual thing in the kernel.
> >
> > > >> 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
next prev parent reply other threads:[~2025-09-09 17:20 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-09 9:15 [PATCH 00/15] gpio: replace legacy bgpio_init() with its modernized alternative - part 4 Bartosz Golaszewski
2025-09-09 9:15 ` [PATCH 01/15] gpio: loongson1: allow building the module with COMPILE_TEST enabled Bartosz Golaszewski
2025-09-09 9:15 ` [PATCH 02/15] gpio: loongson1: use new generic GPIO chip API Bartosz Golaszewski
2025-09-09 9:15 ` [PATCH 03/15] gpio: hlwd: " Bartosz Golaszewski
2025-09-09 9:15 ` [PATCH 04/15] gpio: ath79: " Bartosz Golaszewski
2025-09-09 9:15 ` [PATCH 05/15] gpio: ath79: use the generic GPIO chip lock for IRQ handling Bartosz Golaszewski
2025-09-09 9:15 ` [PATCH 06/15] gpio: xgene-sb: use generic GPIO chip register read and write APIs Bartosz Golaszewski
2025-09-09 9:15 ` [PATCH 07/15] gpio: brcmstb: use new generic GPIO chip API Bartosz Golaszewski
2025-09-09 9:15 ` [PATCH 08/15] gpio: mt7621: " Bartosz Golaszewski
2025-09-12 9:49 ` Sergio Paracuellos
2025-09-09 9:15 ` [PATCH 09/15] gpio: mt7621: use the generic GPIO chip lock for IRQ handling Bartosz Golaszewski
2025-09-09 9:15 ` [PATCH 10/15] gpio: menz127: use new generic GPIO chip API Bartosz Golaszewski
2025-09-09 9:15 ` [PATCH 11/15] gpio: sifive: " Bartosz Golaszewski
2025-09-09 9:15 ` [PATCH 12/15] gpio: spacemit-k1: " Bartosz Golaszewski
2025-09-09 9:39 ` Yixun Lan
2025-09-09 9:15 ` [PATCH 13/15] gpio: sodaville: " Bartosz Golaszewski
2025-09-09 11:31 ` Andy Shevchenko
2025-09-09 11:35 ` Bartosz Golaszewski
2025-09-09 13:13 ` Andy Shevchenko
2025-09-09 13:24 ` Bartosz Golaszewski
2025-09-09 13:45 ` Andy Shevchenko
2025-09-09 13:47 ` Andy Shevchenko
2025-09-09 13:56 ` Andy Shevchenko [this message]
2025-09-09 13:56 ` Bartosz Golaszewski
2025-09-09 14:02 ` Andy Shevchenko
2025-09-09 14:05 ` Bartosz Golaszewski
2025-09-09 15:15 ` Andy Shevchenko
2025-09-09 15:25 ` Andy Shevchenko
2025-09-09 16:20 ` Bartosz Golaszewski
2025-09-09 9:15 ` [PATCH 14/15] gpio: mmio: " Bartosz Golaszewski
2025-09-09 9:15 ` [PATCH 15/15] gpio: move gpio-mmio-specific fields out of struct gpio_chip Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aMAx_EwwBteiI9K6@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=albeu@free.fr \
--cc=andy@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=brgl@bgdev.pl \
--cc=dlan@gentoo.org \
--cc=florian.fainelli@broadcom.com \
--cc=keguang.zhang@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=opendmb@gmail.com \
--cc=paul.walmsley@sifive.com \
--cc=samuel.holland@sifive.com \
--cc=spacemit@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox