From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 360B2C7EE24 for ; Sat, 3 Jun 2023 18:31:07 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 427816C1; Sat, 3 Jun 2023 20:30:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 427816C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1685817065; bh=hsX7q9+cVjzdo/foEa34n0ylZFDMI49d1mBkQt9HjoE=; h=From:Date:To:Cc:Subject:References:In-Reply-To:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=QLuPOPlbVGto5a28LIKjLHTSk5PVBdciKR+QJJVia69BDlyW4xYp+najFbgnu+t83 kpU6aFuOWlvE5LNt6meju1NwRmSOEQx8hwWl2T8PXrgLlXUrPzwt21PX4gAP2d72Ql yJKUwNiGtMfK2XaSH/ydYhEoJFPGmBJp7d5kw4CE= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 24261F80527; Sat, 3 Jun 2023 20:29:48 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 81822F80149; Sat, 3 Jun 2023 20:29:48 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 50F82F8016B; Sat, 3 Jun 2023 20:27:48 +0200 (CEST) Received: from fgw21-7.mail.saunalahti.fi (fgw21-7.mail.saunalahti.fi [62.142.5.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 07E35F800BD for ; Sat, 3 Jun 2023 20:27:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 07E35F800BD Received: from localhost (88-113-26-95.elisa-laajakaista.fi [88.113.26.95]) by fgw21.mail.saunalahti.fi (Halon) with ESMTP id 555a7ff2-023c-11ee-abf4-005056bdd08f; Sat, 03 Jun 2023 21:27:45 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Sat, 3 Jun 2023 21:27:44 +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 9/9] ASoC: simple-card: Handle additional devices Message-ID: References: <20230523151223.109551-1-herve.codina@bootlin.com> <20230523151223.109551-10-herve.codina@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230523151223.109551-10-herve.codina@bootlin.com> Message-ID-Hash: PXZ4GWBEFGE27ORA5YWYY2YEB7RSHRK6 X-Message-ID-Hash: PXZ4GWBEFGE27ORA5YWYY2YEB7RSHRK6 X-MailFrom: andy.shevchenko@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Tue, May 23, 2023 at 05:12:23PM +0200, Herve Codina kirjoitti: > An additional-devs subnode can be present in the simple-card top node. > This subnode is used to declared some "virtual" additional devices. > > Create related devices from this subnode and avoid this subnode presence > to interfere with the already supported subnodes analysis. ... > +static int simple_populate_aux(struct asoc_simple_priv *priv) > +{ > + struct device *dev = simple_priv_to_dev(priv); > + struct device_node *node; > + struct device **ptr; > + int ret; > + > + node = of_get_child_by_name(dev->of_node, PREFIX "additional-devs"); > + if (!node) > + return 0; > + > + ptr = devres_alloc(simple_populate_aux_release, sizeof(*ptr), GFP_KERNEL); > + if (!ptr) > + return -ENOMEM; > + > + ret = of_platform_populate(node, NULL, NULL, dev); > + if (ret) { > + devres_free(ptr); > + } else { > + *ptr = dev; > + devres_add(dev, ptr); > + } > + return ret; This can be well simplified by using devm_add_action_or_reset(). > +} -- With Best Regards, Andy Shevchenko