From patchwork Tue Apr 18 07:46:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 674541 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 C6BD2C77B71 for ; Tue, 18 Apr 2023 07:48:03 +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 8924DDFA; Tue, 18 Apr 2023 09:47:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8924DDFA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1681804081; bh=5IbqXVFTGL04rbEqRhCWdRIxfFdMHfiUC06FaWY1mSw=; h=From:To:Subject:Date:CC:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=cYj59bdwnzj5kSK2yrpmbDRtLniOWNj+lWs3zmFqKm5ZpCm9ZJJa4eGSU/Lnn453Q TxI10XA4FPpWakbHxsVpcFkZXOXKV7gq/RFXPwwZaeL5KKTaTUUeXq22OcTbi/K2WC D008bFeR8KPHwBSLYyfQGKAsf7VeaqXJhb/iVhKI= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 2E54CF80155; Tue, 18 Apr 2023 09:46:46 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8E8D6F804FC; Tue, 18 Apr 2023 09:46:42 +0200 (CEST) Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 074FBF800D0 for ; Tue, 18 Apr 2023 09:46:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 074FBF800D0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=xeUihBhx Received: by mail-ej1-x629.google.com with SMTP id sz19so13747416ejc.2 for ; Tue, 18 Apr 2023 00:46:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681803994; x=1684395994; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=r75opw4l+CuhzHbMethMKplabYX6RCoTnwLJOAhIH2w=; b=xeUihBhxZpDw3QqpfDYWEsAjDVqperPh1t0wYprp0Xc0pDzXU2RUtVLV2Chco6lXQK y1zWf41LzWNQtKtfmvytgrSHu0h+8uazuqfDTa2UZ41gEwWWpIFWLsZ3G2WN57BBMsne nxNO0QoCslwB2reV1GDhXcC5FgpU1xblug5Q1r4ftpH+Kedkxx7XiA9mt8kjYsvT1MZT As7eLuhzgixF+k/fPGNbRltr52nKQzkj7hsl2ExdutdlE3tprI0kuflQ1cozOYV6cM1q PzG8I4ZtecLXmjLXDII8fBgK4Y7aoXGV8AYqqbmWRwv+oTqmVUo+zAJj/AbXULdhn7n6 8HWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681803994; x=1684395994; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=r75opw4l+CuhzHbMethMKplabYX6RCoTnwLJOAhIH2w=; b=ZNJ9dwYow7NrErjMmNYRoGIA6oOO1bVBqiSBdhleysOc+fz3wC4I/I/Fs63/mxoN8T e0VIq48wsNAkyiOGOSmfvTHGMUTst2vCZfVQMOzbjvin9CVptLFvjyxleazA0OmHtU3k 6zHfJT+0WcVkIT0QBkqx4UtGks+znYxxF+3lrvczs0SouxVCW6biWDnAyxxgySMS33v6 BaTmTHAYbPvuQaMaEj38BdX4jzNksXW5nwuoImxNBtAA6QXEkl88uVlu7Dzj4vaBFUgS Q/KQQHFSLZiC5Y0LLcQtDBxl+nk4CzCsTAWr62LEW0PPiPg80XZLoXgcLKkIHJ8G+FI7 XuPw== X-Gm-Message-State: AAQBX9eCBYFOq4hUl4BmPjEWi4KTJpQdx1OwiUlTy8Cex7rbf3oS33nb sO+Lg3KL7j//2PKNBwMFLs7vfg== X-Google-Smtp-Source: AKy350Z/p8EIAtZAxXyH27eboA35NbIl/kTqGzUgL6dzF9dIDkVlpNY2VfIyskViVRSjKS33fHEUhw== X-Received: by 2002:a17:907:6d24:b0:94f:395b:df1b with SMTP id sa36-20020a1709076d2400b0094f395bdf1bmr8173936ejc.21.1681803993713; Tue, 18 Apr 2023 00:46:33 -0700 (PDT) Received: from krzk-bin.. ([2a02:810d:15c0:828:a276:7d35:5226:1c77]) by smtp.gmail.com with ESMTPSA id sa39-20020a1709076d2700b0094f410225c7sm3731993ejc.169.2023.04.18.00.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 00:46:33 -0700 (PDT) From: Krzysztof Kozlowski To: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] ASoC: codecs: wcd9335: Simplify with dev_err_probe Date: Tue, 18 Apr 2023 09:46:27 +0200 Message-Id: <20230418074630.8681-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Message-ID-Hash: HQDSFFXKDYNPBIGVDTX3MERJROFEH352 X-Message-ID-Hash: HQDSFFXKDYNPBIGVDTX3MERJROFEH352 X-MailFrom: krzysztof.kozlowski@linaro.org 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 CC: Krzysztof Kozlowski 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: Replace dev_err() in probe() path with dev_err_probe() to: 1. Make code a bit simpler and easier to read, 2. Do not print messages on deferred probe. Signed-off-by: Krzysztof Kozlowski --- Changes in v2: 1. Re-write commit msg. --- sound/soc/codecs/wcd9335.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index d2548fdf9ae5..8bf3510a3ea3 100644 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -5138,20 +5138,17 @@ static int wcd9335_irq_init(struct wcd9335_codec *wcd) * INTR2 is a subset of first interrupt sources MAD, VBAT, and SVA */ wcd->intr1 = of_irq_get_byname(wcd->dev->of_node, "intr1"); - if (wcd->intr1 < 0) { - if (wcd->intr1 != -EPROBE_DEFER) - dev_err(wcd->dev, "Unable to configure IRQ\n"); - - return wcd->intr1; - } + if (wcd->intr1 < 0) + return dev_err_probe(wcd->dev, wcd->intr1, + "Unable to configure IRQ\n"); ret = devm_regmap_add_irq_chip(wcd->dev, wcd->regmap, wcd->intr1, IRQF_TRIGGER_HIGH, 0, &wcd9335_regmap_irq1_chip, &wcd->irq_data); if (ret) - dev_err(wcd->dev, "Failed to register IRQ chip: %d\n", ret); + return dev_err_probe(wcd->dev, ret, "Failed to register IRQ chip\n"); - return ret; + return 0; } static int wcd9335_slim_probe(struct slim_device *slim) @@ -5207,17 +5204,15 @@ static int wcd9335_slim_status(struct slim_device *sdev, slim_get_logical_addr(wcd->slim_ifc_dev); wcd->regmap = regmap_init_slimbus(sdev, &wcd9335_regmap_config); - if (IS_ERR(wcd->regmap)) { - dev_err(dev, "Failed to allocate slim register map\n"); - return PTR_ERR(wcd->regmap); - } + if (IS_ERR(wcd->regmap)) + return dev_err_probe(dev, PTR_ERR(wcd->regmap), + "Failed to allocate slim register map\n"); wcd->if_regmap = regmap_init_slimbus(wcd->slim_ifc_dev, &wcd9335_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"); ret = wcd9335_bring_up(wcd); if (ret) { From patchwork Tue Apr 18 07:46:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 674540 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 20D2EC77B76 for ; Tue, 18 Apr 2023 07:48:36 +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 EDD85E7C; Tue, 18 Apr 2023 09:47:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EDD85E7C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1681804114; bh=elaz8ZFwFH0ba/QSKTTX6DLV5Y0Gpm6Uzg/S/p6tsaU=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=UXvJqAHhCZF4OZ5a595BRdgoO00GcjBNrJ30+/EnU/pr+Zm9Izcl4onLAMdDr2k+7 BVOwC1wkf0Gw0LeN8LVJimbvl6C/3H7lTPmg9ZNAgnIWbIUS1cMuu3CYrIwU3u9JGF xgzHpWIxLpCigwNiqX4SilVuc46Qx2hig8DwFzkY= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 1121BF8052E; Tue, 18 Apr 2023 09:46:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7E4E5F80155; Tue, 18 Apr 2023 09:46:45 +0200 (CEST) Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 50E6DF80149 for ; Tue, 18 Apr 2023 09:46:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 50E6DF80149 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=YZNWGQsk Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-94a34d38291so529447566b.3 for ; Tue, 18 Apr 2023 00:46:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681803994; x=1684395994; 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=o12ebF9++JVUvhpdQh9deSW0oeUpmXNibeCUjBiWaVA=; b=YZNWGQskAWaR2q2RjOEHZVsl62XSVmgC9xJB4lIqLtYzbrKBJz9znlfxGyiVdkUTbD EdeEYATXSTBAFfnp8Of6o0p0Uf2s+9SyXuvyOyxfPgt4ElqPM2VawcxGGjm4EneE+kXt MFGh3VUrnCJsnlbq5X3xajzuvSiFwvpWOONF6u/LlD3QjoUItBVl2mDDU4QDy6Jf1COf UdYS8a/nH8SD5rlQc+EwU0y7vDaPjQopGhqdBx03jnsbrewjWqtwhOVOb9wNjo+m44ey OJzBONsullh0IJU0uKe574dyfz+TgD703l8I35ZXWMUAvAiTmgSxUOqOfU0rvXxsOjZ0 Q8aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681803994; x=1684395994; 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=o12ebF9++JVUvhpdQh9deSW0oeUpmXNibeCUjBiWaVA=; b=WWmFJKOqce6JX1Y2TrFI4WSxW7qOAFJGADQZPxGHfI4oTlIJHfgrBEXqLmUEjw1dV8 m4ufryx2zcnBD0QXOor1vfFQarkyySJA4Az4L2o9qPV5wT1ZvAxCGylmJtIpgKPa1YVQ IIfhjJRjvlPKSQI2epsIez0Z2nCyF2/23wilDb1ZSbwx/KSSGz03NeSFJj+p60XMERyl sMHPVWWCrtB5KxPsK4DVaQD7MB4bpVooP6K7jZNDHbW2YrqJTyyQ2o0PhE/07KoFoZRm IqQ8tfPV4l0aBYRuEAOatHL+eLNNGjvmpMJi3zZX/XBQPtnfZuvZz4Gh9VvtNfpQtylm fzCQ== X-Gm-Message-State: AAQBX9cLkQg9XrjJCeIG+Wb5NkPmvublrEdzUt9U291yVBpnQfiCoy61 Iz66Al3JotEvKVOcf6Av7HTQmA== X-Google-Smtp-Source: AKy350ZtFKag5MXhYcTH62ouNdlygN8c6TqlGXIZNzZsHErco0sFZK5MTskdQ6jMWuQg2eohYm3VYw== X-Received: by 2002:a05:6402:748:b0:506:ae87:a36a with SMTP id p8-20020a056402074800b00506ae87a36amr1550021edy.14.1681803994735; Tue, 18 Apr 2023 00:46:34 -0700 (PDT) Received: from krzk-bin.. ([2a02:810d:15c0:828:a276:7d35:5226:1c77]) by smtp.gmail.com with ESMTPSA id sa39-20020a1709076d2700b0094f410225c7sm3731993ejc.169.2023.04.18.00.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 00:46:34 -0700 (PDT) From: Krzysztof Kozlowski To: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] ASoC: codecs: wcd934x: Simplify with dev_err_probe Date: Tue, 18 Apr 2023 09:46:28 +0200 Message-Id: <20230418074630.8681-2-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230418074630.8681-1-krzysztof.kozlowski@linaro.org> References: <20230418074630.8681-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Message-ID-Hash: 2THKBKF4MYX7ZWTF5SCN3YNP3UYG6WPU X-Message-ID-Hash: 2THKBKF4MYX7ZWTF5SCN3YNP3UYG6WPU X-MailFrom: krzysztof.kozlowski@linaro.org 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 CC: Krzysztof Kozlowski 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: Replace dev_err() in probe() path with dev_err_probe() to: 1. Make code a bit simpler and easier to read, 2. Do not print messages on deferred probe. Signed-off-by: Krzysztof Kozlowski --- Changes in v2: 1. Re-write commit msg. --- sound/soc/codecs/wcd934x.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) 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); From patchwork Tue Apr 18 07:46:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 676943 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 7752EC77B75 for ; Tue, 18 Apr 2023 07:48:29 +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 19A87E76; Tue, 18 Apr 2023 09:47:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 19A87E76 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1681804107; bh=XYlWN4SrGk2yoXplGhYjzKOFigkOY5w24D0jpe3YkTc=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Epi8+6ktYZwOhY9OqfxGdKZJFECVias7M/8mGzYSRl2580cP2rHNSODHwEHTmdpui o93d9wpAiVAmMU5VxlEPD1JaxTLdrqOAnh6ThWb6CAUQ/l8aZ4OdX9nSEJ6Q1uxVzE RWoJLONMnbA4ZO0R5vW34zQbA0x5sQDz1TEIgITQ= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id F3A80F8019B; Tue, 18 Apr 2023 09:46:47 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E5054F80212; Tue, 18 Apr 2023 09:46:43 +0200 (CEST) Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 8DED5F80155 for ; Tue, 18 Apr 2023 09:46:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8DED5F80155 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=H19N0PQ5 Received: by mail-ej1-x62a.google.com with SMTP id ud9so70611279ejc.7 for ; Tue, 18 Apr 2023 00:46:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681803996; x=1684395996; 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=1KzlXWIM5HS1BOW2B1whAuoVKMTEgEYpaiz3Oizdn5U=; b=H19N0PQ5GtqPopJUPGOAT/1G76UPeZ8HVJxVpqisflVlalw7nlPEiStSQ6EUPADPbX YOX4RZbH9DQimMFZSa1e71+njuTL+LKQBoWCiOFEQH42PQWhKQn5J4+YJ310hkCWTwkQ qegT3GXD/L86fdNBpIW77DKCxA7FSb1wfKCjFVfg6FNM+Wrzhy5i6Vf72g3rAHArR92W u2h01c9IK6TbCrZOP9RlYCbVLP/rU9YovAro5tTsIQDDeVFqfqQTLGwU7583IadZz+Sn tJ4FvFtuV72mQIyjyk90db9ghTwKLgSwuL80xp7HgwphEo/bzmaY0h7nbv1qy83b2O0o LiOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681803996; x=1684395996; 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=1KzlXWIM5HS1BOW2B1whAuoVKMTEgEYpaiz3Oizdn5U=; b=Dh502DPLk8ywcL0EcnegJWqEy1RnzfmCNsosOmEUQ7CCBOLBmRntC+4qXPF1q5bfLv sOIonHvKyBJ0Qw23BF77RuRhvZ39oTKpPkU61SK9nCXojZvhkiReKFW4Bc+7skhGgEko yHv1Or+gVg8nkdFyapJAVcIJ9VB7eXv0O3zpgOZFQxN+XQX3VX7mC3mkCKdUyArBlrIH sAwiZB0E8zf/3sboZoA7VoGkECSAo7rCRBosv8MF/K+li6mtkFVH1zrh1hNgq0CQFAuw sqicTmVtGwSnNfJsdfVNMk8aVXvW9s+/jDPGxZsreU3RuZVyTxstvY1/5nE+CyJKqoxy rEUw== X-Gm-Message-State: AAQBX9fQRwhGJknBwxNkD1miCMW5HCNFNlfnxIwthVR7GCUug16OSVlS HNMWSv5Qizov+DNvmwlRsiuNTw== X-Google-Smtp-Source: AKy350Zktflt25b9vERxQO2FlE7z26UszBD/EKXSmSLPNH5/5HFIpsNYYm+dcrfZ6V6BBlaahPNzCQ== X-Received: by 2002:a17:906:7e0b:b0:94e:5c28:1c19 with SMTP id e11-20020a1709067e0b00b0094e5c281c19mr11010367ejr.5.1681803995746; Tue, 18 Apr 2023 00:46:35 -0700 (PDT) Received: from krzk-bin.. ([2a02:810d:15c0:828:a276:7d35:5226:1c77]) by smtp.gmail.com with ESMTPSA id sa39-20020a1709076d2700b0094f410225c7sm3731993ejc.169.2023.04.18.00.46.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 00:46:35 -0700 (PDT) From: Krzysztof Kozlowski To: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] ASoC: codecs: wcd934x: Simplify &pdev->dev in probe Date: Tue, 18 Apr 2023 09:46:29 +0200 Message-Id: <20230418074630.8681-3-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230418074630.8681-1-krzysztof.kozlowski@linaro.org> References: <20230418074630.8681-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Message-ID-Hash: EN6O52CFCQ22UJDEQYEGAWR3VQSELELZ X-Message-ID-Hash: EN6O52CFCQ22UJDEQYEGAWR3VQSELELZ X-MailFrom: krzysztof.kozlowski@linaro.org 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 CC: Krzysztof Kozlowski 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: The probe already stores pointer to &pdev->dev, so use it to make the code a bit easier to read. Signed-off-by: Krzysztof Kozlowski --- Changes in v2: 1. None. --- sound/soc/codecs/wcd934x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index 56487ad2f048..c0d1fa36d841 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -5892,12 +5892,12 @@ static int wcd934x_codec_parse_data(struct wcd934x_codec *wcd) static int wcd934x_codec_probe(struct platform_device *pdev) { - struct wcd934x_ddata *data = dev_get_drvdata(pdev->dev.parent); - struct wcd934x_codec *wcd; struct device *dev = &pdev->dev; + struct wcd934x_ddata *data = dev_get_drvdata(dev->parent); + struct wcd934x_codec *wcd; int ret, irq; - wcd = devm_kzalloc(&pdev->dev, sizeof(*wcd), GFP_KERNEL); + wcd = devm_kzalloc(dev, sizeof(*wcd), GFP_KERNEL); if (!wcd) return -ENOMEM; From patchwork Tue Apr 18 07:46:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 676942 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 17B23C77B76 for ; Tue, 18 Apr 2023 07:48:56 +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 CAAA0E84; Tue, 18 Apr 2023 09:48:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CAAA0E84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1681804133; bh=PVV912S4Xoyy5K6KTIPk3ilhr0riYluJO70872u9vAo=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Tm4SVCfFVs7pIoe5OL6d22VAZ2HY8X+GJugIXH/I4dZnnY9BWYLqj6e2FKjFlL+ON xi7a3ZGunwUQNubLb70iV/jIFFTkvnfCOoNdrHUUhApTB6yqy+MkCivkq+wUd4havx vaAoaJNBtoT/XB4vIOKWgeAKNNkH7Znt4KwTFAzE= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 85B5BF80533; Tue, 18 Apr 2023 09:46:52 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C882DF8019B; Tue, 18 Apr 2023 09:46:47 +0200 (CEST) Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 2ACD8F8019B for ; Tue, 18 Apr 2023 09:46:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2ACD8F8019B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=JIXcMkwq Received: by mail-ej1-x630.google.com with SMTP id fy21so27819671ejb.9 for ; Tue, 18 Apr 2023 00:46:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681803996; x=1684395996; 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=VSTh/SJop5c2Us/dQwQInLvSKG2b28WOhmpUgImXSN4=; b=JIXcMkwqYs0HXlx9VovWlfO/IO9++uYT98RcF6INoHP4EgPbfvGOPQK1wUAQELPIdB W5T7j/au9BAmdU7nOY6jxXvLUxudGbK1t1mOIpCUqZRqqnzCUwe2ix1fZ9h7oXecqx+r PyJKJspYUymwBkNi7sFxN0azJce4VLjL0qv2hLFOauSfxPl5bOIguOqqj+0sWIW7s3qx HqN3ScBUfGn9fW4WGfbxWWhkGmHcR5o/US0p2E5zTGOoGQXMVn+jna9bK+zN6Qh9rUAl K5mxSbz9fS89h4O1enbZ+FldagCVrl9P7cAvtfb9NI2aB7WETL6ND2nVlMSBtEl0Qz6Z /ycg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681803996; x=1684395996; 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=VSTh/SJop5c2Us/dQwQInLvSKG2b28WOhmpUgImXSN4=; b=Hi0rWldYdWdrBjhkCfDTEabfkiJPD4iq5M0QpttZOgLL7T39/2DvGAt5d2y2Rl8Hyp gxGMeq/RI7JIWD00InZI2wCMnA3Db3MBK9DVYrc+VUoxnRsG0mu1HhGzcbXvpE5HYXi1 DH25kxELspZxWwDz3nZUVFiO//lXjegKPcvC/qJL6AdeD3A70n3eHHCzvs5GVaKI3vr4 2In1qf8Yv1fyHPEHhQ/jT0Mb1RNnOSnqBYDHRT+80uiDpFTXzJ0SUD16YwgO6hzGFj2m ey9G6Y4yLej0y/7WtxNP3t86lVcNlBQd9YLniA/F9FW7gqMiugGuJSE/Av3mLOubSt1T w5MQ== X-Gm-Message-State: AAQBX9do/fEajdOY9M0ixdw1sz5wbzYSH+iFzGFIPrQDyP0izrCqaa5E RWv1zWdr3ONWKrAeuZDp6sdzPg== X-Google-Smtp-Source: AKy350aFbYeUj+m3sjqAo982f1YulOZ6YRhgeEz5UQC+6oQsPQ9qMNORKSSgrLdCZEKgnbCvHw3jVg== X-Received: by 2002:a17:907:2d09:b0:94f:444c:fc25 with SMTP id gs9-20020a1709072d0900b0094f444cfc25mr8326449ejc.12.1681803996664; Tue, 18 Apr 2023 00:46:36 -0700 (PDT) Received: from krzk-bin.. ([2a02:810d:15c0:828:a276:7d35:5226:1c77]) by smtp.gmail.com with ESMTPSA id sa39-20020a1709076d2700b0094f410225c7sm3731993ejc.169.2023.04.18.00.46.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 00:46:36 -0700 (PDT) From: Krzysztof Kozlowski To: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] ASoC: codecs: wcd938x: Simplify with dev_err_probe Date: Tue, 18 Apr 2023 09:46:30 +0200 Message-Id: <20230418074630.8681-4-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230418074630.8681-1-krzysztof.kozlowski@linaro.org> References: <20230418074630.8681-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Message-ID-Hash: 3NKP3KQKPKOCYTAN5TOVYXNJDUZAY4PK X-Message-ID-Hash: 3NKP3KQKPKOCYTAN5TOVYXNJDUZAY4PK X-MailFrom: krzysztof.kozlowski@linaro.org 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 CC: Krzysztof Kozlowski 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: Replace dev_err() in probe() path with dev_err_probe() to: 1. Make code a bit simpler and easier to read, 2. Do not print messages on deferred probe. Signed-off-by: Krzysztof Kozlowski --- Changes in v2: 1. Re-write commit msg. --- sound/soc/codecs/wcd938x.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index f033f79ed238..11b264a63b04 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -4235,18 +4235,15 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device int ret; wcd938x->reset_gpio = of_get_named_gpio(dev->of_node, "reset-gpios", 0); - if (wcd938x->reset_gpio < 0) { - dev_err(dev, "Failed to get reset gpio: err = %d\n", - wcd938x->reset_gpio); - return wcd938x->reset_gpio; - } + if (wcd938x->reset_gpio < 0) + return dev_err_probe(dev, wcd938x->reset_gpio, + "Failed to get reset gpio\n"); wcd938x->us_euro_gpio = devm_gpiod_get_optional(dev, "us-euro", GPIOD_OUT_LOW); - if (IS_ERR(wcd938x->us_euro_gpio)) { - dev_err(dev, "us-euro swap Control GPIO not found\n"); - return PTR_ERR(wcd938x->us_euro_gpio); - } + if (IS_ERR(wcd938x->us_euro_gpio)) + return dev_err_probe(dev, PTR_ERR(wcd938x->us_euro_gpio), + "us-euro swap Control GPIO not found\n"); cfg->swap_gnd_mic = wcd938x_swap_gnd_mic; @@ -4256,16 +4253,12 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device wcd938x->supplies[3].supply = "vdd-mic-bias"; ret = regulator_bulk_get(dev, WCD938X_MAX_SUPPLY, wcd938x->supplies); - if (ret) { - dev_err(dev, "Failed to get supplies: err = %d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Failed to get supplies\n"); ret = regulator_bulk_enable(WCD938X_MAX_SUPPLY, wcd938x->supplies); - if (ret) { - dev_err(dev, "Failed to enable supplies: err = %d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Failed to enable supplies\n"); wcd938x_dt_parse_micbias_info(dev, wcd938x);