Message ID | 20230705123018.30903-8-johan+linaro@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp1837199vqx; Wed, 5 Jul 2023 05:37:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ48y1PyeACqv0qj4C1V8a521ZQyPflEVHzGadS+aF0vwLUuZyt9hLNPuUV5lNWp++QSIxLO X-Received: by 2002:a05:6a20:610:b0:127:63a4:c585 with SMTP id 16-20020a056a20061000b0012763a4c585mr11596413pzl.22.1688560667397; Wed, 05 Jul 2023 05:37:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688560667; cv=none; d=google.com; s=arc-20160816; b=Be2blxSsYCUEY3lbGKu0Jwlt7rcXXMVGrMh+wF757Bwo0PDOIREnChKhOARisql2rr 0SqIDekZQ6dTjnY3G+oxwAi5wEG5aYnpjqpEPg/o76EyEP2//DxyikiidIm31a+Fo82G msQghUyanHkjxpsrq0BHaQIBRSHzqZpCEaYY3x3n6GZ4JkvJxTvDON2dkLEEegUFWEuf cScugoOH22mIyhl8VvJ5HXOb5guOB6Iz1yUUKU/RRNv7M2gBDQuMuwjnjaCOai5EFkL5 Zyt/f+V3KbOaIZCG0TzmAxMAYkt5beLXiPdGjENY7DqLFiGDInzLgvNJ9fW7Y1B2mnAW Te+Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LhDpOsgFK94170kFy+f17lrs+eKCdgYFquiOMNsAxBY=; fh=Izbxx5vYRCH48EunBM3t8Q/KIyf8hSWF2WSSYO5d+r4=; b=pH85RzKlpUOzvMJqW+YANyVvRzowqJLPd81aI0xlDZbEFH1dWKFE/r1OwMMQASmd9X yNFCMiqvyjXD/f5aquvRJjtJmKyoe+uv03ZmRZXNp04dEGMAYVeh6jIMRo95F155B0rE eZ+blX8VhCH8EpzO/f5JQnTDaN8FYobB6rNM7IgERyWIrUjjksUo6Es9GLq5U094cfJg 8ckhFaWerhNiwTIb59aAbp1ZalRhBJ6cUxJFJW4h7a6CP66Jpc9m6OEJQYDtpQ/TWcjP qEEyhYjEmchLxCJp7zJ5UR3QgxPzUeiAtymhYbZX4UdDvRLbZN+BiFqrAkrjXKrlT0JP frjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LzN+lNYV; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r20-20020a62e414000000b006688c47e5b4si9122913pfh.399.2023.07.05.05.37.33; Wed, 05 Jul 2023 05:37:47 -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=@kernel.org header.s=k20201202 header.b=LzN+lNYV; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231901AbjGEMdX (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Wed, 5 Jul 2023 08:33:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231700AbjGEMdM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 5 Jul 2023 08:33:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B71FF136 for <linux-kernel@vger.kernel.org>; Wed, 5 Jul 2023 05:33:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B2AB661562 for <linux-kernel@vger.kernel.org>; Wed, 5 Jul 2023 12:33:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5E10C433BD; Wed, 5 Jul 2023 12:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688560389; bh=dSIi6iSQrZcwHBgwfGJF2PaWQmJdlHaoNoR7kIW6AWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LzN+lNYV2vZg4H9gENrrC6S4iEtnSjbuaAMDlT4SwILg4/z7V0Qdovnpeu/pzfK1M Q+ctGGcaD8nzUIpSHwHh1cpUp8W583nWBufO0LIC2VlZ072W/pJrIFrcb57wuRcpIp 5hge0sli/lraHNXfY4ziya9+OgNzXr5AQZixhA0IMTrCUF+/kDet7QlBhgz6xPm9fP +K5gaSo9nnbpC1iMMGVniPOvenW1gy7BsF6+0c9S4wnj5t6Jn8lbVguA3fiTygfAZF CQSDcs5a9Rkh98cNY2jFSoQWUClevB4HqouDDW9LrtRHe7Rbtk0dwCKu3omSzAbWcC rMeLgQpNmPD/A== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from <johan+linaro@kernel.org>) id 1qH1hK-00084M-25; Wed, 05 Jul 2023 14:33:30 +0200 From: Johan Hovold <johan+linaro@kernel.org> To: Mark Brown <broonie@kernel.org>, Vinod Koul <vkoul@kernel.org> Cc: Bard Liao <yung-chuan.liao@linux.intel.com>, Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, Sanyog Kale <sanyog.r.kale@intel.com>, Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, Banajit Goswami <bgoswami@quicinc.com>, Liam Girdwood <lgirdwood@gmail.com>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Johan Hovold <johan+linaro@kernel.org> Subject: [PATCH 7/8] ASoC: topology: suppress probe deferral errors Date: Wed, 5 Jul 2023 14:30:17 +0200 Message-Id: <20230705123018.30903-8-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230705123018.30903-1-johan+linaro@kernel.org> References: <20230705123018.30903-1-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770584190225277294?= X-GMAIL-MSGID: =?utf-8?q?1770584190225277294?= |
Series |
ASoC/soundwire/qdsp6/wcd: fix leaks and probe deferral
|
|
Commit Message
Johan Hovold
July 5, 2023, 12:30 p.m. UTC
Suppress probe deferral error messages when loading topologies and
creating frontend links to avoid spamming the logs when a component has
not yet been registered:
snd-sc8280xp sound: ASoC: adding FE link failed
snd-sc8280xp sound: ASoC: topology: could not load header: -517
Note that dev_err_probe() is not used as the topology component can be
probed and removed while the underlying platform device remains bound to
its driver.
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
sound/soc/soc-topology.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
Comments
On 7/5/2023 2:30 PM, Johan Hovold wrote: > Suppress probe deferral error messages when loading topologies and > creating frontend links to avoid spamming the logs when a component has > not yet been registered: > > snd-sc8280xp sound: ASoC: adding FE link failed > snd-sc8280xp sound: ASoC: topology: could not load header: -517 > > Note that dev_err_probe() is not used as the topology component can be > probed and removed while the underlying platform device remains bound to > its driver. I'm not sure that I understand that argument... what's wrong with dev_err_probe(tplg->dev, err, "ASoC: adding FE link failed\n"); instead of dev_err(tplg->dev, "ASoC: adding FE link failed\n"); ? Personally I would prefer dev_err_probe() to be used as it also provides debug message. > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org> > --- > sound/soc/soc-topology.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c > index d0aca6b9058b..696c9647debe 100644 > --- a/sound/soc/soc-topology.c > +++ b/sound/soc/soc-topology.c > @@ -1751,7 +1751,8 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg, > > ret = snd_soc_add_pcm_runtimes(tplg->comp->card, link, 1); > if (ret < 0) { > - dev_err(tplg->dev, "ASoC: adding FE link failed\n"); > + if (ret != -EPROBE_DEFER) > + dev_err(tplg->dev, "ASoC: adding FE link failed\n"); > goto err; > } > > @@ -2514,8 +2515,11 @@ static int soc_tplg_process_headers(struct soc_tplg *tplg) > /* load the header object */ > ret = soc_tplg_load_header(tplg, hdr); > if (ret < 0) { > - dev_err(tplg->dev, > - "ASoC: topology: could not load header: %d\n", ret); > + if (ret != -EPROBE_DEFER) { > + dev_err(tplg->dev, > + "ASoC: topology: could not load header: %d\n", > + ret); > + } > return ret; > } >
On Wed, Jul 05, 2023 at 05:07:22PM +0200, Amadeusz Sławiński wrote: > On 7/5/2023 2:30 PM, Johan Hovold wrote: > > Suppress probe deferral error messages when loading topologies and > > creating frontend links to avoid spamming the logs when a component has > > not yet been registered: > > > > snd-sc8280xp sound: ASoC: adding FE link failed > > snd-sc8280xp sound: ASoC: topology: could not load header: -517 > > > > Note that dev_err_probe() is not used as the topology component can be > > probed and removed while the underlying platform device remains bound to > > its driver. > > I'm not sure that I understand that argument... what's wrong with > dev_err_probe(tplg->dev, err, "ASoC: adding FE link failed\n"); > instead of > dev_err(tplg->dev, "ASoC: adding FE link failed\n"); > ? In short, it is not correct to use dev_err_probe() here as this is not a probe function. dev_err_probe() is tied to driver core and will specifically allocate and associate an error message with the struct device on probe deferrals, which is later freed when the struct device is bound to a driver (or released). For ASoC drivers, the struct device is typically bound to a driver long before the components they register are "probed". I use quotation marks as this is not probing in the driver model sense of the word and the underlying struct device is already bound to a driver when the component is "probed". > Personally I would prefer dev_err_probe() to be used as it also provides > debug message. Yeah, but it would be conceptually wrong to do so (besides the fact that it would waste some memory). Johan
On 7/6/2023 8:14 AM, Johan Hovold wrote: > On Wed, Jul 05, 2023 at 05:07:22PM +0200, Amadeusz Sławiński wrote: >> On 7/5/2023 2:30 PM, Johan Hovold wrote: >>> Suppress probe deferral error messages when loading topologies and >>> creating frontend links to avoid spamming the logs when a component has >>> not yet been registered: >>> >>> snd-sc8280xp sound: ASoC: adding FE link failed >>> snd-sc8280xp sound: ASoC: topology: could not load header: -517 >>> >>> Note that dev_err_probe() is not used as the topology component can be >>> probed and removed while the underlying platform device remains bound to >>> its driver. >> >> I'm not sure that I understand that argument... what's wrong with >> dev_err_probe(tplg->dev, err, "ASoC: adding FE link failed\n"); >> instead of >> dev_err(tplg->dev, "ASoC: adding FE link failed\n"); >> ? > > In short, it is not correct to use dev_err_probe() here as this is not a > probe function. > > dev_err_probe() is tied to driver core and will specifically allocate > and associate an error message with the struct device on probe > deferrals, which is later freed when the struct device is bound to a > driver (or released). > I guess you mean call to: device_set_deferred_probe_reason(dev, &vaf); perhaps functionality could be extended to allow to skip this call and just do prints? Or just add separate dev_err_defer function without this step, although it would be best if they could share parts of code.
On Thu, Jul 06, 2023 at 09:25:26AM +0200, Amadeusz Sławiński wrote: > On 7/6/2023 8:14 AM, Johan Hovold wrote: > > In short, it is not correct to use dev_err_probe() here as this is not a > > probe function. > > > > dev_err_probe() is tied to driver core and will specifically allocate > > and associate an error message with the struct device on probe > > deferrals, which is later freed when the struct device is bound to a > > driver (or released). > I guess you mean call to: device_set_deferred_probe_reason(dev, &vaf); > perhaps functionality could be extended to allow to skip this call and > just do prints? Or just add separate dev_err_defer function without this > step, although it would be best if they could share parts of code. Feel free to suggest adding such a function if you think it's worthwhile. It doesn't exist today it should not be a prerequisite for suppressing these error messages. Johan
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index d0aca6b9058b..696c9647debe 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1751,7 +1751,8 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg, ret = snd_soc_add_pcm_runtimes(tplg->comp->card, link, 1); if (ret < 0) { - dev_err(tplg->dev, "ASoC: adding FE link failed\n"); + if (ret != -EPROBE_DEFER) + dev_err(tplg->dev, "ASoC: adding FE link failed\n"); goto err; } @@ -2514,8 +2515,11 @@ static int soc_tplg_process_headers(struct soc_tplg *tplg) /* load the header object */ ret = soc_tplg_load_header(tplg, hdr); if (ret < 0) { - dev_err(tplg->dev, - "ASoC: topology: could not load header: %d\n", ret); + if (ret != -EPROBE_DEFER) { + dev_err(tplg->dev, + "ASoC: topology: could not load header: %d\n", + ret); + } return ret; }