From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: Lee Jones <lee@kernel.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] mfd: rohm-bd718x7: Use software nodes for gpio-keys
Date: Fri, 27 Mar 2026 09:10:05 -0700 [thread overview]
Message-ID: <acaoXdQIqicMVmre@google.com> (raw)
In-Reply-To: <e8455cd9-9c40-49e4-8e8b-2cc5f15f9b80@gmail.com>
On Fri, Mar 27, 2026 at 12:55:55PM +0200, Matti Vaittinen wrote:
> On 25/03/2026 02:54, Dmitry Torokhov wrote:
> > +
> > + node_group = (const struct software_node *[]){
> > + &nodes[0],
> > + &nodes[1],
> > + NULL
> > + };
>
> Hmm. I suppose I was not explaining myself well. When I asked for a
> temporary variable, I was hoping to get rid of this syntax. Something like:
> const struct software_node *node_group[3];
>
> node_group[0] = &nodes[0];
> node_group[1] = &nodes[1];
> node_group[2] = NULL;
>
> would look more familiar to me. Well, I suppose I can live with this if it
> is Ok to Lee though. Let's see if he has an opinion.
This is simply a compound literal, part of the C standard since C99. It
allows skip explicitly declaring the dimensions of the node_group[]
array (which is "far" away from where we initialize it and it
potentially may get out of sync).
We have quite a few in the kernel, DEFINE_RES_IRQ() and others for
example are compound literals under the hood.
Thanks.
--
Dmitry
prev parent reply other threads:[~2026-03-27 16:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 0:54 [PATCH v3 0/2] rohm-bdi718x7/71828: Use software nodes for gpio-keys Dmitry Torokhov
2026-03-25 0:54 ` [PATCH v3 1/2] mfd: rohm-bd71828: " Dmitry Torokhov
2026-03-27 10:58 ` Matti Vaittinen
2026-03-25 0:54 ` [PATCH v3 2/2] mfd: rohm-bd718x7: " Dmitry Torokhov
2026-03-27 10:55 ` Matti Vaittinen
2026-03-27 16:10 ` Dmitry Torokhov [this message]
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=acaoXdQIqicMVmre@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mazziesaccount@gmail.com \
/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