Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5334762rwd; Mon, 5 Jun 2023 01:57:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ENBj2KUBM5gnmd/YzZl6YQwPC6/SfGV5wsWGcUFecpUmVBPrgpP0mpcTaYHOIKOhj1Fus X-Received: by 2002:a05:6a00:2e12:b0:640:defd:a6d5 with SMTP id fc18-20020a056a002e1200b00640defda6d5mr13990555pfb.12.1685955452575; Mon, 05 Jun 2023 01:57:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685955452; cv=none; d=google.com; s=arc-20160816; b=DmEBESp5NaGhm+1E4KV8Eh60J/nvuoYHeEmc0nrnofgqdSdAj3emgO4YeHhK0GjD4k 0/w+QhqoVLiwR0TQpOWOYfbM/IAZx1lRPSz+725dpEeHYlYLgWO+LgpsSpI96gJowBny WHogPzrvOy2C/f0E9q/QC2m60tBnaE0BBOkDy6go7hae4q+lSzMSeQWBrgEXPwj6k01p pQiT1bUPVPnl9nIJoy3Iw2BLvWeDW0SDwnubaKR7KDEH6UnHZ2n6jzpE/w6fSZwavK65 S8noRp6kOxK0tPL1R5UeICAOEfQk7RHZ9t6Aw2Je+OWLEUNLUuljY3pjDsImZi8jmgkT PXmw== 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=dNvkGsaRNjcLUAaRAQc2wTZtlEs619LxRWDYK7s9IYw=; b=PkPjEfHZLhFJ/0ctDKJOI/1BBR+UPEmISchDawAPWeEsM87VpvrUKHSiPChlnAClug 48xAYa7E4NLgtmYT1zeJ3qMhOZZaK/W3PIfYVIWTJ/vYFFE+D+tN3zVo4XgqZgA2KeUE OPD78TgqYa7BWBp50+CLuUQBp1R3JCA+SMzCeHS2NLA82NF83aCAP66IeGXflA9DQd9i maWuAADsyqlA9nu2zuJjdmyuvWJeN5f35O5IZcg0A/BZr/TW/MMVzULpagbUDyVsVOl4 H3nU6HqKyCfjT8jD+5ZDVvlwVpWURdBEmxojlMmFbPf1A46ob9XBMb46+8WhJcujAUa2 EtAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=WDaiNeGp; 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 i6-20020a625406000000b0064d3e1db254si4963517pfb.347.2023.06.05.01.57.20; Mon, 05 Jun 2023 01:57:32 -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=WDaiNeGp; 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 S229822AbjFEIyO (ORCPT + 99 others); Mon, 5 Jun 2023 04:54:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbjFEIyN (ORCPT ); Mon, 5 Jun 2023 04:54:13 -0400 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7836CDB; Mon, 5 Jun 2023 01:54:11 -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=1685955249; 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=dNvkGsaRNjcLUAaRAQc2wTZtlEs619LxRWDYK7s9IYw=; b=WDaiNeGp/8dW6v+ebqBLy0MPRo35NcuuRkxke6vf8dj8iHnv5Nl6xKEKMBGvu3VvsREio8 sDRcdg9puN/CvYQJb68brM5++QqwFvsZsz71TJrspS9Cmj2Z3785dOBfNEcjaW/nNYIZUx DR4nw6QbTBQmnaF8CnzvwCAlu9yIWWblgKAkQru2+p183k8RpBWbfjuHpHwLAvtdmDOcHP UVgnW/riry09OBZ7IviYz6ag1wV9o3fs1lij42CwZ8vQpC52/iEAlAGi60WDAGCvV2CcbB 289lKtWAcOcXHzS3SOO9YwRZHw2q6YOftNf9Zn+MqlmPFyr666NuUf9vSlA0lw== 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 5089E1C0005; Mon, 5 Jun 2023 08:54:06 +0000 (UTC) Date: Mon, 5 Jun 2023 10:54:05 +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: <20230605105405.39bcebef@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,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 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) > Indeed, I will convert macros and remove the helper in the next iteration. Thanks for the review, Hervé