Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1557877rdb; Wed, 20 Sep 2023 12:32:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGXdn9BvVp36p0/Lh5MWFSToQoXnEey4agI8DIg/AYFv7fGIwRQJS9UlHBNlYTCDkm3e+fj X-Received: by 2002:a17:902:f7d1:b0:1bc:506a:58f2 with SMTP id h17-20020a170902f7d100b001bc506a58f2mr3186663plw.46.1695238322681; Wed, 20 Sep 2023 12:32:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695238322; cv=none; d=google.com; s=arc-20160816; b=ZuJUuc49JwgWPuZ8MjJQx4ADEovBi2V7BR03twHVn4gUFqD+3AOjGXwlfMc55l9XFI kxgXIBwfyrb4J4e4T+jk7alYpjrZv27lCSuKe2FVnrAwIGAmjP2bnmfwJeDWhFib0rqW YuY8h9Sh/TehGyVR1huWvxStRwsw36CiPVXSe72pBzorpkBXAqURemIvr639iL6REufS ShF4qiAo+YyrN59Yn05SzeF2Y6BiDjRzI1dniIkJNGAbk2H8+LEdVrumeoQ1QNJTrXiH zznjRKmahsHo46FleJ6uQA5IVG4QcxuO9sXi3dlwDHwnZ8YUkVrTG5yTfTM4UsPrPORT drHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=j9BV2FsReo3bjFArOmq56b9nQaunFJcbl9Kf+vMrcew=; fh=FM4ftDnQBOMw2K89x6kyK6T/kK/Qyj1501A0N7xBdrU=; b=bJewxr8fWbStGHvHfsLP3kMR03o0mO7nCIJL1eWv9atz+c9WbG3LxNy/qp86Pk98mn kzY650bnPd8JhW2jJX3mB6RICyp5hMIxACTMseKRYYdO66j3Y0rAKbklnxajxJDSkQjy 9BHJl7uTtH1flNEqT+Yqca0pMtKNolShSqNdyPWNpnoIu+3/DskaOMQ0TmbmHSlQFvCR xGvTSP6s0iKfSJrTvBTzjdaHCOy6EXJcdsgfnIr4cx8OaesHU4z5urlmlybhDA7paBQa QeNvmqTDsHxybSwJ3RtQaZZGucXireXOY2fdxR+ZgVIr5LJtI0NDAryH+Z/nUlcKdVzJ 4Hhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=mxDDWZC5; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id b3-20020a170903228300b001c2218c375esi13009921plh.445.2023.09.20.12.31.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 12:32:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=mxDDWZC5; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 59D718099CD9; Tue, 19 Sep 2023 23:52:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233471AbjITGwJ (ORCPT + 99 others); Wed, 20 Sep 2023 02:52:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233462AbjITGwH (ORCPT ); Wed, 20 Sep 2023 02:52:07 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E77FD3; Tue, 19 Sep 2023 23:51:59 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 443211F385; Wed, 20 Sep 2023 06:51:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1695192718; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=j9BV2FsReo3bjFArOmq56b9nQaunFJcbl9Kf+vMrcew=; b=mxDDWZC5pQ85391QKVOI6L/APZo86pstKE8SYQtSqPsEY0oH78XR62ugA+TRGvjZE1m4Di K/v1N4ACSf0I3nIdyJl8ItrqbjTC/abIk3iIjoTWRhCGl1KOlPLz6G7G6nwJQRhbX0oI0W wvVuRf/2GHrrX/Es17yZOZ53LFLrmYM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1695192718; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=j9BV2FsReo3bjFArOmq56b9nQaunFJcbl9Kf+vMrcew=; b=1pSxjxGHqSr4xqiz8ATQRyZo+WqHFi9jEUhz1YCyVeOQyAaT8/99LU9TySlqb53ysOW9vF Dv8w3toVZG1FRACw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 06FB51333E; Wed, 20 Sep 2023 06:51:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 352+AI6WCmX4HwAAMHmgww (envelope-from ); Wed, 20 Sep 2023 06:51:58 +0000 Date: Wed, 20 Sep 2023 08:51:57 +0200 Message-ID: <874jjpwd4i.wl-tiwai@suse.de> From: Takashi Iwai To: Nick Desaulniers Cc: Richard Fitzgerald , tiwai@suse.com, alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , linux-acpi@vger.kernel.org Subject: Re: [PATCH 2/2] ALSA: hda: cirrus_scodec: Add KUnit test In-Reply-To: References: <20230918095129.440-1-rf@opensource.cirrus.com> <20230918095129.440-3-rf@opensource.cirrus.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 19 Sep 2023 23:52:09 -0700 (PDT) On Tue, 19 Sep 2023 22:44:28 +0200, Nick Desaulniers wrote: > > On Mon, Sep 18, 2023 at 10:51:29AM +0100, Richard Fitzgerald wrote: (snip) > > +static void cirrus_scodec_test_set_gpio_ref_arg(struct software_node_ref_args *arg, > > + int gpio_num) > > +{ > > + struct software_node_ref_args template = > > + SOFTWARE_NODE_REFERENCE(&cirrus_scodec_test_gpio_swnode, gpio_num, 0); > > I'm observing the following error when building with: > > $ make LLVM=1 -j128 allmodconfig sound/pci/hda/cirrus_scodec_test.o > > sound/pci/hda/cirrus_scodec_test.c:151:60: error: initializer element is not a compile-time constant > 151 | SOFTWARE_NODE_REFERENCE(&cirrus_scodec_test_gpio_swnode, gpio_num, 0); > | ^~~~~~~~ > /builds/linux/include/linux/property.h:291:37: note: expanded from macro 'SOFTWARE_NODE_REFERENCE' > 291 | .nargs = ARRAY_SIZE(((u64[]){ 0, ##__VA_ARGS__ })) - 1, \ > | ^~~~~~~~~~~ > /builds/linux/include/linux/kernel.h:57:75: note: expanded from macro 'ARRAY_SIZE' > 57 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) > | ^~~ > /builds/linux/include/linux/compiler.h:228:59: note: expanded from macro '__must_be_array' > 228 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) > | ^ > /builds/linux/include/linux/compiler_types.h:366:63: note: expanded from macro '__same_type' > 366 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > | ^ > /builds/linux/include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO' > 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) > | ^ Hm, this looks like some inconsistent handling of the temporary array passed to ARRAY_SIZE() in the SOFTWARE_NODE_REFERENCE macro. LLVM can't treat it if it contains a variable in the given array, while GCC doesn't care. A hackish workaround would be the patch like below, but it's really ugly. Ideally speaking, it should be fixed in linux/properties.h, but I have no idea how to fix there for LLVM. Adding more relevant people to Cc. thanks, Takashi --- a/sound/pci/hda/cirrus_scodec_test.c +++ b/sound/pci/hda/cirrus_scodec_test.c @@ -148,8 +148,9 @@ static void cirrus_scodec_test_set_gpio_ref_arg(struct software_node_ref_args *a int gpio_num) { struct software_node_ref_args template = - SOFTWARE_NODE_REFERENCE(&cirrus_scodec_test_gpio_swnode, gpio_num, 0); + SOFTWARE_NODE_REFERENCE(&cirrus_scodec_test_gpio_swnode, 0, 0); + template.args[0] = gpio_num; *arg = template; }