Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5570924rwd; Mon, 5 Jun 2023 05:47:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7owEGvswNACN3VjvmdMwmRpE9UQHLF4Pv5KitJ/9RDpu0B5BOZpbNTYvuSNxceVzTBQah4 X-Received: by 2002:a05:6a00:1786:b0:627:6328:79f1 with SMTP id s6-20020a056a00178600b00627632879f1mr14937357pfg.34.1685969231405; Mon, 05 Jun 2023 05:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685969231; cv=none; d=google.com; s=arc-20160816; b=GPGxTrzubPVI59TqUJXcV6lQ3MAXPlYSMI/gHObxDPZElwInPqs4yN22i+nf9NuALT bSY9vcJ4w4aNXQaaULoyyZTseR6OOBB3gNdNTr2hxLbqUn4R6W9l2pdfPAWKnzojHco2 WPEURVnE4cFttjJhSdJ+makZpKVfHhcC6hiAY6MFRyv7qraAk4vrPnXmUbZotjOVEuFE 9OtGam8YcXlfsDaMfaLPvtwuLPu+Pcrt49eMBKJvieym8DVns+S+7ojEOCv9+RfpSCNe bDwZCI5p4SQELBgNdBDb7jzQ+oY9PIMQv9PyW7RUk8rqawcs4NUO1gd8gDeAjncynEZA wlRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=euSzWbdAJIhobvITCThSqCY0UiRHVup0lZuS9yKCiCI=; b=T90ozfu4h3nYcrCbgvSjUxftgcWa0grFZH2/jl1eoJPDbiRzE7USj2DkfOcC3Mo0Ln BXnIRdUQ5rKHJ00DZTqBmjI0bheU0DQNK6IcBfomURH2BLK9X2n2u0icy5qbCIca8HOo QQTn95YJJABnirlaJXPa3NK84VRQBkenOi5ZAjG8vITFS0WO6vPRf2dn4aZ9VfsCWHTA yqSQ0/Cb0dwuHulEwEu6N660Y7afkqBRv39w8ww32BjfAiUjuj0Z8SOmpINeKwcxez80 Z8dpyJ/k02zKrCPLt3i0lQDQBg/9n2P19yuyH7ZGfMfvz5FbtAXwDKjNJr6tLb3AfFUS 8tuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Y3PTcyCD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bu21-20020a632955000000b0053f0cdab80csi5477537pgb.338.2023.06.05.05.46.56; Mon, 05 Jun 2023 05:47:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Y3PTcyCD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232711AbjFEMg1 (ORCPT + 99 others); Mon, 5 Jun 2023 08:36:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232896AbjFEMgZ (ORCPT ); Mon, 5 Jun 2023 08:36:25 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17EFBFA; Mon, 5 Jun 2023 05:35:56 -0700 (PDT) X-GND-Sasl: herve.codina@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1685968540; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=euSzWbdAJIhobvITCThSqCY0UiRHVup0lZuS9yKCiCI=; b=Y3PTcyCD1Xh1PS3bwIAeEasa8DsJNB6JUDLbYfgzXu4kJnbAOccGVoygE4DmyImLDLzv/N ykGK7bH96jGj1PFLEx/TTVTHTqG1kWdumuw1YrLn9FxhVruYnQWyqsDFGwU/PuoE1ZvTnl Zmu1FjT9tzN0ZA4RIuooqFWksce2JYGokae0dLwVm/EwXWowEniZESfui4bjrCs0xWqgjI GDj3H4NH25F+uUfMQrrznoZsuEeRGUd0DWy/EiqyZlb+qB3yHKGy/8w9YNEDiXJfIWNayP engkRUb60X+hNYH7z9M1j1WNapxP6RUdP7b4p0DeeZZt7Q+Esx+pxmLaQSq08w== X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 9A38AE000C; Mon, 5 Jun 2023 12:35:37 +0000 (UTC) Date: Mon, 5 Jun 2023 14:35:36 +0200 From: Herve Codina To: andy.shevchenko@gmail.com Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Cameron , Lars-Peter Clausen , Jaroslav Kysela , Takashi Iwai , Kuninori Morimoto , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Christophe Leroy , Thomas Petazzoni Subject: Re: [PATCH v2 6/9] ASoC: soc-dapm.h: Add a helper to build a DAPM widget dynamically Message-ID: <20230605143536.5a3b5bbe@bootlin.com> In-Reply-To: References: <20230523151223.109551-1-herve.codina@bootlin.com> <20230523151223.109551-7-herve.codina@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, On Sat, 3 Jun 2023 17:07:43 +0300 andy.shevchenko@gmail.com wrote: > Tue, May 23, 2023 at 05:12:20PM +0200, Herve Codina kirjoitti: > > The SND_SOC_DAPM_* helpers family are used to build widgets array in a > > static way. > > > > Introduce SND_SOC_DAPM_WIDGET() in order to use the SND_SOC_DAPM_* > > helpers family in a dynamic way. The different SND_SOC_DAPM_* parameters > > can be computed by the code and the widget can be built based on this > > parameter computation. > > For instance: > > static int create_widget(char *input_name) > > { > > struct snd_soc_dapm_widget widget; > > char name*; > > ... > > name = input_name; > > if (!name) > > name = "default"; > > > > widget = SND_SOC_DAPM_WIDGET(SND_SOC_DAPM_INPUT(name)); > > ... > > } > > Maybe instead of adding a helper, simply convert those macros to provide > a compaund literal? (See, for example, > https://elixir.bootlin.com/linux/v6.4-rc4/source/include/linux/pinctrl/pinctrl.h#L42) > Yes, I will convert them in the next iteration. Thanks for the review, Hervé