mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@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: Wed, 1 Apr 2026 08:29:34 +0300	[thread overview]
Message-ID: <852bc121-3d7b-42bc-9a99-cd226e8bf3e0@gmail.com> (raw)
In-Reply-To: <acaoXdQIqicMVmre@google.com>

On 27/03/2026 18:10, Dmitry Torokhov wrote:
> 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.

Yes. But ones I've seen have been wrapped in macros. I don't think I've 
seen open-coded one written directly to a call-site (although that's 
what the macros end up). Hence, this is not something I see typically 
when reading drivers.

But as I said, if this is fine with Lee, I can live with this too :)

-- 
---
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

  reply	other threads:[~2026-04-01  5:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25  0:54 [PATCH v3 0/2] rohm-bdi718x7/71828: " 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
2026-04-01  5:29       ` Matti Vaittinen [this message]
2026-04-01 10:59         ` Lee Jones
2026-04-01 19:42           ` Dmitry Torokhov
2026-04-07 13:47             ` Lee Jones

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=852bc121-3d7b-42bc-9a99-cd226e8bf3e0@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome