mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthias Brugger <matthias.bgg@gmail.com>
To: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	nfraprado@collabora.com, rex-bc.chen@mediatek.com,
	zhiyong.tao@mediatek.com
Subject: Re: [PATCH v3 3/5] soc: mediatek: pwrap: Move and check return value of platform_get_irq()
Date: Tue, 17 May 2022 11:18:55 +0200	[thread overview]
Message-ID: <ad736290-2e01-f867-d2ec-867a4385005a@gmail.com> (raw)
In-Reply-To: <20220516124659.69484-4-angelogioacchino.delregno@collabora.com>



On 16/05/2022 14:46, AngeloGioacchino Del Regno wrote:
> Move the call to platform_get_irq() earlier in the probe function
> and check for its return value: if no interrupt is specified, it
> wouldn't make sense to try to call devm_request_irq() so, in that
> case, we can simply return early.
> 
> Moving the platform_get_irq() call also makes it possible to use
> one less goto, as clocks aren't required at that stage.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> ---
>   drivers/soc/mediatek/mtk-pmic-wrap.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
> index 852514366f1f..332cbcabc299 100644
> --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
> +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
> @@ -2204,6 +2204,10 @@ static int pwrap_probe(struct platform_device *pdev)
>   	if (!wrp)
>   		return -ENOMEM;
>   
> +	irq = platform_get_irq(pdev, 0);
> +	if (irq < 0)
> +		return irq;
> +
>   	platform_set_drvdata(pdev, wrp);
>   
>   	wrp->master = of_device_get_match_data(&pdev->dev);
> @@ -2316,7 +2320,6 @@ static int pwrap_probe(struct platform_device *pdev)
>   	if (HAS_CAP(wrp->master->caps, PWRAP_CAP_INT1_EN))
>   		pwrap_writel(wrp, wrp->master->int1_en_all, PWRAP_INT1_EN);
>   
> -	irq = platform_get_irq(pdev, 0);

For better readability of the code I'd prefer to keep platform_get_irq next to 
devm_request_irq. I understand that you did this change so that you don't have 
to code
if (irq < 0) {
     ret = irq;
     goto err_out2;
}

Or do I miss something?

Regards,
Matthias

>   	ret = devm_request_irq(wrp->dev, irq, pwrap_interrupt,
>   			       IRQF_TRIGGER_HIGH,
>   			       "mt-pmic-pwrap", wrp);

  reply	other threads:[~2022-05-17  9:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 12:46 [PATCH v3 0/5] MediaTek PMIC Wrap improvements and cleanups AngeloGioacchino Del Regno
2022-05-16 12:46 ` [PATCH v3 1/5] soc: mediatek: pwrap: Use readx_poll_timeout() instead of custom function AngeloGioacchino Del Regno
2022-05-17  9:25   ` Matthias Brugger
2022-05-17  9:41     ` AngeloGioacchino Del Regno
2022-05-17  9:44       ` Matthias Brugger
2022-05-16 12:46 ` [PATCH v3 2/5] soc: mediatek: pwrap: Switch to devm_platform_ioremap_resource_byname() AngeloGioacchino Del Regno
2022-05-16 12:46 ` [PATCH v3 3/5] soc: mediatek: pwrap: Move and check return value of platform_get_irq() AngeloGioacchino Del Regno
2022-05-17  9:18   ` Matthias Brugger [this message]
2022-05-17  9:34     ` AngeloGioacchino Del Regno
2022-05-17  9:49       ` Matthias Brugger
2022-05-17 10:35         ` AngeloGioacchino Del Regno
2022-05-16 12:46 ` [PATCH v3 4/5] soc: mediatek: pwrap: Move IO pointers to new structure AngeloGioacchino Del Regno
2022-05-16 12:46 ` [PATCH v3 5/5] soc: mediatek: pwrap: Compress of_device_id entries to one line AngeloGioacchino Del Regno
2022-05-17  9:23   ` Matthias Brugger

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=ad736290-2e01-f867-d2ec-867a4385005a@gmail.com \
    --to=matthias.bgg@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=nfraprado@collabora.com \
    --cc=rex-bc.chen@mediatek.com \
    --cc=zhiyong.tao@mediatek.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

all inboxes | Powered by JetHome®