From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B6523B4E84 for ; Tue, 7 Apr 2026 13:47:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775569670; cv=none; b=uKBe5Q8JUbW5xZCf/lMxyu/sgk66tVo9ULVYh5vvFRfZFjX9CqiPErxpGVnAN6/V56XePID9rYXaLZmh33c+OTXwDcmFC63IPtfR2IeQTTN4pypfuOSEm/uQ0TCLBY0l1zdxXfL+T1NwaNMPOiPbBLwQV2UgpuFB2FRwHj6Dqms= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775569670; c=relaxed/simple; bh=bihxT+kwPxrP6uxZDc3TjUguCfp4rFgp2I1SE35fBdE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NzQ/sk9Zjp2tGZKLIfzbxeC2qCW2b2E/rkaVLCeBzi1NzUV/6TFKjRRDns8sAVDhanJPC41vUKwTMc8UYwWvXNwmOgeDHeTgt87sLNDJ2xBjsbHtYuLYcpZYtFcFuZM8wFT/ga3T5mauQUZaPrR6H+/jwI7WB5DCkZoa8FuQo9Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ouIgXsqW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ouIgXsqW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42169C116C6; Tue, 7 Apr 2026 13:47:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775569670; bh=bihxT+kwPxrP6uxZDc3TjUguCfp4rFgp2I1SE35fBdE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ouIgXsqWZHbsfibwdLXJe18URqx54FzvdBOwatZRnyjyzwGTucGzrYzz5KL9XJDoc 6LZ5EI136wLch5AyVAhHfib1w4GOixE0dAIbRD2VzqYHRWWtDBZBRfQAKQDwYXNFax 5HxJpo0tp1LvsWFTqoiYAHON9bvFk//hoP+pxFp0yVit7HW4Y5Om4r6VnTMxkSYA3l hrNm2oz/XfaxkIgNhFQ4qiye6aP5tRhV50d69LYrpXXurg8TwemjPVE1iS5ExBUCds 2QuAB0PZe+xM0SjmA4+XmBUg6Pxf3N7kPTGUFCM+OMaoC3pypQaXKfJXQGWpVmXEjN Z5YOkMzNmhHRw== Date: Tue, 7 Apr 2026 14:47:46 +0100 From: Lee Jones To: Dmitry Torokhov Cc: Matti Vaittinen , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/2] mfd: rohm-bd718x7: Use software nodes for gpio-keys Message-ID: <20260407134746.GN3795166@google.com> References: <20260324-rohm-software-nodes-v3-0-edde5a0324d5@gmail.com> <20260324-rohm-software-nodes-v3-2-edde5a0324d5@gmail.com> <852bc121-3d7b-42bc-9a99-cd226e8bf3e0@gmail.com> <20260401105930.GL3795166@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, 01 Apr 2026, Dmitry Torokhov wrote: > On Wed, Apr 01, 2026 at 11:59:30AM +0100, Lee Jones wrote: > > On Wed, 01 Apr 2026, Matti Vaittinen wrote: > > > > > 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 :) > > > > My personal preference is to avoid the use of compound literals for > > structs inside functions. > > > > I assume use of macros like DEFINE_RES_IRQ() is still OK? Inside statically declared structs, yes. Inside functions, generally not. -- Lee Jones [李琼斯]