From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: bjorn.andersson@linaro.org, matthias.bgg@gmail.com,
linux-remoteproc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
kernel@collabora.com
Subject: Re: [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible
Date: Tue, 1 Feb 2022 11:36:12 -0700 [thread overview]
Message-ID: <20220201183612.GC2490199@p14s> (raw)
In-Reply-To: <20220124120915.41292-3-angelogioacchino.delregno@collabora.com>
Hi Angelo,
On Mon, Jan 24, 2022 at 01:09:15PM +0100, AngeloGioacchino Del Regno wrote:
> Simplify the probe function, where possible, by using dev_err_probe().
> While at it, as to increase human readability, also remove some
> unnecessary forced void pointer casts that were previously used in
> error checking.
I am in favour of all 3 patches (please add a cover letter next time) but weary
about testing - do you have access to a Mediatek platform to try this on or
is it purely theoretical?
I would definitely feel better to see a "Tested-by" tag by someone out there
with access to the HW.
Thanks,
Mathieu
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
> drivers/remoteproc/mtk_scp.c | 28 ++++++++++++----------------
> 1 file changed, 12 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> index e40706b0e015..dcddb33e9997 100644
> --- a/drivers/remoteproc/mtk_scp.c
> +++ b/drivers/remoteproc/mtk_scp.c
> @@ -757,10 +757,8 @@ static int scp_probe(struct platform_device *pdev)
> int ret, i;
>
> rproc = devm_rproc_alloc(dev, np->name, &scp_ops, fw_name, sizeof(*scp));
> - if (!rproc) {
> - dev_err(dev, "unable to allocate remoteproc\n");
> - return -ENOMEM;
> - }
> + if (!rproc)
> + return dev_err_probe(dev, -ENOMEM, "unable to allocate remoteproc\n");
>
> scp = (struct mtk_scp *)rproc->priv;
> scp->rproc = rproc;
> @@ -770,21 +768,20 @@ static int scp_probe(struct platform_device *pdev)
>
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram");
> scp->sram_base = devm_ioremap_resource(dev, res);
> - if (IS_ERR((__force void *)scp->sram_base)) {
> - dev_err(dev, "Failed to parse and map sram memory\n");
> - return PTR_ERR((__force void *)scp->sram_base);
> - }
> + if (IS_ERR(scp->sram_base))
> + return dev_err_probe(dev, PTR_ERR(scp->sram_base),
> + "Failed to parse and map sram memory\n");
> +
> scp->sram_size = resource_size(res);
> scp->sram_phys = res->start;
>
> /* l1tcm is an optional memory region */
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
> scp->l1tcm_base = devm_ioremap_resource(dev, res);
> - if (IS_ERR((__force void *)scp->l1tcm_base)) {
> - ret = PTR_ERR((__force void *)scp->l1tcm_base);
> + if (IS_ERR(scp->l1tcm_base)) {
> + ret = PTR_ERR(scp->l1tcm_base);
> if (ret != -EINVAL) {
> - dev_err(dev, "Failed to map l1tcm memory\n");
> - return ret;
> + return dev_err_probe(dev, ret, "Failed to map l1tcm memory\n");
> }
> } else {
> scp->l1tcm_size = resource_size(res);
> @@ -792,10 +789,9 @@ static int scp_probe(struct platform_device *pdev)
> }
>
> scp->reg_base = devm_platform_ioremap_resource_byname(pdev, "cfg");
> - if (IS_ERR((__force void *)scp->reg_base)) {
> - dev_err(dev, "Failed to parse and map cfg memory\n");
> - return PTR_ERR((__force void *)scp->reg_base);
> - }
> + if (IS_ERR(scp->reg_base))
> + return dev_err_probe(dev, PTR_ERR(scp->reg_base),
> + "Failed to parse and map cfg memory\n");
>
> ret = scp->data->scp_clk_get(scp);
> if (ret)
> --
> 2.33.1
>
next prev parent reply other threads:[~2022-02-01 18:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-24 12:09 [PATCH 1/3] remoteproc: mtk_scp: Use devm variant of rproc_alloc() AngeloGioacchino Del Regno
2022-01-24 12:09 ` [PATCH 2/3] remoteproc: mtk_scp: Reorder scp_probe() sequence AngeloGioacchino Del Regno
2022-01-24 12:09 ` [PATCH 3/3] remoteproc: mtk_scp: Use dev_err_probe() where possible AngeloGioacchino Del Regno
2022-02-01 18:36 ` Mathieu Poirier [this message]
2022-02-02 9:03 ` AngeloGioacchino Del Regno
2022-02-02 17:53 ` 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=20220201183612.GC2490199@p14s \
--to=mathieu.poirier@linaro.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bjorn.andersson@linaro.org \
--cc=kernel@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
/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