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 B293B40243D for ; Wed, 1 Apr 2026 10:59:34 +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=1775041174; cv=none; b=rGUC8XgezCv0Qgh4kZfVTyyOg7NUDXsmYJsKge2nwV6zA51LR50hJzx4iI3ItZvWcKein5Ur6jBTUWds5bLcSuQ/YySsug7pVVhqbs98dpqWPwuupF9BhnK2rNiD9RMdITopc737fwZ8LWHza2rT4RYCaj2bJJyPxeNzVGwpXAI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775041174; c=relaxed/simple; bh=tiAh8W98Ue1ZXXcDCe/WNOcdWAIdNJM16cW4XiM81T4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mp7GaIGoA+hgDpNx/GG18WYzSCmnHRR2xb+84BJrE2n0Rq07DDFgVfeRKfv2wEsgw/OpEjpD+0EP3A4t2+CdFFrgGzO+wqWbskFNvKh7zjKEOwH2brMgmkl/C59B5PY8otv7PxsHxPAdO7i4UPYGxI6nMetJs6YBBqWekTZTKaE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=beCmqYaq; 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="beCmqYaq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E3C7C2BCB0; Wed, 1 Apr 2026 10:59:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775041174; bh=tiAh8W98Ue1ZXXcDCe/WNOcdWAIdNJM16cW4XiM81T4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=beCmqYaq+jHSUbu62nVkoefhS+h819mBfEv34EoCQqsZpGCVXHE88JbmM720n3fpv lKYS6NqQKc80JqeAnC1gOsrVbuxDQiNNkVfUpFoZYL96ytvaJdWWAD//4LYU+h8qA8 MRLU6K0afiGDoLgDGJph3qKdVtGkHCcagF4RIygy/aq2l9kwhXHsokMDSd6phC0a9S 39cH3bnGjbcnv1ucYz+Lo+YHh0vz3zqjt8rWmHrimG/PdesQ+C70KUqMEJRo8wo2M0 1PGzIm8HY/OUNLpdd1s04wdZQSX0+ixDfwuIrkvCJ8sq2NTCkZWer4h8CJC7RtntQG sLZCsOqCm0OEg== Date: Wed, 1 Apr 2026 11:59:30 +0100 From: Lee Jones To: Matti Vaittinen Cc: Dmitry Torokhov , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/2] mfd: rohm-bd718x7: Use software nodes for gpio-keys Message-ID: <20260401105930.GL3795166@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> 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: <852bc121-3d7b-42bc-9a99-cd226e8bf3e0@gmail.com> 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. -- Lee Jones [李琼斯]