From patchwork Mon Sep 27 08:26:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cai,Huoqing" X-Patchwork-Id: 12519391 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67916C433EF for ; Mon, 27 Sep 2021 08:26:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4671860F70 for ; Mon, 27 Sep 2021 08:26:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233381AbhI0I17 (ORCPT ); Mon, 27 Sep 2021 04:27:59 -0400 Received: from mx22.baidu.com ([220.181.50.185]:60562 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233337AbhI0I16 (ORCPT ); Mon, 27 Sep 2021 04:27:58 -0400 Received: from BC-Mail-Ex16.internal.baidu.com (unknown [172.31.51.56]) by Forcepoint Email with ESMTPS id 513225E8B226CE5ED1B8; Mon, 27 Sep 2021 16:26:19 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex16.internal.baidu.com (172.31.51.56) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Mon, 27 Sep 2021 16:26:18 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 27 Sep 2021 16:26:18 +0800 From: Cai Huoqing To: CC: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , "Vladimir Zapolskiy" , Marcus Folkesson , Maxime Coquelin , Alexandre Torgue , , , , Subject: [PATCH 1/8] iio: dac: ad8801: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:26:00 +0800 Message-ID: <20210927082608.859-1-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex15.internal.baidu.com (172.31.51.55) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing --- drivers/iio/dac/ad8801.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/iio/dac/ad8801.c b/drivers/iio/dac/ad8801.c index 6354b7c8f052..8acb9fee273c 100644 --- a/drivers/iio/dac/ad8801.c +++ b/drivers/iio/dac/ad8801.c @@ -123,10 +123,9 @@ static int ad8801_probe(struct spi_device *spi) id = spi_get_device_id(spi); state->vrefh_reg = devm_regulator_get(&spi->dev, "vrefh"); - if (IS_ERR(state->vrefh_reg)) { - dev_err(&spi->dev, "Vrefh regulator not specified\n"); - return PTR_ERR(state->vrefh_reg); - } + if (IS_ERR(state->vrefh_reg)) + return dev_err_probe(&spi->dev, PTR_ERR(state->vrefh_reg), + "Vrefh regulator not specified\n"); ret = regulator_enable(state->vrefh_reg); if (ret) { @@ -146,15 +145,15 @@ static int ad8801_probe(struct spi_device *spi) if (id->driver_data == ID_AD8803) { state->vrefl_reg = devm_regulator_get(&spi->dev, "vrefl"); if (IS_ERR(state->vrefl_reg)) { - dev_err(&spi->dev, "Vrefl regulator not specified\n"); - ret = PTR_ERR(state->vrefl_reg); + ret = dev_err_probe(&spi->dev, PTR_ERR(state->vrefl_reg), + "Vrefl regulator not specified\n"); goto error_disable_vrefh_reg; } ret = regulator_enable(state->vrefl_reg); if (ret) { - dev_err(&spi->dev, "Failed to enable vrefl regulator: %d\n", - ret); + dev_err(&spi->dev, + "Failed to enable vrefl regulator: %d\n", ret); goto error_disable_vrefh_reg; } From patchwork Mon Sep 27 08:26:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cai,Huoqing" X-Patchwork-Id: 12519393 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C953C433F5 for ; Mon, 27 Sep 2021 08:26:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7DF0860F70 for ; Mon, 27 Sep 2021 08:26:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233471AbhI0I2C (ORCPT ); Mon, 27 Sep 2021 04:28:02 -0400 Received: from mx24.baidu.com ([111.206.215.185]:60684 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233469AbhI0I2B (ORCPT ); Mon, 27 Sep 2021 04:28:01 -0400 Received: from BC-Mail-HQEX01.internal.baidu.com (unknown [172.31.51.57]) by Forcepoint Email with ESMTPS id 6FE43165FEE3BA9E5AD9; Mon, 27 Sep 2021 16:26:22 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-HQEX01.internal.baidu.com (172.31.51.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Mon, 27 Sep 2021 16:26:22 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 27 Sep 2021 16:26:21 +0800 From: Cai Huoqing To: CC: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , "Vladimir Zapolskiy" , Marcus Folkesson , Maxime Coquelin , Alexandre Torgue , , , , Subject: [PATCH 2/8] iio: dac: lpc18xx_dac: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:26:01 +0800 Message-ID: <20210927082608.859-2-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210927082608.859-1-caihuoqing@baidu.com> References: <20210927082608.859-1-caihuoqing@baidu.com> MIME-Version: 1.0 X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex15.internal.baidu.com (172.31.51.55) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing --- drivers/iio/dac/lpc18xx_dac.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/iio/dac/lpc18xx_dac.c b/drivers/iio/dac/lpc18xx_dac.c index 9e38607a189e..afb37647b035 100644 --- a/drivers/iio/dac/lpc18xx_dac.c +++ b/drivers/iio/dac/lpc18xx_dac.c @@ -121,16 +121,16 @@ static int lpc18xx_dac_probe(struct platform_device *pdev) return PTR_ERR(dac->base); dac->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(dac->clk)) { - dev_err(&pdev->dev, "error getting clock\n"); - return PTR_ERR(dac->clk); - } + if (IS_ERR(dac->clk)) + return dev_err_probe(&pdev->dev, + PTR_ERR(dac->clk), + "error getting clock\n"); dac->vref = devm_regulator_get(&pdev->dev, "vref"); - if (IS_ERR(dac->vref)) { - dev_err(&pdev->dev, "error getting regulator\n"); - return PTR_ERR(dac->vref); - } + if (IS_ERR(dac->vref)) + return dev_err_probe(&pdev->dev, + PTR_ERR(dac->vref), + "error getting regulator\n"); indio_dev->name = dev_name(&pdev->dev); indio_dev->info = &lpc18xx_dac_info; From patchwork Mon Sep 27 08:26:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cai,Huoqing" X-Patchwork-Id: 12519461 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A037BC433F5 for ; Mon, 27 Sep 2021 09:13:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 87F50610E8 for ; Mon, 27 Sep 2021 09:13:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233616AbhI0JPD (ORCPT ); Mon, 27 Sep 2021 05:15:03 -0400 Received: from mx24.baidu.com ([111.206.215.185]:32774 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233519AbhI0JPC (ORCPT ); Mon, 27 Sep 2021 05:15:02 -0400 Received: from Bc-Mail-Ex13.internal.baidu.com (unknown [172.31.51.53]) by Forcepoint Email with ESMTPS id 427D5A655954AD77177D; Mon, 27 Sep 2021 16:26:25 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by Bc-Mail-Ex13.internal.baidu.com (172.31.51.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Mon, 27 Sep 2021 16:26:25 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 27 Sep 2021 16:26:24 +0800 From: Cai Huoqing To: CC: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , "Vladimir Zapolskiy" , Marcus Folkesson , Maxime Coquelin , Alexandre Torgue , , , , Subject: [PATCH 3/8] iio: dac: ltc1660: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:26:02 +0800 Message-ID: <20210927082608.859-3-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210927082608.859-1-caihuoqing@baidu.com> References: <20210927082608.859-1-caihuoqing@baidu.com> MIME-Version: 1.0 X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex15.internal.baidu.com (172.31.51.55) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing --- drivers/iio/dac/ltc1660.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/dac/ltc1660.c b/drivers/iio/dac/ltc1660.c index dc10188540ca..f6ec9bf5815e 100644 --- a/drivers/iio/dac/ltc1660.c +++ b/drivers/iio/dac/ltc1660.c @@ -172,10 +172,9 @@ static int ltc1660_probe(struct spi_device *spi) } priv->vref_reg = devm_regulator_get(&spi->dev, "vref"); - if (IS_ERR(priv->vref_reg)) { - dev_err(&spi->dev, "vref regulator not specified\n"); - return PTR_ERR(priv->vref_reg); - } + if (IS_ERR(priv->vref_reg)) + return dev_err_probe(&spi->dev, PTR_ERR(priv->vref_reg), + "vref regulator not specified\n"); ret = regulator_enable(priv->vref_reg); if (ret) { From patchwork Mon Sep 27 08:26:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cai,Huoqing" X-Patchwork-Id: 12519395 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48354C433EF for ; Mon, 27 Sep 2021 08:26:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C98E60F70 for ; Mon, 27 Sep 2021 08:26:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233487AbhI0I2H (ORCPT ); Mon, 27 Sep 2021 04:28:07 -0400 Received: from mx24.baidu.com ([111.206.215.185]:60912 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233499AbhI0I2H (ORCPT ); Mon, 27 Sep 2021 04:28:07 -0400 Received: from BC-Mail-Ex10.internal.baidu.com (unknown [172.31.51.50]) by Forcepoint Email with ESMTPS id 42B7D2C1A4CE0750EF77; Mon, 27 Sep 2021 16:26:28 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex10.internal.baidu.com (172.31.51.50) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Mon, 27 Sep 2021 16:26:27 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 27 Sep 2021 16:26:27 +0800 From: Cai Huoqing To: CC: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , "Vladimir Zapolskiy" , Marcus Folkesson , Maxime Coquelin , Alexandre Torgue , , , , Subject: [PATCH 4/8] iio: dac: ds4424: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:26:03 +0800 Message-ID: <20210927082608.859-4-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210927082608.859-1-caihuoqing@baidu.com> References: <20210927082608.859-1-caihuoqing@baidu.com> MIME-Version: 1.0 X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex15.internal.baidu.com (172.31.51.55) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing --- drivers/iio/dac/ds4424.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/iio/dac/ds4424.c b/drivers/iio/dac/ds4424.c index 79527fbc250a..5a5e967b0be4 100644 --- a/drivers/iio/dac/ds4424.c +++ b/drivers/iio/dac/ds4424.c @@ -232,12 +232,9 @@ static int ds4424_probe(struct i2c_client *client, indio_dev->name = id->name; data->vcc_reg = devm_regulator_get(&client->dev, "vcc"); - if (IS_ERR(data->vcc_reg)) { - dev_err(&client->dev, - "Failed to get vcc-supply regulator. err: %ld\n", - PTR_ERR(data->vcc_reg)); - return PTR_ERR(data->vcc_reg); - } + if (IS_ERR(data->vcc_reg)) + return dev_err_probe(&client->dev, PTR_ERR(data->vcc_reg), + "Failed to get vcc-supply regulator.\n"); mutex_init(&data->lock); ret = regulator_enable(data->vcc_reg); From patchwork Mon Sep 27 08:26:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cai,Huoqing" X-Patchwork-Id: 12519397 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 461C4C433F5 for ; Mon, 27 Sep 2021 08:26:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2FC1560F94 for ; Mon, 27 Sep 2021 08:26:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233516AbhI0I2O (ORCPT ); Mon, 27 Sep 2021 04:28:14 -0400 Received: from mx24.baidu.com ([111.206.215.185]:32806 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233469AbhI0I2K (ORCPT ); Mon, 27 Sep 2021 04:28:10 -0400 Received: from BC-Mail-Ex14.internal.baidu.com (unknown [172.31.51.54]) by Forcepoint Email with ESMTPS id 1E508C0E9D8551C63117; Mon, 27 Sep 2021 16:26:31 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex14.internal.baidu.com (172.31.51.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Mon, 27 Sep 2021 16:26:30 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 27 Sep 2021 16:26:29 +0800 From: Cai Huoqing To: CC: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , "Vladimir Zapolskiy" , Marcus Folkesson , Maxime Coquelin , Alexandre Torgue , , , , Subject: [PATCH 5/8] iio: dac: max5821: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:26:04 +0800 Message-ID: <20210927082608.859-5-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210927082608.859-1-caihuoqing@baidu.com> References: <20210927082608.859-1-caihuoqing@baidu.com> MIME-Version: 1.0 X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex15.internal.baidu.com (172.31.51.55) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing --- drivers/iio/dac/max5821.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/iio/dac/max5821.c b/drivers/iio/dac/max5821.c index bd0b7f361154..7da4710a6408 100644 --- a/drivers/iio/dac/max5821.c +++ b/drivers/iio/dac/max5821.c @@ -321,12 +321,9 @@ static int max5821_probe(struct i2c_client *client, } data->vref_reg = devm_regulator_get(&client->dev, "vref"); - if (IS_ERR(data->vref_reg)) { - ret = PTR_ERR(data->vref_reg); - dev_err(&client->dev, - "Failed to get vref regulator: %d\n", ret); - return ret; - } + if (IS_ERR(data->vref_reg)) + return dev_err_probe(&client->dev, PTR_ERR(data->vref_reg), + "Failed to get vref regulator\n"); ret = regulator_enable(data->vref_reg); if (ret) { From patchwork Mon Sep 27 08:26:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cai,Huoqing" X-Patchwork-Id: 12519399 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 400ADC4332F for ; Mon, 27 Sep 2021 08:26:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 26A2760EC0 for ; Mon, 27 Sep 2021 08:26:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233506AbhI0I2S (ORCPT ); Mon, 27 Sep 2021 04:28:18 -0400 Received: from mx24.baidu.com ([111.206.215.185]:32914 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233511AbhI0I2N (ORCPT ); Mon, 27 Sep 2021 04:28:13 -0400 Received: from BC-Mail-Ex12.internal.baidu.com (unknown [172.31.51.52]) by Forcepoint Email with ESMTPS id 2257EEC0622210DDD983; Mon, 27 Sep 2021 16:26:34 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex12.internal.baidu.com (172.31.51.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Mon, 27 Sep 2021 16:26:33 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 27 Sep 2021 16:26:32 +0800 From: Cai Huoqing To: CC: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , "Vladimir Zapolskiy" , Marcus Folkesson , Maxime Coquelin , Alexandre Torgue , , , , Subject: [PATCH 6/8] iio: dac: mcp4922: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:26:05 +0800 Message-ID: <20210927082608.859-6-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210927082608.859-1-caihuoqing@baidu.com> References: <20210927082608.859-1-caihuoqing@baidu.com> MIME-Version: 1.0 X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex15.internal.baidu.com (172.31.51.55) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing --- drivers/iio/dac/mcp4922.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/dac/mcp4922.c b/drivers/iio/dac/mcp4922.c index c4e430b4050e..0ae414ee1716 100644 --- a/drivers/iio/dac/mcp4922.c +++ b/drivers/iio/dac/mcp4922.c @@ -130,10 +130,9 @@ static int mcp4922_probe(struct spi_device *spi) state = iio_priv(indio_dev); state->spi = spi; state->vref_reg = devm_regulator_get(&spi->dev, "vref"); - if (IS_ERR(state->vref_reg)) { - dev_err(&spi->dev, "Vref regulator not specified\n"); - return PTR_ERR(state->vref_reg); - } + if (IS_ERR(state->vref_reg)) + return dev_err_probe(&spi->dev, PTR_ERR(state->vref_reg), + "Vref regulator not specified\n"); ret = regulator_enable(state->vref_reg); if (ret) { From patchwork Mon Sep 27 08:26:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cai,Huoqing" X-Patchwork-Id: 12519401 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1F51C43217 for ; Mon, 27 Sep 2021 08:26:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB26F60EC0 for ; Mon, 27 Sep 2021 08:26:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233509AbhI0I2T (ORCPT ); Mon, 27 Sep 2021 04:28:19 -0400 Received: from mx24.baidu.com ([111.206.215.185]:32806 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233499AbhI0I2P (ORCPT ); Mon, 27 Sep 2021 04:28:15 -0400 Received: from BC-Mail-Ex11.internal.baidu.com (unknown [172.31.51.51]) by Forcepoint Email with ESMTPS id 0E64D81E755B750A497E; Mon, 27 Sep 2021 16:26:37 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex11.internal.baidu.com (172.31.51.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Mon, 27 Sep 2021 16:26:36 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 27 Sep 2021 16:26:35 +0800 From: Cai Huoqing To: CC: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , "Vladimir Zapolskiy" , Marcus Folkesson , Maxime Coquelin , Alexandre Torgue , , , , Subject: [PATCH 7/8] iio: dac: stm32-dac: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:26:06 +0800 Message-ID: <20210927082608.859-7-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210927082608.859-1-caihuoqing@baidu.com> References: <20210927082608.859-1-caihuoqing@baidu.com> MIME-Version: 1.0 X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex15.internal.baidu.com (172.31.51.55) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing --- drivers/iio/dac/stm32-dac-core.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c index 9a6a68b11b2a..bd7a3b20e645 100644 --- a/drivers/iio/dac/stm32-dac-core.c +++ b/drivers/iio/dac/stm32-dac-core.c @@ -116,18 +116,12 @@ static int stm32_dac_probe(struct platform_device *pdev) priv->common.regmap = regmap; priv->pclk = devm_clk_get(dev, "pclk"); - if (IS_ERR(priv->pclk)) { - ret = PTR_ERR(priv->pclk); - dev_err(dev, "pclk get failed\n"); - return ret; - } + if (IS_ERR(priv->pclk)) + return dev_err_probe(dev, PTR_ERR(priv->pclk), "pclk get failed\n"); priv->vref = devm_regulator_get(dev, "vref"); - if (IS_ERR(priv->vref)) { - ret = PTR_ERR(priv->vref); - dev_err(dev, "vref get failed, %d\n", ret); - return ret; - } + if (IS_ERR(priv->vref)) + return dev_err_probe(dev, PTR_ERR(priv->vref), "vref get failed\n"); pm_runtime_get_noresume(dev); pm_runtime_set_active(dev); From patchwork Mon Sep 27 08:26:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cai,Huoqing" X-Patchwork-Id: 12519403 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65C42C433EF for ; Mon, 27 Sep 2021 08:26:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4271D60EC0 for ; Mon, 27 Sep 2021 08:26:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233518AbhI0I2U (ORCPT ); Mon, 27 Sep 2021 04:28:20 -0400 Received: from mx24.baidu.com ([111.206.215.185]:32806 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233551AbhI0I2S (ORCPT ); Mon, 27 Sep 2021 04:28:18 -0400 Received: from BC-Mail-Ex09.internal.baidu.com (unknown [172.31.51.49]) by Forcepoint Email with ESMTPS id 185BBAB2B91CA3C23089; Mon, 27 Sep 2021 16:26:40 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex09.internal.baidu.com (172.31.51.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Mon, 27 Sep 2021 16:26:39 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Mon, 27 Sep 2021 16:26:38 +0800 From: Cai Huoqing To: CC: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , "Vladimir Zapolskiy" , Marcus Folkesson , Maxime Coquelin , Alexandre Torgue , , , , Subject: [PATCH 8/8] iio: dac: ti-dac7311: Make use of the helper function dev_err_probe() Date: Mon, 27 Sep 2021 16:26:07 +0800 Message-ID: <20210927082608.859-8-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210927082608.859-1-caihuoqing@baidu.com> References: <20210927082608.859-1-caihuoqing@baidu.com> MIME-Version: 1.0 X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex15.internal.baidu.com (172.31.51.55) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. Using dev_err_probe() can reduce code size, and the error value gets printed. Signed-off-by: Cai Huoqing --- drivers/iio/dac/ti-dac7311.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/dac/ti-dac7311.c b/drivers/iio/dac/ti-dac7311.c index 9d0b253be841..09218c3029f0 100644 --- a/drivers/iio/dac/ti-dac7311.c +++ b/drivers/iio/dac/ti-dac7311.c @@ -266,10 +266,9 @@ static int ti_dac_probe(struct spi_device *spi) ti_dac->resolution = spec->resolution; ti_dac->vref = devm_regulator_get(dev, "vref"); - if (IS_ERR(ti_dac->vref)) { - dev_err(dev, "error to get regulator\n"); - return PTR_ERR(ti_dac->vref); - } + if (IS_ERR(ti_dac->vref)) + return dev_err_probe(dev, PTR_ERR(ti_dac->vref), + "error to get regulator\n"); ret = regulator_enable(ti_dac->vref); if (ret < 0) {