Message ID | 20230417141453.919158-2-krzysztof.kozlowski@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp2093450rwl; Mon, 17 Apr 2023 07:22:29 -0700 (PDT) X-Google-Smtp-Source: AKy350YkPvlECRyAsZjOCTRxZJda2HSFErX426zuayxZOFYSib7Q5lCWfUdhg7t5UxCPOGPEFQGB X-Received: by 2002:a17:902:f94b:b0:1a2:9051:f09e with SMTP id kx11-20020a170902f94b00b001a29051f09emr10920539plb.21.1681741349129; Mon, 17 Apr 2023 07:22:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681741349; cv=none; d=google.com; s=arc-20160816; b=RsUn0m0ycHl9IWjDZKNR0U5fZDhiy6G7PBM+5cBxiryRNP8VYXiMzOyvf9B38j74sD Fit6Tgbj1PRU7tpafXMHIYErEpntXSBwYWOE0c+cJmwtxj5dr+Q3NliNxE1veld+ATmc PmNY/XFg+bndnYXmT/G0U7hBjIeZ0cnFyRxAWQm57P6l8WhGn4x9FrATebui0f3T6JOo 5Y+R+dnq+wnLAPkj05NOoaZP0b+/kQbYPkYnk+EClz0gJI1SfXLMqhFpPF7IZzhFu/9A LzJBG8ZgHz0FFv0T0zeTYMh7zAGstmUnkCMt0bdGLfeab7AFSjixV20UD2eJUiJl2Nr4 OTUw== 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=DdSLfFTkv6LYV3M0mzyuGaPRuWS7s/5vp6QK5VHSwvw=; b=ZtBQm0Iz861L4NffTCGJnKWO2ebW1YnRWbj2QRCm9F4Kn+P4LFnGQYD3Hzsnsji0EL iwDkwdM73G0A9Dvq9tc+lPetiPopqwok3xeZCn7239wpttSUxqL09DH+9JEvoQtuYtF7 h3Q6TlJlWAU5M9TjD4ytwKgL060wg7uwGXhs14Sti/KrKXXY/45V6x3ish3qCoJ+0U7o rX0vSwtxiF4XDhcwKhQTeBOFvZdUqxRdJcGFVmss1u+u85H7+jGuJMLxHq0yej1mxWQy ae43x/xf3gNn1jhaJZXhhKtXaStCjPHSQFe6QjvZX93cHVZBCRU+U0LPd5lkCj5w4bAL YVHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RzE+hWQv; 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=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a17090282c600b001a4fc13dfa5si11679239plz.276.2023.04.17.07.22.13; Mon, 17 Apr 2023 07:22:29 -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=@linaro.org header.s=google header.b=RzE+hWQv; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231217AbjDQOPC (ORCPT <rfc822;leviz.kernel.dev@gmail.com> + 99 others); Mon, 17 Apr 2023 10:15:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229804AbjDQOPA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 17 Apr 2023 10:15:00 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB0625580 for <linux-kernel@vger.kernel.org>; Mon, 17 Apr 2023 07:14:58 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-50672fbf83eso14693688a12.0 for <linux-kernel@vger.kernel.org>; Mon, 17 Apr 2023 07:14:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681740897; x=1684332897; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DdSLfFTkv6LYV3M0mzyuGaPRuWS7s/5vp6QK5VHSwvw=; b=RzE+hWQvLG+ToUxcaDtEz9Q3e8NAYpfR7V5FIpzDQuomR5owNFdDhUvH2QaJipF10D GWjQqAHBtrZGC615Ls7NgtT+6C4C1jOjVw0B7hMOEY3u/fUyHuT3t4TsOAkAKWsVI1h4 AEfglOWetOIog4xZls6MOZJkql6492Ni2Zw4EoF5Qo+zrz5dJPENj1jeJIRTF9U1khZ6 fn936x3xvUrAzwgWBXafJCWCBWUufiAkTrw9X8JlPtynRTseumDspzinwkfJVPxg/qgG ZZ4hsxxTHKzvHpblKwulKigeP7Nw7tZNwiWpKpZlNnxIC1QrXUS+vvo4QSm+yRiHh8Qc zanA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681740897; x=1684332897; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DdSLfFTkv6LYV3M0mzyuGaPRuWS7s/5vp6QK5VHSwvw=; b=B5/viSX84/tk7bbED0bG+mxUYqxk1xhb8EJJIdcQBXB566UI59WsyZzRjAJWdWTPeL FZKmpeNkyiJ/tqBRQnEeDu0a0dIWv9dnSWoSblKOVjmPvCjlvDMa82LflPHFKw8Aipkk seQmlmHk4NDB8JNi29KEsUm2yoZWmJ8GA9wWj2o6kerXNFroqEAsOpBOOL68Q7UZ5+VG LTqhvfVwS++UOOXV4cro2E8nKFiNCH8t1H3nVBEs3+dB6rP/9NT7ciTprUgxpn9HDi8l w6ekVp6idX+PJGpFriMAc3pNncI91kRf/r/tzdkXocZh2M95n9eD6QjBs13Hvk9l6fiK 32fQ== X-Gm-Message-State: AAQBX9ekS0XVwT57FiHIzRJsg4DaHxUvUqgg+JUMQdRqttNkdmOELu0t db34zjshQhj9rI2FtwCYN+2iDw== X-Received: by 2002:a05:6402:4cb:b0:504:9350:f458 with SMTP id n11-20020a05640204cb00b005049350f458mr13585489edw.1.1681740897195; Mon, 17 Apr 2023 07:14:57 -0700 (PDT) Received: from krzk-bin.. ([2a02:810d:15c0:828:96aa:60eb:e021:6511]) by smtp.gmail.com with ESMTPSA id q6-20020a056402040600b004f9e6495f94sm5832034edv.50.2023.04.17.07.14.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 07:14:56 -0700 (PDT) From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, Banajit Goswami <bgoswami@quicinc.com>, Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Subject: [PATCH 2/4] ASoC: codecs: wcd934x: Simplify with dev_err_probe Date: Mon, 17 Apr 2023 16:14:51 +0200 Message-Id: <20230417141453.919158-2-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230417141453.919158-1-krzysztof.kozlowski@linaro.org> References: <20230417141453.919158-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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?1763433616747767030?= X-GMAIL-MSGID: =?utf-8?q?1763433616747767030?= |
Series |
[1/4] ASoC: codecs: wcd9335: Simplify with dev_err_probe
|
|
Commit Message
Krzysztof Kozlowski
April 17, 2023, 2:14 p.m. UTC
Code can be a bit simpler with dev_err_probe().
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
sound/soc/codecs/wcd934x.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
Comments
On Mon, Apr 17, 2023 at 04:14:51PM +0200, Krzysztof Kozlowski wrote: > Code can be a bit simpler with dev_err_probe(). > - if (IS_ERR(wcd->if_regmap)) { > - dev_err(dev, "Failed to allocate ifc register map\n"); > - return PTR_ERR(wcd->if_regmap); > - } > + if (IS_ERR(wcd->if_regmap)) > + return dev_err_probe(dev, PTR_ERR(wcd->if_regmap), > + "Failed to allocate ifc register map\n"); This is a functional change.
On 17/04/2023 17:33, Mark Brown wrote: > On Mon, Apr 17, 2023 at 04:14:51PM +0200, Krzysztof Kozlowski wrote: > >> Code can be a bit simpler with dev_err_probe(). > >> - if (IS_ERR(wcd->if_regmap)) { >> - dev_err(dev, "Failed to allocate ifc register map\n"); >> - return PTR_ERR(wcd->if_regmap); >> - } >> + if (IS_ERR(wcd->if_regmap)) >> + return dev_err_probe(dev, PTR_ERR(wcd->if_regmap), >> + "Failed to allocate ifc register map\n"); > > This is a functional change. Hmm... I don't see it. Return value is the same, same message is printed, same condition. Did I make some copy-paste error? Best regards, Krzysztof
On Mon, Apr 17, 2023 at 05:43:03PM +0200, Krzysztof Kozlowski wrote: > On 17/04/2023 17:33, Mark Brown wrote: > > On Mon, Apr 17, 2023 at 04:14:51PM +0200, Krzysztof Kozlowski wrote: > >> - if (IS_ERR(wcd->if_regmap)) { > >> - dev_err(dev, "Failed to allocate ifc register map\n"); > >> - return PTR_ERR(wcd->if_regmap); > >> - } > >> + if (IS_ERR(wcd->if_regmap)) > >> + return dev_err_probe(dev, PTR_ERR(wcd->if_regmap), > >> + "Failed to allocate ifc register map\n"); > > This is a functional change. > Hmm... I don't see it. Return value is the same, same message is > printed, same condition. Did I make some copy-paste error? You've replaced an unconditional dev_err() with dev_err_probe().
On 17/04/2023 17:58, Mark Brown wrote: > On Mon, Apr 17, 2023 at 05:43:03PM +0200, Krzysztof Kozlowski wrote: >> On 17/04/2023 17:33, Mark Brown wrote: >>> On Mon, Apr 17, 2023 at 04:14:51PM +0200, Krzysztof Kozlowski wrote: > >>>> - if (IS_ERR(wcd->if_regmap)) { >>>> - dev_err(dev, "Failed to allocate ifc register map\n"); >>>> - return PTR_ERR(wcd->if_regmap); >>>> - } >>>> + if (IS_ERR(wcd->if_regmap)) >>>> + return dev_err_probe(dev, PTR_ERR(wcd->if_regmap), >>>> + "Failed to allocate ifc register map\n"); > >>> This is a functional change. > >> Hmm... I don't see it. Return value is the same, same message is >> printed, same condition. Did I make some copy-paste error? > > You've replaced an unconditional dev_err() with dev_err_probe(). Which is the core of this change... so what is here surprising? Yes, that's functional change and I never wrote that dev_err_probe is equal dev_err. It is similar but offers benefits and one difference - does not print DEFER. Which is in general exactly what we want. Best regards, Krzysztof
On Mon, Apr 17, 2023 at 06:00:59PM +0200, Krzysztof Kozlowski wrote: > On 17/04/2023 17:58, Mark Brown wrote: > > You've replaced an unconditional dev_err() with dev_err_probe(). > Which is the core of this change... so what is here surprising? Yes, > that's functional change and I never wrote that dev_err_probe is equal > dev_err. It is similar but offers benefits and one difference - does not > print DEFER. Which is in general exactly what we want. This may well be what you intended to do but it's not what the commit message says that the change is doing, unlike patch 1 this isn't an open coded dev_err_probe() that's being replaced.
On 17/04/2023 18:27, Mark Brown wrote: > On Mon, Apr 17, 2023 at 06:00:59PM +0200, Krzysztof Kozlowski wrote: >> On 17/04/2023 17:58, Mark Brown wrote: > >>> You've replaced an unconditional dev_err() with dev_err_probe(). > >> Which is the core of this change... so what is here surprising? Yes, >> that's functional change and I never wrote that dev_err_probe is equal >> dev_err. It is similar but offers benefits and one difference - does not >> print DEFER. Which is in general exactly what we want. > > This may well be what you intended to do but it's not what the commit > message says that the change is doing, unlike patch 1 this isn't an open > coded dev_err_probe() that's being replaced. But my patch 1 (and my other patches some time ago for wsa speakers) does exactly the same as this one here in few other places - introduces better message printing of EPROBE_DEFER. Only in one place it is equivalent. If you prefer, I can mention the message/EPROBE_DEFER difference in commit msgs. Best regards, Krzysztof
On Mon, Apr 17, 2023 at 06:32:07PM +0200, Krzysztof Kozlowski wrote: > If you prefer, I can mention the message/EPROBE_DEFER difference in > commit msgs. I know you prefer to maintain exacting standards in these areas.
On 17/04/2023 19:23, Mark Brown wrote: > On Mon, Apr 17, 2023 at 06:32:07PM +0200, Krzysztof Kozlowski wrote: > >> If you prefer, I can mention the message/EPROBE_DEFER difference in >> commit msgs. > > I know you prefer to maintain exacting standards in these areas. I don't understand what do you mean here. Do you wish me to re-phrase the commit msg or change something in the code? Best regards, Krzysztof
On Mon, Apr 17, 2023 at 07:30:35PM +0200, Krzysztof Kozlowski wrote: > On 17/04/2023 19:23, Mark Brown wrote: > > On Mon, Apr 17, 2023 at 06:32:07PM +0200, Krzysztof Kozlowski wrote: > >> If you prefer, I can mention the message/EPROBE_DEFER difference in > >> commit msgs. > > I know you prefer to maintain exacting standards in these areas. > I don't understand what do you mean here. Do you wish me to re-phrase > the commit msg or change something in the code? Your commit message does not accurately describe the change the patch makes, it should do so.
diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index 783479a4d535..56487ad2f048 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -5868,10 +5868,9 @@ static int wcd934x_codec_parse_data(struct wcd934x_codec *wcd) slim_get_logical_addr(wcd->sidev); wcd->if_regmap = regmap_init_slimbus(wcd->sidev, &wcd934x_ifc_regmap_config); - if (IS_ERR(wcd->if_regmap)) { - dev_err(dev, "Failed to allocate ifc register map\n"); - return PTR_ERR(wcd->if_regmap); - } + if (IS_ERR(wcd->if_regmap)) + return dev_err_probe(dev, PTR_ERR(wcd->if_regmap), + "Failed to allocate ifc register map\n"); of_property_read_u32(dev->parent->of_node, "qcom,dmic-sample-rate", &wcd->dmic_sample_rate); @@ -5923,19 +5922,15 @@ static int wcd934x_codec_probe(struct platform_device *pdev) memcpy(wcd->tx_chs, wcd934x_tx_chs, sizeof(wcd934x_tx_chs)); irq = regmap_irq_get_virq(data->irq_data, WCD934X_IRQ_SLIMBUS); - if (irq < 0) { - dev_err(wcd->dev, "Failed to get SLIM IRQ\n"); - return irq; - } + if (irq < 0) + return dev_err_probe(wcd->dev, irq, "Failed to get SLIM IRQ\n"); ret = devm_request_threaded_irq(dev, irq, NULL, wcd934x_slim_irq_handler, IRQF_TRIGGER_RISING | IRQF_ONESHOT, "slim", wcd); - if (ret) { - dev_err(dev, "Failed to request slimbus irq\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Failed to request slimbus irq\n"); wcd934x_register_mclk_output(wcd); platform_set_drvdata(pdev, wcd);