From: Alain Volmat <alain.volmat@st.com>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
Florian Fainelli <f.fainelli@gmail.com>,
Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
<bcm-kernel-feedback-list@broadcom.com>,
Michal Simek <michal.simek@xilinx.com>,
Sekhar Nori <nsekhar@ti.com>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Oleksij Rempel <linux@rempel-privat.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>,
Heiko Stuebner <heiko@sntech.de>,
Pierre-Yves MORDRET <pierre-yves.mordret@st.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@st.com>,
Peter Rosin <peda@axentia.se>, Wolfram Sang <wsa@kernel.org>,
<linux-i2c@vger.kernel.org>,
<linux-rpi-kernel@lists.infradead.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
<linux-rockchip@lists.infradead.org>,
<linux-stm32@st-md-mailman.stormreply.com>
Subject: Re: [PATCH 1/9] i2c: stm32: Simplify with dev_err_probe()
Date: Thu, 10 Sep 2020 11:36:41 +0200 [thread overview]
Message-ID: <20200910093641.GB1975@gnbcxd0016.gnb.st.com> (raw)
In-Reply-To: <20200902150643.14839-1-krzk@kernel.org>
Hi,
On Wed, Sep 02, 2020 at 05:06:35PM +0200, Krzysztof Kozlowski wrote:
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe(). Less code and the error value gets printed.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Alain Volmat <alain.volmat@st.com>
> ---
> drivers/i2c/busses/i2c-stm32.c | 11 ++++-------
> drivers/i2c/busses/i2c-stm32f4.c | 6 ++----
> drivers/i2c/busses/i2c-stm32f7.c | 24 +++++++++---------------
> 3 files changed, 15 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-stm32.c b/drivers/i2c/busses/i2c-stm32.c
> index 3f69a3bb6119..198f848b7be9 100644
> --- a/drivers/i2c/busses/i2c-stm32.c
> +++ b/drivers/i2c/busses/i2c-stm32.c
> @@ -25,9 +25,8 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
> /* Request and configure I2C TX dma channel */
> dma->chan_tx = dma_request_chan(dev, "tx");
> if (IS_ERR(dma->chan_tx)) {
> - ret = PTR_ERR(dma->chan_tx);
> - if (ret != -EPROBE_DEFER)
> - dev_err(dev, "can't request DMA tx channel\n");
> + ret = dev_err_probe(dev, PTR_ERR(dma->chan_tx),
> + "can't request DMA tx channel\n");
> goto fail_al;
> }
>
> @@ -45,10 +44,8 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
> /* Request and configure I2C RX dma channel */
> dma->chan_rx = dma_request_chan(dev, "rx");
> if (IS_ERR(dma->chan_rx)) {
> - ret = PTR_ERR(dma->chan_rx);
> - if (ret != -EPROBE_DEFER)
> - dev_err(dev, "can't request DMA rx channel\n");
> -
> + ret = dev_err_probe(dev, PTR_ERR(dma->chan_rx),
> + "can't request DMA rx channel\n");
> goto fail_tx;
> }
>
> diff --git a/drivers/i2c/busses/i2c-stm32f4.c b/drivers/i2c/busses/i2c-stm32f4.c
> index 48e269284369..937c2c8fd349 100644
> --- a/drivers/i2c/busses/i2c-stm32f4.c
> +++ b/drivers/i2c/busses/i2c-stm32f4.c
> @@ -797,10 +797,8 @@ static int stm32f4_i2c_probe(struct platform_device *pdev)
>
> rst = devm_reset_control_get_exclusive(&pdev->dev, NULL);
> if (IS_ERR(rst)) {
> - ret = PTR_ERR(rst);
> - if (ret != -EPROBE_DEFER)
> - dev_err(&pdev->dev, "Error: Missing reset ctrl\n");
> -
> + ret = dev_err_probe(&pdev->dev, PTR_ERR(rst),
> + "Error: Missing reset ctrl\n");
> goto clk_free;
> }
> reset_control_assert(rst);
> diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
> index bff3479fe122..a8f1758e4c5b 100644
> --- a/drivers/i2c/busses/i2c-stm32f7.c
> +++ b/drivers/i2c/busses/i2c-stm32f7.c
> @@ -1968,11 +1968,9 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
> "wakeup-source");
>
> i2c_dev->clk = devm_clk_get(&pdev->dev, NULL);
> - if (IS_ERR(i2c_dev->clk)) {
> - if (PTR_ERR(i2c_dev->clk) != -EPROBE_DEFER)
> - dev_err(&pdev->dev, "Failed to get controller clock\n");
> - return PTR_ERR(i2c_dev->clk);
> - }
> + if (IS_ERR(i2c_dev->clk))
> + return dev_err_probe(&pdev->dev, PTR_ERR(i2c_dev->clk),
> + "Failed to get controller clock\n");
>
> ret = clk_prepare_enable(i2c_dev->clk);
> if (ret) {
> @@ -1982,10 +1980,8 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
>
> rst = devm_reset_control_get(&pdev->dev, NULL);
> if (IS_ERR(rst)) {
> - ret = PTR_ERR(rst);
> - if (ret != -EPROBE_DEFER)
> - dev_err(&pdev->dev, "Error: Missing reset ctrl\n");
> -
> + ret = dev_err_probe(&pdev->dev, PTR_ERR(rst),
> + "Error: Missing reset ctrl\n");
> goto clk_free;
> }
> reset_control_assert(rst);
> @@ -2052,13 +2048,11 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
> i2c_dev->dma = stm32_i2c_dma_request(i2c_dev->dev, phy_addr,
> STM32F7_I2C_TXDR,
> STM32F7_I2C_RXDR);
> - if (PTR_ERR(i2c_dev->dma) == -ENODEV)
> + if (PTR_ERR(i2c_dev->dma) == -ENODEV) {
> i2c_dev->dma = NULL;
> - else if (IS_ERR(i2c_dev->dma)) {
> - ret = PTR_ERR(i2c_dev->dma);
> - if (ret != -EPROBE_DEFER)
> - dev_err(&pdev->dev,
> - "Failed to request dma error %i\n", ret);
> + } else if (IS_ERR(i2c_dev->dma)) {
> + ret = dev_err_probe(&pdev->dev, PTR_ERR(i2c_dev->dma),
> + "Failed to request dma error\n");
> goto fmp_clear;
> }
>
> --
> 2.17.1
>
prev parent reply other threads:[~2020-09-10 9:37 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-02 15:06 Krzysztof Kozlowski
2020-09-02 15:06 ` [PATCH 2/9] i2c: xiic: " Krzysztof Kozlowski
2021-06-23 8:57 ` Michal Simek
2021-06-23 16:26 ` Wolfram Sang
2020-09-02 15:06 ` [PATCH 3/9] i2c: bcm2835: " Krzysztof Kozlowski
2020-09-02 15:24 ` Florian Fainelli
2020-09-10 6:25 ` Wolfram Sang
2020-09-02 15:06 ` [PATCH 4/9] i2c: cadence: " Krzysztof Kozlowski
2021-06-23 8:59 ` Michal Simek
2021-06-23 16:26 ` Wolfram Sang
2020-09-02 15:06 ` [PATCH 5/9] i2c: davinci: " Krzysztof Kozlowski
2021-06-23 16:26 ` Wolfram Sang
2020-09-02 15:06 ` [PATCH 6/9] i2c: imx: " Krzysztof Kozlowski
2020-09-02 17:58 ` Uwe Kleine-König
2020-09-03 5:36 ` Oleksij Rempel
2020-09-10 6:27 ` Wolfram Sang
2020-09-02 15:06 ` [PATCH 7/9] i2c: rk3x: " Krzysztof Kozlowski
2020-09-22 14:25 ` Heiko Stübner
2020-09-27 18:01 ` Wolfram Sang
2020-09-02 15:06 ` [PATCH 8/9] i2c: mux: gpmux: " Krzysztof Kozlowski
2020-09-02 18:33 ` Peter Rosin
2020-09-10 6:24 ` Wolfram Sang
2020-09-02 15:06 ` [PATCH 9/9] i2c: mux: reg: " Krzysztof Kozlowski
2020-09-02 18:33 ` Peter Rosin
2020-09-10 6:24 ` Wolfram Sang
2020-09-10 9:36 ` Alain Volmat [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200910093641.GB1975@gnbcxd0016.gnb.st.com \
--to=alain.volmat@st.com \
--cc=alexandre.torgue@st.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bgolaszewski@baylibre.com \
--cc=f.fainelli@gmail.com \
--cc=festevam@gmail.com \
--cc=heiko@sntech.de \
--cc=kernel@pengutronix.de \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux@rempel-privat.de \
--cc=mcoquelin.stm32@gmail.com \
--cc=michal.simek@xilinx.com \
--cc=nsaenzjulienne@suse.de \
--cc=nsekhar@ti.com \
--cc=peda@axentia.se \
--cc=pierre-yves.mordret@st.com \
--cc=rjui@broadcom.com \
--cc=s.hauer@pengutronix.de \
--cc=sbranden@broadcom.com \
--cc=shawnguo@kernel.org \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®