Thread (31 messages) 31 messages, 5 authors, 2025-09-12

Re: [PATCH 13/15] gpio: sodaville: use new generic GPIO chip API

From: Andy Shevchenko <hidden>
Date: 2025-09-09 13:13:13
Also in: linux-gpio, linux-mediatek, linux-mips, linux-riscv, lkml, spacemit

On Tue, Sep 09, 2025 at 01:35:04PM +0200, Bartosz Golaszewski wrote:
On Tue, Sep 9, 2025 at 1:31 PM Andy Shevchenko
[off-list ref] wrote:
quoted
On Tue, Sep 09, 2025 at 11:15:40AM +0200, Bartosz Golaszewski wrote:
...
quoted
quoted
+     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?
quoted
quoted
+             .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


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help