From patchwork Thu Aug 27 19:26:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741477 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 43A1D14F6 for ; Thu, 27 Aug 2020 19:27:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29E6522B4D for ; Thu, 27 Aug 2020 19:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556452; bh=lwcapEqh1mnH2bnwZTOp+jWQ1z3sGCNA5lWoA1rbyV4=; h=From:To:Subject:Date:List-ID:From; b=BeGKsx+GrKZKwU9dorL6KJ0b9slfyYV7A9uivIiTqkCEgHooi5aV47vmdj9O0zj8v 3i4pthXEeifEG6q4m7okDak4JqgCOA/gkU43ldz5qBXN1ZRrICCQ4M62WAYCNhRCiZ 5ulTDB0dbTT7yZ8vtS5PCijsDsY8QMC+/TjjHNRc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726236AbgH0T1b (ORCPT ); Thu, 27 Aug 2020 15:27:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:58334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726147AbgH0T1b (ORCPT ); Thu, 27 Aug 2020 15:27:31 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 06074207CD; Thu, 27 Aug 2020 19:27:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556450; bh=lwcapEqh1mnH2bnwZTOp+jWQ1z3sGCNA5lWoA1rbyV4=; h=From:To:Subject:Date:From; b=vDACDjMN6Ffk+dwJKEXdyHNYQl1LSRhWd4rY8FxqjQSlr3i+YVbeUVTTxaYwPuBLG Lr/cR0dCM+SEssxNVdI6rwYQTXpXr1iBRY3N+itjh9g+lhC9yZbflbrJ7DfFgCM4Ju wV+IT1ulsV3Xks9GuVRprBDSrQNGt8UtfSolXT94= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:25 +0200 Message-Id: <20200827192642.1725-1-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko --- drivers/iio/accel/bma180.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index 5b7a467c7b27..448faed001fd 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c @@ -1000,19 +1000,15 @@ static int bma180_probe(struct i2c_client *client, return ret; data->vdd_supply = devm_regulator_get(dev, "vdd"); - if (IS_ERR(data->vdd_supply)) { - if (PTR_ERR(data->vdd_supply) != -EPROBE_DEFER) - dev_err(dev, "Failed to get vdd regulator %d\n", - (int)PTR_ERR(data->vdd_supply)); - return PTR_ERR(data->vdd_supply); - } + if (IS_ERR(data->vdd_supply)) + return dev_err_probe(dev, PTR_ERR(data->vdd_supply), + "Failed to get vdd regulator\n"); + data->vddio_supply = devm_regulator_get(dev, "vddio"); - if (IS_ERR(data->vddio_supply)) { - if (PTR_ERR(data->vddio_supply) != -EPROBE_DEFER) - dev_err(dev, "Failed to get vddio regulator %d\n", - (int)PTR_ERR(data->vddio_supply)); - return PTR_ERR(data->vddio_supply); - } + if (IS_ERR(data->vddio_supply)) + return dev_err_probe(dev, PTR_ERR(data->vddio_supply), + "Failed to get vddio regulator\n"); + /* Typical voltage 2.4V these are min and max */ ret = regulator_set_voltage(data->vdd_supply, 1620000, 3600000); if (ret) From patchwork Thu Aug 27 19:26:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741483 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D855916B1 for ; Thu, 27 Aug 2020 19:27:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C07C122BF3 for ; Thu, 27 Aug 2020 19:27:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556458; bh=9WnEmDPaImvJaOTWnFx8b/OSZEA9nx5y8bHKHDlhKUI=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=QB/N2QcryYBHoUygLTWTo9Pb33LQO1UyigMAsyJZi0wa6IK6bls8ujsTU76xFqSZk 1Os3/SDNMo+4vTNPKuG7r8HQhQUKBuX+7UCgjplNm0m/kVyrTuwwE/FtDwtI+76ojF oFornozO8XzXMPH3a3XhdddVzw8/s0Uo7Agsp1IA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726266AbgH0T1i (ORCPT ); Thu, 27 Aug 2020 15:27:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:58468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726147AbgH0T1h (ORCPT ); Thu, 27 Aug 2020 15:27:37 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AF7D722BEA; Thu, 27 Aug 2020 19:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556457; bh=9WnEmDPaImvJaOTWnFx8b/OSZEA9nx5y8bHKHDlhKUI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=S2EpfqrdIG/s0KQe6KaMBJ3NNqM+aQAEaTU2AbvSNF6WKjWIi4iijElsA93Sr+xw3 hj7HOBgbVfqyWCVbaCODneeXlgxLmWbEjbgab2k3j4UwyaS70nE4jlCotJBY5uxLfy pbNIqxcf70lUqcRT2KNkTd4ootECTNn3li8CfU+U= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 02/18] iio: accel: mma8452: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:26 +0200 Message-Id: <20200827192642.1725-2-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko --- drivers/iio/accel/mma8452.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index 4e6e70250048..104b87b98455 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c @@ -1538,22 +1538,14 @@ static int mma8452_probe(struct i2c_client *client, data->chip_info = match->data; data->vdd_reg = devm_regulator_get(&client->dev, "vdd"); - if (IS_ERR(data->vdd_reg)) { - if (PTR_ERR(data->vdd_reg) == -EPROBE_DEFER) - return -EPROBE_DEFER; - - dev_err(&client->dev, "failed to get VDD regulator!\n"); - return PTR_ERR(data->vdd_reg); - } + if (IS_ERR(data->vdd_reg)) + return dev_err_probe(&client->dev, PTR_ERR(data->vdd_reg), + "failed to get VDD regulator!\n"); data->vddio_reg = devm_regulator_get(&client->dev, "vddio"); - if (IS_ERR(data->vddio_reg)) { - if (PTR_ERR(data->vddio_reg) == -EPROBE_DEFER) - return -EPROBE_DEFER; - - dev_err(&client->dev, "failed to get VDDIO regulator!\n"); - return PTR_ERR(data->vddio_reg); - } + if (IS_ERR(data->vddio_reg)) + return dev_err_probe(&client->dev, PTR_ERR(data->vddio_reg), + "failed to get VDDIO regulator!\n"); ret = regulator_enable(data->vdd_reg); if (ret) { From patchwork Thu Aug 27 19:26:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741487 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 663CC14F6 for ; Thu, 27 Aug 2020 19:27:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4CEC322B4D for ; Thu, 27 Aug 2020 19:27:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556468; bh=2a8/YOtRFDrJLGOTtzPGzhFaeGOWai1RDmXhY1cRslc=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=Jcg/VLSycpqrcPcxOD/0cpQrGqOkSd6toOxn2SjJmCsI9/cvyB8dTInYpfMhGePGi vz80/met2gmddY664f/qt0SaJxFaTFiivMAdluA82zrA7b2zHl9JTuy8+w99mvKcoj pZm+jiGqLSuhrIg49QENXzuJ3Q0ELHtnCOqemNzM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726845AbgH0T1o (ORCPT ); Thu, 27 Aug 2020 15:27:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:58572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726147AbgH0T1o (ORCPT ); Thu, 27 Aug 2020 15:27:44 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AF29C2087E; Thu, 27 Aug 2020 19:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556463; bh=2a8/YOtRFDrJLGOTtzPGzhFaeGOWai1RDmXhY1cRslc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Z6Q7J25k98Sjltn3kKVmRfAFPnk32TztVSQ2MQ1odu7N0mYdVVDUD5jyYthEDiszv ERZWYggDXKSB9nvjMYM1M26IgSWnhSv5mKJhEXNXk6YBAJooLV5iK0W0D0TnJ3A7Re DYU737J89uHX9e1aQ68cQRFTHh06qAw7BE4KE0wk= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 03/18] iio: adc: envelope-detector: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:27 +0200 Message-Id: <20200827192642.1725-3-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko --- Changes since v1: 1. Wrap dev_err_probe() lines at 100 character --- drivers/iio/adc/envelope-detector.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/iio/adc/envelope-detector.c b/drivers/iio/adc/envelope-detector.c index 2a4fd3bb64cf..91a7be4a3f1b 100644 --- a/drivers/iio/adc/envelope-detector.c +++ b/drivers/iio/adc/envelope-detector.c @@ -348,11 +348,8 @@ static int envelope_detector_probe(struct platform_device *pdev) indio_dev->num_channels = 1; env->dac = devm_iio_channel_get(dev, "dac"); - if (IS_ERR(env->dac)) { - if (PTR_ERR(env->dac) != -EPROBE_DEFER) - dev_err(dev, "failed to get dac input channel\n"); - return PTR_ERR(env->dac); - } + if (IS_ERR(env->dac)) + return dev_err_probe(dev, PTR_ERR(env->dac), "failed to get dac input channel\n"); env->comp_irq = platform_get_irq_byname(pdev, "comp"); if (env->comp_irq < 0) @@ -360,11 +357,9 @@ static int envelope_detector_probe(struct platform_device *pdev) ret = devm_request_irq(dev, env->comp_irq, envelope_detector_comp_isr, 0, "envelope-detector", env); - if (ret) { - if (ret != -EPROBE_DEFER) - dev_err(dev, "failed to request interrupt\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "failed to request interrupt\n"); + env->comp_irq_trigger = irq_get_trigger_type(env->comp_irq); if (env->comp_irq_trigger & IRQF_TRIGGER_RISING) env->comp_irq_trigger_inv |= IRQF_TRIGGER_FALLING; From patchwork Thu Aug 27 19:26:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741489 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D8FD14F6 for ; Thu, 27 Aug 2020 19:27:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4BFA622BEB for ; Thu, 27 Aug 2020 19:27:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556471; bh=nO07OHVtqYTYYgYXG9kFf3Gxi+yDeW2oQQkBmlm177s=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=N/DcYh4BFmn9OIM4z7t+Qb5E7sSd8vgxm/+vhv2zlKSW7eiVG0+YmpqGjxozUpGcd 8xO1S6/6wuIIex/z7JLx7HwwA4DrZk30HjuvOgEPmVWjAZQqeqnEC2NbALRshNYZlb aLWdKsSRs9vDoFu61gu4/sC2m2+IyxtVJqKiC038= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726834AbgH0T1v (ORCPT ); Thu, 27 Aug 2020 15:27:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:58698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726147AbgH0T1u (ORCPT ); Thu, 27 Aug 2020 15:27:50 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0A528207CD; Thu, 27 Aug 2020 19:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556469; bh=nO07OHVtqYTYYgYXG9kFf3Gxi+yDeW2oQQkBmlm177s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=k2f7aVJFj4bXD51NGX2cAVppPH/aVQDanfa8llcV1nYctPMf6LmiIC/KJbJmb8WHD 9eSWB3C7sSdZhBRMpSTtKkNtAWEc3q0dVkFWVgYs3YhXfGIR2mRl5rCiKcZJ+9oSmf RmEnwuBTnbt7fXl4frQrycGFpDI6oZGYa32S4y+c= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 04/18] iio: adc: exynos_adc: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:28 +0200 Message-Id: <20200827192642.1725-4-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko --- Changes since v1: 1. Wrap dev_err_probe() lines at 100 character --- drivers/iio/adc/exynos_adc.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c index 7d23b6c33284..40585a96c848 100644 --- a/drivers/iio/adc/exynos_adc.c +++ b/drivers/iio/adc/exynos_adc.c @@ -844,13 +844,8 @@ static int exynos_adc_probe(struct platform_device *pdev) } info->vdd = devm_regulator_get(&pdev->dev, "vdd"); - if (IS_ERR(info->vdd)) { - if (PTR_ERR(info->vdd) != -EPROBE_DEFER) - dev_err(&pdev->dev, - "failed getting regulator, err = %ld\n", - PTR_ERR(info->vdd)); - return PTR_ERR(info->vdd); - } + if (IS_ERR(info->vdd)) + return dev_err_probe(&pdev->dev, PTR_ERR(info->vdd), "failed getting regulator"); ret = regulator_enable(info->vdd); if (ret) From patchwork Thu Aug 27 19:26:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741501 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B3B1A16B1 for ; Thu, 27 Aug 2020 19:27:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B39E2087E for ; Thu, 27 Aug 2020 19:27:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556479; bh=egvRrbp3SIvUqDFHa2E5ojGok/WhL9H00xW2YWNmE9c=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=J3Jziu6pRIW4/XtZD/+Vhv0wAbV4XHsqMXEiYHW5a0751XS134YUqUlDAALq35emy szHw1C831aQ4tqDLq273G29+U2GHlBcaew+yGxk1TEhEdoH6x45PJd7zg1oyjVVSBB bBisgUV39rev7WPWR/SQjz5z/rZ8j8BZkA4IcqjY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727013AbgH0T16 (ORCPT ); Thu, 27 Aug 2020 15:27:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:58832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbgH0T14 (ORCPT ); Thu, 27 Aug 2020 15:27:56 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8553D22B4D; Thu, 27 Aug 2020 19:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556476; bh=egvRrbp3SIvUqDFHa2E5ojGok/WhL9H00xW2YWNmE9c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YrqYvR2AFqNkPyVJe8qYG4DwCpi44gE0L+dWdiTNupGsESrLiEdUQ1/dg/fGiy2cE aE4M1q2MnNgR1L12x9H27RkOAvWZKejkBXU8LcGWsGJAXulas6ZLM8WZ9HHczVpBtL PywOhp7u4UvaZ2baefJuOq1Gta7E5W9ikO03GgvQ= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 05/18] iio: adc: ltc2497: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:29 +0200 Message-Id: <20200827192642.1725-5-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko --- Changes since v1: 1. Wrap dev_err_probe() lines at 100 character --- drivers/iio/adc/ltc2497-core.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/adc/ltc2497-core.c b/drivers/iio/adc/ltc2497-core.c index 9b8fd9c32364..d337ed96bbb0 100644 --- a/drivers/iio/adc/ltc2497-core.c +++ b/drivers/iio/adc/ltc2497-core.c @@ -180,13 +180,8 @@ int ltc2497core_probe(struct device *dev, struct iio_dev *indio_dev) return ret; ddata->ref = devm_regulator_get(dev, "vref"); - if (IS_ERR(ddata->ref)) { - if (PTR_ERR(ddata->ref) != -EPROBE_DEFER) - dev_err(dev, "Failed to get vref regulator: %pe\n", - ddata->ref); - - return PTR_ERR(ddata->ref); - } + if (IS_ERR(ddata->ref)) + return dev_err_probe(dev, PTR_ERR(ddata->ref), "Failed to get vref regulator\n"); ret = regulator_enable(ddata->ref); if (ret < 0) { From patchwork Thu Aug 27 19:26:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741511 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 432C514F6 for ; Thu, 27 Aug 2020 19:28:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F439207CD for ; Thu, 27 Aug 2020 19:28:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556486; bh=63gj/uTCsFYMkt/AT+w/CDkwgSGu5Zbr+ERRB5p1wnM=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=l1Adh/hcwuGVnK3lrd86ttG9YA7wfUR0CPOimzlqsxu1Go7avrBNbAHxYXZgD/g1A XHaMx+7JV1xUwzpg3lMHtDVntT812kGezTZWQiheScJ0ovbAlYfk0fG2OEeNEIuiyM CqsUdghgJ/wELHlrG73JaGfx1vyHMZiQvUzvn3lY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727001AbgH0T2E (ORCPT ); Thu, 27 Aug 2020 15:28:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:59018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbgH0T2D (ORCPT ); Thu, 27 Aug 2020 15:28:03 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9BB10207DF; Thu, 27 Aug 2020 19:27:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556482; bh=63gj/uTCsFYMkt/AT+w/CDkwgSGu5Zbr+ERRB5p1wnM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cxhJv2mRkaAjMGY7eC8aNZGedE/iwVcclAU3napyra8QfmIEYonkfRWoflQ/CCNi4 MBTT9/iN4vHxrRhLR7eBaVZ8tNSc7ZHXRkyrhaPEhwd8cPG6xcpUvlE3tHZ+7n/062 M9BToTnR2Z7Qn15KmL16A336fkhvJNaNX6VtP/EM= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 06/18] iio: adc: meson_saradc: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:30 +0200 Message-Id: <20200827192642.1725-6-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko --- drivers/iio/adc/meson_saradc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c index 93c2252c0b89..a9d06e8a576a 100644 --- a/drivers/iio/adc/meson_saradc.c +++ b/drivers/iio/adc/meson_saradc.c @@ -719,11 +719,8 @@ static int meson_sar_adc_temp_sensor_init(struct iio_dev *indio_dev) if (ret == -ENODEV) return 0; - if (ret != -EPROBE_DEFER) - dev_err(indio_dev->dev.parent, - "failed to get temperature_calib cell\n"); - - return ret; + return dev_err_probe(indio_dev->dev.parent, ret, + "failed to get temperature_calib cell\n"); } priv->tsc_regmap = From patchwork Thu Aug 27 19:26:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741515 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E29A14E5 for ; Thu, 27 Aug 2020 19:28:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29C7922CAF for ; Thu, 27 Aug 2020 19:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556491; bh=cd1km85U5G2EJ8pOjILLlqj3JvMWasUe/TU7d+n3MGs=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=iWkDuzxJFL2FZXOaUWBwYomcMcavNsC0XpYl4qXr+53TyPZfkkutOW3QfmQ7f1h8H zR2QgYPF7VLAJQcl7V895D3Mi//cpoo37o1W6pqV59eK89nSC80qrO0DvbZ95qM5CN fOhtcUyIgeOhgafdGzrZ4/yWF4Zkd+mgDokZMitM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726924AbgH0T2K (ORCPT ); Thu, 27 Aug 2020 15:28:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:59216 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbgH0T2J (ORCPT ); Thu, 27 Aug 2020 15:28:09 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7F4C222BEA; Thu, 27 Aug 2020 19:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556489; bh=cd1km85U5G2EJ8pOjILLlqj3JvMWasUe/TU7d+n3MGs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NRU/Za1EEG5VkSgpYbpZUxJdmcsqIpdhv5CVwdFBEWrvZJnbhGtA7LIPPYulIaqyF 3uuKAt/dgdkeTaob+YgsRseLvVaUvCgnlfbap5wwe/Z/Rb3c5kYvsOTJGrDaJs3Sf3 hg7dqoXaKAmsmSE6sj4iHOfH+s7JZZAgPt/hmsTE= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 07/18] iio: adc: rcar-gyroadc: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:31 +0200 Message-Id: <20200827192642.1725-7-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko --- Changes since v1: 1. Wrap dev_err_probe() lines at 100 character --- drivers/iio/adc/rcar-gyroadc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/iio/adc/rcar-gyroadc.c b/drivers/iio/adc/rcar-gyroadc.c index d2c1419e72a0..e1a7c93fc2db 100644 --- a/drivers/iio/adc/rcar-gyroadc.c +++ b/drivers/iio/adc/rcar-gyroadc.c @@ -495,12 +495,8 @@ static int rcar_gyroadc_probe(struct platform_device *pdev) return PTR_ERR(priv->regs); priv->clk = devm_clk_get(dev, "fck"); - if (IS_ERR(priv->clk)) { - ret = PTR_ERR(priv->clk); - if (ret != -EPROBE_DEFER) - dev_err(dev, "Failed to get IF clock (ret=%i)\n", ret); - return ret; - } + if (IS_ERR(priv->clk)) + return dev_err_probe(dev, PTR_ERR(priv->clk), "Failed to get IF clock\n"); ret = rcar_gyroadc_parse_subdevs(indio_dev); if (ret) From patchwork Thu Aug 27 19:26:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741523 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 091A314F6 for ; Thu, 27 Aug 2020 19:28:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D90D022CF6 for ; Thu, 27 Aug 2020 19:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556497; bh=07+0q+YYLs1trEpL5eelKIee9jlu59Bsvp/F9bfhCHY=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=aoa0eTC/tpzgsiL8pT+bbI2QQnTOTvmqBfIo3lK4zmHlWNdzeL6I77AfZfiOniTVN b+1hgpbjMCfm+JKFbgs7zoA+OtKA3i2xvf9hFBD2hNb6xyq/PDMKs5XldWxJricxrA UxZFMu3q48egPP5bLTFCe2FgLKPNJiG1qcPbgfF4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727116AbgH0T2R (ORCPT ); Thu, 27 Aug 2020 15:28:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:59330 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbgH0T2Q (ORCPT ); Thu, 27 Aug 2020 15:28:16 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D15172087E; Thu, 27 Aug 2020 19:28:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556495; bh=07+0q+YYLs1trEpL5eelKIee9jlu59Bsvp/F9bfhCHY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=flUvr+FnIxKzKGiBqDQy6OCgcKelc+2My9EALku4cNKEIkTx+VTk++FJbBeH3V9Gs ZoQ2hkc2Mbq0Ma70b+Rssnowv3CUI5FAly+OVqZvRxWOI3qf+OW2GaRxCQK89dRp3t Q12EwsveA7rTnqAXeSNt5xkatEB75uaz6Hhw9/HM= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 08/18] iio: adc: stm32: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:32 +0200 Message-Id: <20200827192642.1725-8-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko --- Changes since v1: 1. Convert to devm_clk_get_optional 2. Update also stm32-dfsdm-core and stm32-dac-core. 3. Wrap around 100 characters (accepted by checkpatch). --- drivers/iio/adc/stm32-adc-core.c | 67 +++++++++--------------------- drivers/iio/adc/stm32-adc.c | 9 +--- drivers/iio/adc/stm32-dfsdm-adc.c | 9 +--- drivers/iio/adc/stm32-dfsdm-core.c | 8 +--- drivers/iio/dac/stm32-dac-core.c | 5 +-- 5 files changed, 26 insertions(+), 72 deletions(-) diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c index 0e2068ec068b..707c85dab7df 100644 --- a/drivers/iio/adc/stm32-adc-core.c +++ b/drivers/iio/adc/stm32-adc-core.c @@ -582,11 +582,9 @@ static int stm32_adc_core_switches_probe(struct device *dev, priv->syscfg = syscon_regmap_lookup_by_phandle(np, "st,syscfg"); if (IS_ERR(priv->syscfg)) { ret = PTR_ERR(priv->syscfg); - if (ret != -ENODEV) { - if (ret != -EPROBE_DEFER) - dev_err(dev, "Can't probe syscfg: %d\n", ret); - return ret; - } + if (ret != -ENODEV) + return dev_err_probe(dev, ret, "Can't probe syscfg\n"); + priv->syscfg = NULL; } @@ -596,12 +594,9 @@ static int stm32_adc_core_switches_probe(struct device *dev, priv->booster = devm_regulator_get_optional(dev, "booster"); if (IS_ERR(priv->booster)) { ret = PTR_ERR(priv->booster); - if (ret != -ENODEV) { - if (ret != -EPROBE_DEFER) - dev_err(dev, "can't get booster %d\n", - ret); - return ret; - } + if (ret != -ENODEV) + dev_err_probe(dev, ret, "can't get booster\n"); + priv->booster = NULL; } } @@ -612,11 +607,9 @@ static int stm32_adc_core_switches_probe(struct device *dev, priv->vdd = devm_regulator_get_optional(dev, "vdd"); if (IS_ERR(priv->vdd)) { ret = PTR_ERR(priv->vdd); - if (ret != -ENODEV) { - if (ret != -EPROBE_DEFER) - dev_err(dev, "can't get vdd %d\n", ret); - return ret; - } + if (ret != -ENODEV) + return dev_err_probe(dev, ret, "can't get vdd\n"); + priv->vdd = NULL; } } @@ -669,42 +662,20 @@ static int stm32_adc_probe(struct platform_device *pdev) priv->common.phys_base = res->start; priv->vdda = devm_regulator_get(&pdev->dev, "vdda"); - if (IS_ERR(priv->vdda)) { - ret = PTR_ERR(priv->vdda); - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "vdda get failed, %d\n", ret); - return ret; - } + if (IS_ERR(priv->vdda)) + return dev_err_probe(&pdev->dev, PTR_ERR(priv->vdda), "vdda get failed\n"); priv->vref = devm_regulator_get(&pdev->dev, "vref"); - if (IS_ERR(priv->vref)) { - ret = PTR_ERR(priv->vref); - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "vref get failed, %d\n", ret); - return ret; - } + if (IS_ERR(priv->vref)) + return dev_err_probe(&pdev->dev, PTR_ERR(priv->vref), "vref get failed\n"); - priv->aclk = devm_clk_get(&pdev->dev, "adc"); - if (IS_ERR(priv->aclk)) { - ret = PTR_ERR(priv->aclk); - if (ret != -ENOENT) { - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "Can't get 'adc' clock\n"); - return ret; - } - priv->aclk = NULL; - } + priv->aclk = devm_clk_get_optional(&pdev->dev, "adc"); + if (IS_ERR(priv->aclk)) + return dev_err_probe(&pdev->dev, PTR_ERR(priv->aclk), "Can't get 'adc' clock\n"); - priv->bclk = devm_clk_get(&pdev->dev, "bus"); - if (IS_ERR(priv->bclk)) { - ret = PTR_ERR(priv->bclk); - if (ret != -ENOENT) { - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "Can't get 'bus' clock\n"); - return ret; - } - priv->bclk = NULL; - } + priv->bclk = devm_clk_get_optional(&pdev->dev, "bus"); + if (IS_ERR(priv->bclk)) + return dev_err_probe(&pdev->dev, PTR_ERR(priv->bclk), "Can't get 'bus' clock\n"); ret = stm32_adc_core_switches_probe(dev, priv); if (ret) diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c index 3eb9ebe8372f..b8e764ca54a6 100644 --- a/drivers/iio/adc/stm32-adc.c +++ b/drivers/iio/adc/stm32-adc.c @@ -1805,13 +1805,8 @@ static int stm32_adc_dma_request(struct device *dev, struct iio_dev *indio_dev) adc->dma_chan = dma_request_chan(dev, "rx"); if (IS_ERR(adc->dma_chan)) { ret = PTR_ERR(adc->dma_chan); - if (ret != -ENODEV) { - if (ret != -EPROBE_DEFER) - dev_err(dev, - "DMA channel request failed with %d\n", - ret); - return ret; - } + if (ret != -ENODEV) + return dev_err_probe(dev, ret, "DMA channel request failed with\n"); /* DMA is optional: fall back to IRQ mode */ adc->dma_chan = NULL; diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c index 5e10fb4f3704..12c951078c1f 100644 --- a/drivers/iio/adc/stm32-dfsdm-adc.c +++ b/drivers/iio/adc/stm32-dfsdm-adc.c @@ -1473,13 +1473,8 @@ static int stm32_dfsdm_adc_init(struct device *dev, struct iio_dev *indio_dev) /* Optionally request DMA */ ret = stm32_dfsdm_dma_request(dev, indio_dev); if (ret) { - if (ret != -ENODEV) { - if (ret != -EPROBE_DEFER) - dev_err(dev, - "DMA channel request failed with %d\n", - ret); - return ret; - } + if (ret != -ENODEV) + return dev_err_probe(dev, ret, "DMA channel request failed with\n"); dev_dbg(dev, "No DMA support\n"); return 0; diff --git a/drivers/iio/adc/stm32-dfsdm-core.c b/drivers/iio/adc/stm32-dfsdm-core.c index 26e2011c5868..34e4e6e59acf 100644 --- a/drivers/iio/adc/stm32-dfsdm-core.c +++ b/drivers/iio/adc/stm32-dfsdm-core.c @@ -243,12 +243,8 @@ static int stm32_dfsdm_parse_of(struct platform_device *pdev, * on use case. */ priv->clk = devm_clk_get(&pdev->dev, "dfsdm"); - if (IS_ERR(priv->clk)) { - ret = PTR_ERR(priv->clk); - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "Failed to get clock (%d)\n", ret); - return ret; - } + if (IS_ERR(priv->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk), "Failed to get clock\n"); priv->aclk = devm_clk_get(&pdev->dev, "audio"); if (IS_ERR(priv->aclk)) diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c index 7e5809ba0dee..906436780347 100644 --- a/drivers/iio/dac/stm32-dac-core.c +++ b/drivers/iio/dac/stm32-dac-core.c @@ -150,10 +150,7 @@ static int stm32_dac_probe(struct platform_device *pdev) rst = devm_reset_control_get_optional_exclusive(dev, NULL); if (rst) { if (IS_ERR(rst)) { - ret = PTR_ERR(rst); - if (ret != -EPROBE_DEFER) - dev_err(dev, "reset get failed, %d\n", ret); - + ret = dev_err_probe(dev, PTR_ERR(rst), "reset get failed\n"); goto err_hw_stop; } From patchwork Thu Aug 27 19:26:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741531 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C4C0016B1 for ; Thu, 27 Aug 2020 19:28:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A4D1722CF6 for ; Thu, 27 Aug 2020 19:28:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556506; bh=3+33wDqccjLt1IW1JITAEzv6bEHTJjyXXG+OssmK9rQ=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=oYit7vsxN13F8aUmHXQh5KV8qvhovZU2sbG17+XBXklUEETnl9EALnzB6pzne0Unr odCRei7eATH8M90PNARsfOgEJCKTEGr6FCVZTUpLZwjY1MO8FD10bq5mwnve0Zlo+q hAxZ2NERFEj+DCpyHNfigzrJPAidXDEepcvzS8FA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727077AbgH0T20 (ORCPT ); Thu, 27 Aug 2020 15:28:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:59454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbgH0T2Y (ORCPT ); Thu, 27 Aug 2020 15:28:24 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 74BFA22B4D; Thu, 27 Aug 2020 19:28:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556503; bh=3+33wDqccjLt1IW1JITAEzv6bEHTJjyXXG+OssmK9rQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=0+G/pIC3rpLk7+CqejrJwWKzVKKXn8om7yQs2W/uP1slHC9vF3UjVQJlzIgWYG0lS XCn7bzmnVki6A3zYbqI5fAbm9f+4jfcfKUT6XDRfORWIKEuIxcaIvTwPHFr1nZb63a GiPwwSq+YYgD57ttqO6BDbETNhatSlgSCrfuBgzs= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 09/18] iio: afe: iio-rescale: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:33 +0200 Message-Id: <20200827192642.1725-9-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko --- Changes since v1: 1. Wrap dev_err_probe() lines at 100 character --- drivers/iio/afe/iio-rescale.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iio/afe/iio-rescale.c b/drivers/iio/afe/iio-rescale.c index 69c0f277ada0..8cd9645c50e8 100644 --- a/drivers/iio/afe/iio-rescale.c +++ b/drivers/iio/afe/iio-rescale.c @@ -276,11 +276,8 @@ static int rescale_probe(struct platform_device *pdev) int ret; source = devm_iio_channel_get(dev, NULL); - if (IS_ERR(source)) { - if (PTR_ERR(source) != -EPROBE_DEFER) - dev_err(dev, "failed to get source channel\n"); - return PTR_ERR(source); - } + if (IS_ERR(source)) + return dev_err_probe(dev, PTR_ERR(source), "failed to get source channel\n"); sizeof_ext_info = iio_get_channel_ext_info_count(source); if (sizeof_ext_info) { From patchwork Thu Aug 27 19:26:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741535 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3BDAB16B1 for ; Thu, 27 Aug 2020 19:28:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 233BE22BEA for ; Thu, 27 Aug 2020 19:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556517; bh=JDW+si4kpBNxVKzKilmgyZMG73ode2zg5DMZD3yhgec=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=zia29tiXJ5ldD/Y3kDp8zQ1kVqGsKJwgBvwSd8ZsYAb/LMhduLOQvEt0iP9FvYuAx +5svXEoxMW5KrWCy2P2FaQ8QU0a8uEbx6WomFjS+8Li4YsB+5LFmSv7i/rT1xdSJMl uM10RlZGywN8lvOgBcEXs/Xu7eO1uHrBvlrmXgvk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727839AbgH0T2b (ORCPT ); Thu, 27 Aug 2020 15:28:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:59574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726197AbgH0T2a (ORCPT ); Thu, 27 Aug 2020 15:28:30 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C8AAA207CD; Thu, 27 Aug 2020 19:28:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556510; bh=JDW+si4kpBNxVKzKilmgyZMG73ode2zg5DMZD3yhgec=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ox3ATot+EWc0ejxtrSSuOXWOBfPNHIY48U6UZqrsszLrWw2grNY5Ca0wTT0ZHuYIU PynzLstLMlDwxkT6dMacAIYEjrsGcxd7+HRuK/ZlBlJZEF3S5z5DNTmWpqMPFH0xs8 CZsFrlTBBAwzKmqUzPKYyBoFTMIz2SxrvzqkJ/kE= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 10/18] iio: amplifiers: hmc425a: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:34 +0200 Message-Id: <20200827192642.1725-10-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko --- Changes since v1: 1. Wrap dev_err_probe() lines at 100 character --- drivers/iio/amplifiers/hmc425a.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/iio/amplifiers/hmc425a.c b/drivers/iio/amplifiers/hmc425a.c index 582708924e4f..bde11df4bb9e 100644 --- a/drivers/iio/amplifiers/hmc425a.c +++ b/drivers/iio/amplifiers/hmc425a.c @@ -201,12 +201,8 @@ static int hmc425a_probe(struct platform_device *pdev) st->gain = st->chip_info->default_gain; st->gpios = devm_gpiod_get_array(&pdev->dev, "ctrl", GPIOD_OUT_LOW); - if (IS_ERR(st->gpios)) { - ret = PTR_ERR(st->gpios); - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "failed to get gpios\n"); - return ret; - } + if (IS_ERR(st->gpios)) + return dev_err_probe(&pdev->dev, PTR_ERR(st->gpios), "failed to get gpios\n"); if (st->gpios->ndescs != st->chip_info->num_gpios) { dev_err(&pdev->dev, "%d GPIOs needed to operate\n", From patchwork Thu Aug 27 19:26:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741537 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3A3C614E5 for ; Thu, 27 Aug 2020 19:28:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1915B22CF6 for ; Thu, 27 Aug 2020 19:28:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556518; bh=X1W0PzSz8JAQ2Wim9RQvp9YS6C8n7Io0DSsH6zFBFQc=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=UgdOX4fCu1ctvupn/GBhbZ86Fn3GHpxo+/ZfZTmv6w+7j6jLb5hJ6iU2+B3ff9zSP G7EFzR21q7M8Nj5kFf13wGZP4sC70uPi8G65ZQ3As3BpqVDb9qNanYelNav9ERkqAh itrqFpTBGXt/3g5+2tzqaHQ34hM6U4S+9VXKJSqE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726197AbgH0T2h (ORCPT ); Thu, 27 Aug 2020 15:28:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:59764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726266AbgH0T2h (ORCPT ); Thu, 27 Aug 2020 15:28:37 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6FD6322CAF; Thu, 27 Aug 2020 19:28:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556516; bh=X1W0PzSz8JAQ2Wim9RQvp9YS6C8n7Io0DSsH6zFBFQc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Gsfd2caeBHKY0vWdsUPo4XNAU+ooS5fvtQ2z5WHLpESCCzoR689Z9u9buf1i5PARP AVNXERHSAWrKZDJ5YR67LdHEDzY74qCW772IKe3wcoZj2OB23Qps8pvMkH0xsoyui8 PmBIa4o9PfYpbUd/BL691P4eUcDuSfG88hTLJugY= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 11/18] iio: chemical: scd30: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:35 +0200 Message-Id: <20200827192642.1725-11-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Acked-by: Tomasz Duszynski Reviewed-by: Andy Shevchenko --- Changes since v1: 1. Wrap dev_err_probe() lines at 100 character 2. Add Ack --- drivers/iio/chemical/scd30_core.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c index eac76972f83e..4d0d798c7cd3 100644 --- a/drivers/iio/chemical/scd30_core.c +++ b/drivers/iio/chemical/scd30_core.c @@ -705,13 +705,8 @@ int scd30_probe(struct device *dev, int irq, const char *name, void *priv, indio_dev->available_scan_masks = scd30_scan_masks; state->vdd = devm_regulator_get(dev, "vdd"); - if (IS_ERR(state->vdd)) { - if (PTR_ERR(state->vdd) == -EPROBE_DEFER) - return -EPROBE_DEFER; - - dev_err(dev, "failed to get regulator\n"); - return PTR_ERR(state->vdd); - } + if (IS_ERR(state->vdd)) + return dev_err_probe(dev, PTR_ERR(state->vdd), "failed to get regulator\n"); ret = regulator_enable(state->vdd); if (ret) From patchwork Thu Aug 27 19:26:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741547 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B482F14F6 for ; Thu, 27 Aug 2020 19:28:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 91F2322CF6 for ; Thu, 27 Aug 2020 19:28:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556524; bh=T5xvC4E4MsMwGEUX1i7xJJFIfrS9fUuZLYOkjgS9wJs=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=e2lu0SthhLMkr44tTWzg4GIDpzbXm1yiT3eWRmARk7h71x86r2qxgHDMoS40tC4MX o/wqmN8YPf/l1cnEyMe/QbVbrLqzu6Qlsh4V1po/Czm/an7fPWxPEtj1KFMODkEZrC IS+ZdWxZrkVv+Gmh14jaA+zkuZ+SuDk9ZIbZzbZc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726858AbgH0T2o (ORCPT ); Thu, 27 Aug 2020 15:28:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:59974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726266AbgH0T2n (ORCPT ); Thu, 27 Aug 2020 15:28:43 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 12F0122B4D; Thu, 27 Aug 2020 19:28:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556523; bh=T5xvC4E4MsMwGEUX1i7xJJFIfrS9fUuZLYOkjgS9wJs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=em6vO2OwZSB6kKK/S2ezhIGI2mfeS6rsgTIRju9Qabve7CfOTbj7wTG8NQXHDrhoB LJi16xE4xrJLYdEiSC9v+RYNMd4jSluKkFZBGuNEkYZ1BN/UB7qokxNWc0Fd4y6XZ+ Tdy6RbrclSrZxz3+tGvj5p2iOfiCxYtAjmLOesFI= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 12/18] iio: dac: dpot-dac: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:36 +0200 Message-Id: <20200827192642.1725-12-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko --- drivers/iio/dac/dpot-dac.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/iio/dac/dpot-dac.c b/drivers/iio/dac/dpot-dac.c index be61c3b01e8b..2258535b8a42 100644 --- a/drivers/iio/dac/dpot-dac.c +++ b/drivers/iio/dac/dpot-dac.c @@ -183,18 +183,14 @@ static int dpot_dac_probe(struct platform_device *pdev) indio_dev->num_channels = 1; dac->vref = devm_regulator_get(dev, "vref"); - if (IS_ERR(dac->vref)) { - if (PTR_ERR(dac->vref) != -EPROBE_DEFER) - dev_err(&pdev->dev, "failed to get vref regulator\n"); - return PTR_ERR(dac->vref); - } + if (IS_ERR(dac->vref)) + return dev_err_probe(&pdev->dev, PTR_ERR(dac->vref), + "failed to get vref regulator\n"); dac->dpot = devm_iio_channel_get(dev, "dpot"); - if (IS_ERR(dac->dpot)) { - if (PTR_ERR(dac->dpot) != -EPROBE_DEFER) - dev_err(dev, "failed to get dpot input channel\n"); - return PTR_ERR(dac->dpot); - } + if (IS_ERR(dac->dpot)) + return dev_err_probe(&pdev->dev, PTR_ERR(dac->dpot), + "failed to get dpot input channel\n"); ret = iio_get_channel_type(dac->dpot, &type); if (ret < 0) From patchwork Thu Aug 27 19:26:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741551 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 624A414E5 for ; Thu, 27 Aug 2020 19:28:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49E332087E for ; Thu, 27 Aug 2020 19:28:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556535; bh=Qo3LbyvmpBGQKG4D/yZypYAesoTm5jVx4P7R/QfNlcY=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=vCpP+D0788S/NHWFJeJvjztD2d5Nip76+bpvU03cm6ArkCoDZBry+jlk9hahPJVAy hjtjzmr0CEfHjMI6U15IVSi+JdgiiK17ky1W0z5YLHOH3IRqh20j9vhx/0JwJQTl7Q NpuwBXf7kee7iTNUecFBRE4Or5ONvTA8jrg85BMQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727838AbgH0T2z (ORCPT ); Thu, 27 Aug 2020 15:28:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:60180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726266AbgH0T2y (ORCPT ); Thu, 27 Aug 2020 15:28:54 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EA93322CB3; Thu, 27 Aug 2020 19:28:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556533; bh=Qo3LbyvmpBGQKG4D/yZypYAesoTm5jVx4P7R/QfNlcY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Y99Kjf7Xm6QCUzRr+BYYbALcmO7/pKGdLuCAx67ZeebvUt6o5F377GUttN3Tlbg0j 5pKeKWTeBlR9BwzZLH4XLu9IYFs/wqq28tfWla5JkBdyT1xW/xwzWzrMQQGGhEBB8a zu8suWm3kKlzE9knlCQRuPK/tRbjK56uwxELPoRY= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 13/18] iio: imu: inv_mpu6050: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:37 +0200 Message-Id: <20200827192642.1725-13-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko Reviewed-by: Jean-Baptiste Maneyrol --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index 3fee3947f772..18a1898e3e34 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -1475,22 +1475,14 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name, } st->vdd_supply = devm_regulator_get(dev, "vdd"); - if (IS_ERR(st->vdd_supply)) { - if (PTR_ERR(st->vdd_supply) != -EPROBE_DEFER) - dev_err(dev, "Failed to get vdd regulator %d\n", - (int)PTR_ERR(st->vdd_supply)); - - return PTR_ERR(st->vdd_supply); - } + if (IS_ERR(st->vdd_supply)) + return dev_err_probe(dev, PTR_ERR(st->vdd_supply), + "Failed to get vdd regulator\n"); st->vddio_supply = devm_regulator_get(dev, "vddio"); - if (IS_ERR(st->vddio_supply)) { - if (PTR_ERR(st->vddio_supply) != -EPROBE_DEFER) - dev_err(dev, "Failed to get vddio regulator %d\n", - (int)PTR_ERR(st->vddio_supply)); - - return PTR_ERR(st->vddio_supply); - } + if (IS_ERR(st->vddio_supply)) + return dev_err_probe(dev, PTR_ERR(st->vddio_supply), + "Failed to get vddio regulator\n"); result = regulator_enable(st->vdd_supply); if (result) { From patchwork Thu Aug 27 19:26:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741557 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A580B14F6 for ; Thu, 27 Aug 2020 19:29:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 848D322CBB for ; Thu, 27 Aug 2020 19:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556540; bh=L62NHGTlHRmxfW0UXMzF8rz6Eg4TzDjh28d5OkWRb1E=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=lHsSw6ziYXjJXHlkSeJD0lRSv2AHMuLue1Q8sDdGuU6LIEf2qCI+exVKuRQ4m1vjY 2HeB4x2RdnEGItUqdD0ckMlsfsvuD9f72MkYBusk6XGbyJXX2HjxmJ8dozRsgFWvgN j/1r5v9arX43MUsSvfzbZY6PQtke6jK4acgdrk34= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727944AbgH0T27 (ORCPT ); Thu, 27 Aug 2020 15:28:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:60334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726266AbgH0T27 (ORCPT ); Thu, 27 Aug 2020 15:28:59 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0456C22BEA; Thu, 27 Aug 2020 19:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556538; bh=L62NHGTlHRmxfW0UXMzF8rz6Eg4TzDjh28d5OkWRb1E=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dypLeHzwJtWfva9iMb/CcdNUc2pu2c+Jk1dot9i4t33oTA3mnp6o2NBOSel6xlXyo JlwiVLu4IQCVbrUcq5Ic/mIlDqSwro2b1/M+rTxot1HVEejU6BH+gcS0MgZnwUqdQL PT8PE5zj4CW42zW6k9Y/7634muPb88zhbAwy3sTk= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 14/18] iio: light: isl29018: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:38 +0200 Message-Id: <20200827192642.1725-14-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko --- drivers/iio/light/isl29018.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/iio/light/isl29018.c b/drivers/iio/light/isl29018.c index ac8ad0f32689..2689867467a8 100644 --- a/drivers/iio/light/isl29018.c +++ b/drivers/iio/light/isl29018.c @@ -746,12 +746,9 @@ static int isl29018_probe(struct i2c_client *client, chip->suspended = false; chip->vcc_reg = devm_regulator_get(&client->dev, "vcc"); - if (IS_ERR(chip->vcc_reg)) { - err = PTR_ERR(chip->vcc_reg); - if (err != -EPROBE_DEFER) - dev_err(&client->dev, "failed to get VCC regulator!\n"); - return err; - } + if (IS_ERR(chip->vcc_reg)) + return dev_err_probe(&client->dev, PTR_ERR(chip->vcc_reg), + "failed to get VCC regulator!\n"); err = regulator_enable(chip->vcc_reg); if (err) { From patchwork Thu Aug 27 19:26:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741563 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 13E3014E5 for ; Thu, 27 Aug 2020 19:29:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EFD2322B4D for ; Thu, 27 Aug 2020 19:29:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556552; bh=GnutIt+TO9LZh41tsda2ONgqol06Pt/b5uPr/laCiio=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=0/mVT+fliHwUYVxYfq88F/k+0ElYvxy/FP6bLctNZaPHDE/TjUFjKK2jvAnjI2aMx J0iji1GKVdpyqp+0s1XsXciByRKTrAsZNBcWTp1RJPdyaHOHgs/j6Bfv08d7HQYGp1 S1y3+dzq7wYZLZnW7FekTMuhYHxUh9tWwlV4sABo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726706AbgH0T3L (ORCPT ); Thu, 27 Aug 2020 15:29:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:60544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726266AbgH0T3J (ORCPT ); Thu, 27 Aug 2020 15:29:09 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EA8CF207CD; Thu, 27 Aug 2020 19:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556549; bh=GnutIt+TO9LZh41tsda2ONgqol06Pt/b5uPr/laCiio=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JIu9t4iB3t4wASTcUjY+KceZdOEiZKWk++pSkZ/EivlZb8x/1bupBD05Oh/UFHd2R E3MVI7CW3Ryup1nX6vknyd2OanoimFf+ss9/qwEpSYPzs0u7AL4C0zrRuSYR5inGY9 qV7eDaQkS4Cfdjs3tykzTy1i3jWymjkY9q/uPQlI= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 15/18] iio: light: tsl2772: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:39 +0200 Message-Id: <20200827192642.1725-15-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko --- Changes since v1: 1. Wrap dev_err_probe() lines at 100 character --- drivers/iio/light/tsl2772.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/iio/light/tsl2772.c b/drivers/iio/light/tsl2772.c index 735399405417..d79205361dfa 100644 --- a/drivers/iio/light/tsl2772.c +++ b/drivers/iio/light/tsl2772.c @@ -1776,14 +1776,8 @@ static int tsl2772_probe(struct i2c_client *clientp, ret = devm_regulator_bulk_get(&clientp->dev, ARRAY_SIZE(chip->supplies), chip->supplies); - if (ret < 0) { - if (ret != -EPROBE_DEFER) - dev_err(&clientp->dev, - "Failed to get regulators: %d\n", - ret); - - return ret; - } + if (ret < 0) + return dev_err_probe(&clientp->dev, ret, "Failed to get regulators\n"); ret = regulator_bulk_enable(ARRAY_SIZE(chip->supplies), chip->supplies); if (ret < 0) { From patchwork Thu Aug 27 19:26:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741567 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A97914E5 for ; Thu, 27 Aug 2020 19:29:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A06C22BEA for ; Thu, 27 Aug 2020 19:29:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556557; bh=IwI1yLwibpqLSvKtz6KPbHm1WiYgsAWbmgv2aJsQJOw=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=a4Z65kIS5ymCyF8ei326UB+e1cCZOADyzlTwvxcpK1LXhltrh8tZB8vHHz981Es3S o225tguN8n7QNfGqIcEslWoieU6tv+h/9HkpLnCOvtiCwmlG5Tyd7dn8uqLUWYQzkY yxjc1iEj9i/ws1wRlDFJSZixLhquhd6uKMqKrcDE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727993AbgH0T3R (ORCPT ); Thu, 27 Aug 2020 15:29:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:60672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726834AbgH0T3Q (ORCPT ); Thu, 27 Aug 2020 15:29:16 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D6488207DF; Thu, 27 Aug 2020 19:29:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556556; bh=IwI1yLwibpqLSvKtz6KPbHm1WiYgsAWbmgv2aJsQJOw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vtbotEUI+bvibX2D43FsTLH26PlKZEy7m0cG1phXdOGdBCIGjdY1KJ4y4lcaKSOtI Ci3M4WhVLHIqI9iQISXKSVhPBVS9GAg8rncntyQQrE6aznu7Zk3Yrjk8CU/AiQReJm exZY8KUhxGicwDLMwoIAOWIjnRmdHNy2y4bnx9rs= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 16/18] iio: magnetometer: ak8974: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:40 +0200 Message-Id: <20200827192642.1725-16-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko Acked-by: Linus Walleij --- Changes since v1: 1. Wrap dev_err_probe() lines at 100 character --- drivers/iio/magnetometer/ak8974.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c index cbb44e401c0a..548c686e29d6 100644 --- a/drivers/iio/magnetometer/ak8974.c +++ b/drivers/iio/magnetometer/ak8974.c @@ -843,15 +843,8 @@ static int ak8974_probe(struct i2c_client *i2c, ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(ak8974->regs), ak8974->regs); - if (ret < 0) { - if (ret != -EPROBE_DEFER) - dev_err(&i2c->dev, "cannot get regulators: %d\n", ret); - else - dev_dbg(&i2c->dev, - "regulators unavailable, deferring probe\n"); - - return ret; - } + if (ret < 0) + return dev_err_probe(&i2c->dev, ret, "cannot get regulators\n"); ret = regulator_bulk_enable(ARRAY_SIZE(ak8974->regs), ak8974->regs); if (ret < 0) { From patchwork Thu Aug 27 19:26:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741573 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6C24316B1 for ; Thu, 27 Aug 2020 19:29:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 51FE222BEB for ; Thu, 27 Aug 2020 19:29:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556565; bh=L3YrhCMnqGFLBGZtgx3mmLK0mDFYfcCW33WYEntFHMQ=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=cmKdIx95/cLFh9OR8LkhHjzqs7liFAR08PjO6fcCfKlPzZ+ldMY58RdTdvxh5bSbs b9/g/86wGqHduYUHsBjLOW68P8irCALbY/P53CBKy/Zfy8AwzqM1ELJ5VSjxXF+f0L +nmekwK417XhFBUkQttjZMWmyXH9eXLZZRIWrZRk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727992AbgH0T3X (ORCPT ); Thu, 27 Aug 2020 15:29:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:60814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726834AbgH0T3X (ORCPT ); Thu, 27 Aug 2020 15:29:23 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A112822BF3; Thu, 27 Aug 2020 19:29:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556562; bh=L3YrhCMnqGFLBGZtgx3mmLK0mDFYfcCW33WYEntFHMQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=b18cj+z0Suxulc95uK9i05n32lcc+VIW61lcP5GTiE/XgzMhud+9qThtNtVcCD7QV iQmafXDgfBvEG+AwEg7tk5KVdZ4gRvlqXA3+WWVuHZFipsvsf5bdy0UJx4oEEdzDxn U63gRzoBajElqm7oqvtVNwH8rEe3uW/exDkLjxjg= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 17/18] iio: magnetometer: mag3110: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:41 +0200 Message-Id: <20200827192642.1725-17-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko --- drivers/iio/magnetometer/mag3110.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c index 4d305a21c379..838b13c8bb3d 100644 --- a/drivers/iio/magnetometer/mag3110.c +++ b/drivers/iio/magnetometer/mag3110.c @@ -476,22 +476,14 @@ static int mag3110_probe(struct i2c_client *client, data = iio_priv(indio_dev); data->vdd_reg = devm_regulator_get(&client->dev, "vdd"); - if (IS_ERR(data->vdd_reg)) { - if (PTR_ERR(data->vdd_reg) == -EPROBE_DEFER) - return -EPROBE_DEFER; - - dev_err(&client->dev, "failed to get VDD regulator!\n"); - return PTR_ERR(data->vdd_reg); - } + if (IS_ERR(data->vdd_reg)) + return dev_err_probe(&client->dev, PTR_ERR(data->vdd_reg), + "failed to get VDD regulator!\n"); data->vddio_reg = devm_regulator_get(&client->dev, "vddio"); - if (IS_ERR(data->vddio_reg)) { - if (PTR_ERR(data->vddio_reg) == -EPROBE_DEFER) - return -EPROBE_DEFER; - - dev_err(&client->dev, "failed to get VDDIO regulator!\n"); - return PTR_ERR(data->vddio_reg); - } + if (IS_ERR(data->vddio_reg)) + return dev_err_probe(&client->dev, PTR_ERR(data->vddio_reg), + "failed to get VDDIO regulator!\n"); ret = regulator_enable(data->vdd_reg); if (ret) { From patchwork Thu Aug 27 19:26:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11741577 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6327314E5 for ; Thu, 27 Aug 2020 19:29:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4095D2087E for ; Thu, 27 Aug 2020 19:29:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556574; bh=muQ+YCp+Vwe8eKdaduBpNI5ws078auP+0FO7/EUefYM=; h=From:To:Subject:Date:In-Reply-To:References:List-ID:From; b=XKIzuKfECxicu6XDK9DwV0SYnuyQvz+AuS5SHjm8xAdZcbt/TNo4jTVj7Faj1djhe 1pawFCxddbhvoosAnhddl6gyectupPXZ+oY+xgJskRgkjize3D4ehueOQWjl8tVoi3 MxA4jOSU2GtzOepjC66XkSNUpqH1m1eXni3ha0Gs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726400AbgH0T3d (ORCPT ); Thu, 27 Aug 2020 15:29:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:60954 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726834AbgH0T3d (ORCPT ); Thu, 27 Aug 2020 15:29:33 -0400 Received: from localhost.localdomain (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E9D5122BEA; Thu, 27 Aug 2020 19:29:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598556572; bh=muQ+YCp+Vwe8eKdaduBpNI5ws078auP+0FO7/EUefYM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=a+3rvvU1Eu9UZntSAuNuiPQ8m9m6YcjmxtK5A0z5CZy9WfsYSBgB35x0Z0GK65p8Z vN3pos0/p5be4YAE5dhcmPgMKkzqJFbMoMXtZtGHJJd7EyZBxEcamfW6FOU8dyTr37 POs9e9xoOLlfXFjvkBaae6A50Uo9wI4lBFaj+D58= From: Krzysztof Kozlowski To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Peter Rosin , Kukjin Kim , Krzysztof Kozlowski , Michael Hennerich , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Marek Vasut , Maxime Coquelin , Alexandre Torgue , Beniamin Bia , Tomasz Duszynski , Linus Walleij , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 18/18] iio: magnetometer: iio-mux: Simplify with dev_err_probe() Date: Thu, 27 Aug 2020 21:26:42 +0200 Message-Id: <20200827192642.1725-18-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827192642.1725-1-krzk@kernel.org> References: <20200827192642.1725-1-krzk@kernel.org> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Andy Shevchenko --- drivers/iio/multiplexer/iio-mux.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iio/multiplexer/iio-mux.c b/drivers/iio/multiplexer/iio-mux.c index 6910218fdb00..d219d4a86657 100644 --- a/drivers/iio/multiplexer/iio-mux.c +++ b/drivers/iio/multiplexer/iio-mux.c @@ -354,11 +354,8 @@ static int mux_probe(struct platform_device *pdev) return -ENODEV; parent = devm_iio_channel_get(dev, "parent"); - if (IS_ERR(parent)) { - if (PTR_ERR(parent) != -EPROBE_DEFER) - dev_err(dev, "failed to get parent channel\n"); - return PTR_ERR(parent); - } + if (IS_ERR(parent)) + return dev_err_probe(dev, PTR_ERR(parent), "failed to get parent channel\n"); sizeof_ext_info = iio_get_channel_ext_info_count(parent); if (sizeof_ext_info) {