From: Patrice CHOTARD <patrice.chotard@foss.st.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Bjorn Andersson <andersson@kernel.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: <linux-remoteproc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 3/5] remoteproc: st: Simplify with dev_err_probe
Date: Mon, 13 Jan 2025 09:23:45 +0100 [thread overview]
Message-ID: <5209f7b9-0e72-492f-bd5d-93726a9e1c41@foss.st.com> (raw)
In-Reply-To: <20250111-b4-syscon-phandle-args-remoteproc-v1-3-73ed6fafa1e3@linaro.org>
On 1/11/25 19:42, Krzysztof Kozlowski wrote:
> Use dev_err_probe() to make error code handling simpler and handle
> deferred probe.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
> drivers/remoteproc/st_remoteproc.c | 44 +++++++++++++++++---------------------
> 1 file changed, 20 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/remoteproc/st_remoteproc.c b/drivers/remoteproc/st_remoteproc.c
> index 5df99bae7131a832c0c03c9bf8619812d9eb570d..d1f35e8a83ba525613ed4e54d2269b7e9f427e46 100644
> --- a/drivers/remoteproc/st_remoteproc.c
> +++ b/drivers/remoteproc/st_remoteproc.c
> @@ -290,26 +290,23 @@ static int st_rproc_parse_dt(struct platform_device *pdev)
> if (ddata->config->sw_reset) {
> ddata->sw_reset = devm_reset_control_get_exclusive(dev,
> "sw_reset");
> - if (IS_ERR(ddata->sw_reset)) {
> - dev_err(dev, "Failed to get S/W Reset\n");
> - return PTR_ERR(ddata->sw_reset);
> - }
> + if (IS_ERR(ddata->sw_reset))
> + return dev_err_probe(dev, PTR_ERR(ddata->sw_reset),
> + "Failed to get S/W Reset\n");
> }
>
> if (ddata->config->pwr_reset) {
> ddata->pwr_reset = devm_reset_control_get_exclusive(dev,
> "pwr_reset");
> - if (IS_ERR(ddata->pwr_reset)) {
> - dev_err(dev, "Failed to get Power Reset\n");
> - return PTR_ERR(ddata->pwr_reset);
> - }
> + if (IS_ERR(ddata->pwr_reset))
> + return dev_err_probe(dev, PTR_ERR(ddata->pwr_reset),
> + "Failed to get Power Reset\n");
> }
>
> ddata->clk = devm_clk_get(dev, NULL);
> - if (IS_ERR(ddata->clk)) {
> - dev_err(dev, "Failed to get clock\n");
> - return PTR_ERR(ddata->clk);
> - }
> + if (IS_ERR(ddata->clk))
> + return dev_err_probe(dev, PTR_ERR(ddata->clk),
> + "Failed to get clock\n");
>
> err = of_property_read_u32(np, "clock-frequency", &ddata->clk_rate);
> if (err) {
> @@ -318,10 +315,9 @@ static int st_rproc_parse_dt(struct platform_device *pdev)
> }
>
> ddata->boot_base = syscon_regmap_lookup_by_phandle(np, "st,syscfg");
> - if (IS_ERR(ddata->boot_base)) {
> - dev_err(dev, "Boot base not found\n");
> - return PTR_ERR(ddata->boot_base);
> - }
> + if (IS_ERR(ddata->boot_base))
> + return dev_err_probe(dev, PTR_ERR(ddata->boot_base),
> + "Boot base not found\n");
>
> err = of_property_read_u32_index(np, "st,syscfg", 1,
> &ddata->boot_offset);
> @@ -395,32 +391,32 @@ static int st_rproc_probe(struct platform_device *pdev)
> */
> chan = mbox_request_channel_byname(&ddata->mbox_client_vq0, "vq0_rx");
> if (IS_ERR(chan)) {
> - dev_err(&rproc->dev, "failed to request mbox chan 0\n");
> - ret = PTR_ERR(chan);
> + ret = dev_err_probe(&rproc->dev, PTR_ERR(chan),
> + "failed to request mbox chan 0\n");
> goto free_clk;
> }
> ddata->mbox_chan[ST_RPROC_VQ0 * MBOX_MAX + MBOX_RX] = chan;
>
> chan = mbox_request_channel_byname(&ddata->mbox_client_vq0, "vq0_tx");
> if (IS_ERR(chan)) {
> - dev_err(&rproc->dev, "failed to request mbox chan 0\n");
> - ret = PTR_ERR(chan);
> + ret = dev_err_probe(&rproc->dev, PTR_ERR(chan),
> + "failed to request mbox chan 0\n");
> goto free_mbox;
> }
> ddata->mbox_chan[ST_RPROC_VQ0 * MBOX_MAX + MBOX_TX] = chan;
>
> chan = mbox_request_channel_byname(&ddata->mbox_client_vq1, "vq1_rx");
> if (IS_ERR(chan)) {
> - dev_err(&rproc->dev, "failed to request mbox chan 1\n");
> - ret = PTR_ERR(chan);
> + ret = dev_err_probe(&rproc->dev, PTR_ERR(chan),
> + "failed to request mbox chan 1\n");
> goto free_mbox;
> }
> ddata->mbox_chan[ST_RPROC_VQ1 * MBOX_MAX + MBOX_RX] = chan;
>
> chan = mbox_request_channel_byname(&ddata->mbox_client_vq1, "vq1_tx");
> if (IS_ERR(chan)) {
> - dev_err(&rproc->dev, "failed to request mbox chan 1\n");
> - ret = PTR_ERR(chan);
> + ret = dev_err_probe(&rproc->dev, PTR_ERR(chan),
> + "failed to request mbox chan 1\n");
> goto free_mbox;
> }
> ddata->mbox_chan[ST_RPROC_VQ1 * MBOX_MAX + MBOX_TX] = chan;
>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Thanks
Patrice
next prev parent reply other threads:[~2025-01-13 8:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-11 18:42 [PATCH 0/5] remoteproc: Simplify few things: omap, keystone, st Krzysztof Kozlowski
2025-01-11 18:42 ` [PATCH 1/5] remoteproc: keystone: Simplify returning syscon PTR_ERR Krzysztof Kozlowski
2025-01-11 18:42 ` [PATCH 2/5] remoteproc: omap: " Krzysztof Kozlowski
2025-01-11 18:42 ` [PATCH 3/5] remoteproc: st: Simplify with dev_err_probe Krzysztof Kozlowski
2025-01-13 8:23 ` Patrice CHOTARD [this message]
2025-01-11 18:42 ` [PATCH 4/5] remoteproc: keystone: Use syscon_regmap_lookup_by_phandle_args Krzysztof Kozlowski
2025-01-11 18:42 ` [PATCH 5/5] remoteproc: st: " Krzysztof Kozlowski
2025-01-13 8:25 ` Patrice CHOTARD
2025-01-15 17:07 ` [PATCH 0/5] remoteproc: Simplify few things: omap, keystone, st Mathieu Poirier
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=5209f7b9-0e72-492f-bd5d-93726a9e1c41@foss.st.com \
--to=patrice.chotard@foss.st.com \
--cc=andersson@kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.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®