Commit 8818a534 authored by Lad Prabhakar's avatar Lad Prabhakar Committed by Damien Le Moal

ata: pata_platform: Make use of platform_get_mem_or_io()

Make use of platform_get_mem_or_io() to simplify the code.

While at it, drop use of unlikely() from pata_platform_probe()
as it isn't a hotpath.
Signed-off-by: default avatarLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
parent 26291c54
...@@ -200,22 +200,16 @@ static int pata_platform_probe(struct platform_device *pdev) ...@@ -200,22 +200,16 @@ static int pata_platform_probe(struct platform_device *pdev)
/* /*
* Get the I/O base first * Get the I/O base first
*/ */
io_res = platform_get_resource(pdev, IORESOURCE_IO, 0); io_res = platform_get_mem_or_io(pdev, 0);
if (io_res == NULL) { if (!io_res)
io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); return -EINVAL;
if (unlikely(io_res == NULL))
return -EINVAL;
}
/* /*
* Then the CTL base * Then the CTL base
*/ */
ctl_res = platform_get_resource(pdev, IORESOURCE_IO, 1); ctl_res = platform_get_mem_or_io(pdev, 1);
if (ctl_res == NULL) { if (!ctl_res)
ctl_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); return -EINVAL;
if (unlikely(ctl_res == NULL))
return -EINVAL;
}
/* /*
* And the IRQ * And the IRQ
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment