Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3553636rwd; Sat, 3 Jun 2023 07:22:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ40OLmgRUUlMG6IWXzwWS/8pTWfn4CQyFchkjmwtmEywveoQizW2Dh45Oc6ml4XLN/OSHKi X-Received: by 2002:a05:6a00:a8f:b0:64d:2ea4:937a with SMTP id b15-20020a056a000a8f00b0064d2ea4937amr21704240pfl.7.1685802178719; Sat, 03 Jun 2023 07:22:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685802178; cv=none; d=google.com; s=arc-20160816; b=kLyFmvfMyviXmImphBl1xXkC6t+LSZbwH9xnJSoJCHWFBWQqY5kVld4gif9cRiZc/Z sRCBIEvlGjHWCaPQL1cdpTe/4OU4wUnB4jGChQ/Gguoj8lEYCG+BELU0UJkjsf1frRVs lf+S8A/nzmnzI0kZVxVhmwqpoIfKPmIV/vr5flXibNXEKePda11170PTD2c4Hi97ork4 qS1zwmlVm8p3EN3vXjzXKiFoVcWFGJwEPiUlL9qVFgQJFbZXIKFGPpH6SQfN0EdTgDJo RbwrCXaBY4+U3XpJ4b9tRil8vuILjNj9XEbA/d+6wUaHgg1bUYzBlmMtxdEMzKfdqWtV LzAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:date:from; bh=gwOCyL6OYuV5/IoPd3kR7lUHPZX9uLqGp/F+b9ICTkg=; b=VpDlzjlyNyd2GcqVXin5EKBrLCZwNAletSCgLROEKTwBM9i5FacM7EtMHabX34VHv/ qFSyCzPFA/nB5SIcecVrGuRgwrLihWm6wFr4Ibyhm7/RzM7onpu3QYANibkMBLMSwbyx UyntqyVe2oKH4peXKDyvjjsOwdzzzlUzBKdJmn90/NJMID0YbTVCEfcR5UJ3ieb63w0X b6JPH4ObXQcVY8AJ2AKOcuQL1sTRyHVxWBbx9DLhCBXhmQ2Y/zc88hVNfhYgtMPclIfm YZy43D7nkwC6pgqiyOcvoRTMqUgHc2tJgKJZjK7/7ImeC4lkSEsE5cB+MQ4LcEj5SA3W pi1Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 32-20020a631660000000b005348cc20de8si2704107pgw.846.2023.06.03.07.22.43; Sat, 03 Jun 2023 07:22:58 -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; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230023AbjFCOHs (ORCPT + 99 others); Sat, 3 Jun 2023 10:07:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbjFCOHr (ORCPT ); Sat, 3 Jun 2023 10:07:47 -0400 Received: from fgw21-7.mail.saunalahti.fi (fgw21-7.mail.saunalahti.fi [62.142.5.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6328B4 for ; Sat, 3 Jun 2023 07:07:46 -0700 (PDT) Received: from localhost (88-113-26-95.elisa-laajakaista.fi [88.113.26.95]) by fgw21.mail.saunalahti.fi (Halon) with ESMTP id 026c733a-0218-11ee-abf4-005056bdd08f; Sat, 03 Jun 2023 17:07:44 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Sat, 3 Jun 2023 17:07:43 +0300 To: Herve Codina 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: References: <20230523151223.109551-1-herve.codina@bootlin.com> <20230523151223.109551-7-herve.codina@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230523151223.109551-7-herve.codina@bootlin.com> X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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 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) -- With Best Regards, Andy Shevchenko