Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3804167rwd; Sat, 3 Jun 2023 12:17:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4VdG0b3u4kgZufCqZK2/Ugw3EZypc8a05VxLmVMpXSaHiCVGR42SidDZjt60qHi+4XdcEl X-Received: by 2002:a05:6358:7188:b0:123:390b:178f with SMTP id t8-20020a056358718800b00123390b178fmr16927189rwt.5.1685819839855; Sat, 03 Jun 2023 12:17:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685819839; cv=none; d=google.com; s=arc-20160816; b=r8vytAlIbqh/NOZi0gAGbsHkptZvp8amM0OPVK4WHlfPAS3qW+7g3RQETWwN7zV29D sZeyqtlZhwxssB70PUqKnn7XRghYkoC7dusGpGJzp1QEK/Q30hKfo3WlzU4apAB7qLZ7 I859cXhD1+lLI9b0OMAaVM62e4vnB2t5r/bvAwiLneuzH3exEVas3uBjmNZFNk1yE4l/ vdg+nQ8XXkIfNqSrI+xRGvGoKC4Wiv/0cPW218vH99makd1Y1utA5KYp7bhV4b7WpJJw oibYIOHLXLVxgPfOTfXfJI5D5e8nUEALYy0YCjnYMSgkm/KjK477T9olhn+5+QhAEp8E X9Mw== 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=ALe2d3i4KLi0+blbRYVCALNm3eF5lhQzuH4bn+mtZHI=; b=bXYcX8Q6AlSHCJJ2UibSMAEReLjjs/YSoQxPxnuFE8tAXR4+ajp587XC/Lmh1Dj9/1 hkWYBYhwO3gtCC2WHd2sfPwhbgcwn3L1XgXGGOxx+RJPib3D1IoEqn0PHfCeb4hs3I9h 7bno/6+FxKy0GtjChjdM97OwqtJwLfEDKzDZ55tC6fzha3W8jr1czrJaS1c09HOMIKYc mornHRxrUQU4NF68fjRCmpvHOpOTfDvhMlGCkakrpxp/5F6TgeFZR9WFaGr8E9AOXT0v bc0vcrW1a8i/7AL49KDgE69lYYlCWXnHuANLBEhFqoepMpqyLo7mTraySjnRoFLwEsYh JkPg== 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 w18-20020aa79a12000000b0063b8f3a4d42si361291pfj.163.2023.06.03.12.17.08; Sat, 03 Jun 2023 12:17:19 -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 S229689AbjFCS1u (ORCPT + 99 others); Sat, 3 Jun 2023 14:27:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229605AbjFCS1s (ORCPT ); Sat, 3 Jun 2023 14:27:48 -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 49DFAC2 for ; Sat, 3 Jun 2023 11:27:47 -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 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> 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 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: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