Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: Rosen Penev <rosenp@gmail.com>
Cc: linux-ide@vger.kernel.org, Viresh Kumar <vireshk@kernel.org>,
	Damien Le Moal <dlemoal@kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ata: pata_arasan_cf: simplify ioremap
Date: Tue, 12 May 2026 12:16:20 +0200	[thread overview]
Message-ID: <agL99NtOLX_4Y8qV@ryzen> (raw)
In-Reply-To: <20260510194607.9567-1-rosenp@gmail.com>

On Sun, May 10, 2026 at 12:46:07PM -0700, Rosen Penev wrote:
> Use devm_platform_get_and_ioremap_resource() to combine
> platform_get_resource, request_mem_region, and ioremap.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  drivers/ata/pata_arasan_cf.c | 20 +++++---------------
>  1 file changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
> index b1e281b64f57..d5cb88ae2b76 100644
> --- a/drivers/ata/pata_arasan_cf.c
> +++ b/drivers/ata/pata_arasan_cf.c
> @@ -803,16 +803,6 @@ static int arasan_cf_probe(struct platform_device *pdev)
>  	irq_handler_t irq_handler = NULL;
>  	int ret;
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res)
> -		return -EINVAL;
> -
> -	if (!devm_request_mem_region(&pdev->dev, res->start, resource_size(res),
> -				DRIVER_NAME)) {
> -		dev_warn(&pdev->dev, "Failed to get memory region resource\n");
> -		return -ENOENT;
> -	}
> -
>  	acdev = devm_kzalloc(&pdev->dev, sizeof(*acdev), GFP_KERNEL);
>  	if (!acdev)
>  		return -ENOMEM;
> @@ -836,14 +826,14 @@ static int arasan_cf_probe(struct platform_device *pdev)
>  		quirk |= CF_BROKEN_MWDMA | CF_BROKEN_UDMA;
>  	}
>  
> -	acdev->pbase = res->start;
> -	acdev->vbase = devm_ioremap(&pdev->dev, res->start,
> -			resource_size(res));
> -	if (!acdev->vbase) {
> +	acdev->vbase = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> +	if (IS_ERR(acdev->vbase)) {
>  		dev_warn(&pdev->dev, "ioremap fail\n");

Please remove the dev_warn().

devm_platform_get_and_ioremap_resource() itself already prints an error
on failure.

Then since it will only be a single statement, you can also remove the
braces.


Kind regards,
Niklas


> -		return -ENOMEM;
> +		return PTR_ERR(acdev->vbase);
>  	}
>  
> +	acdev->pbase = res->start;
> +
>  	acdev->clk = devm_clk_get(&pdev->dev, NULL);
>  	if (IS_ERR(acdev->clk)) {
>  		dev_warn(&pdev->dev, "Clock not found\n");
> -- 
> 2.54.0
> 

      parent reply	other threads:[~2026-05-12 10:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-10 19:46 [PATCH] ata: pata_arasan_cf: simplify ioremap Rosen Penev
2026-05-11 21:51 ` Damien Le Moal
2026-05-12 10:16 ` Niklas Cassel [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=agL99NtOLX_4Y8qV@ryzen \
    --to=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rosenp@gmail.com \
    --cc=vireshk@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