* [PATCH] ata: pata_platform: Make use of platform_get_mem_or_io()
@ 2022-01-17 2:01 Lad Prabhakar
2022-01-27 23:35 ` Damien Le Moal
0 siblings, 1 reply; 2+ messages in thread
From: Lad Prabhakar @ 2022-01-17 2:01 UTC (permalink / raw)
To: Damien Le Moal, linux-ide
Cc: Sergey Shtylyov, linux-kernel, Prabhakar, Lad Prabhakar
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: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
Hi All,
This patch is part of series [1]. Just sending this lone patch
for now.
[1] http://patchwork.ozlabs.org/project/linux-ide/list/?series=278349
Cheers,
Prabhakar
---
drivers/ata/pata_platform.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index 028329428b75..29902001e223 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -198,22 +198,16 @@ static int pata_platform_probe(struct platform_device *pdev)
/*
* Get the I/O base first
*/
- io_res = platform_get_resource(pdev, IORESOURCE_IO, 0);
- if (io_res == NULL) {
- io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (unlikely(io_res == NULL))
- return -EINVAL;
- }
+ io_res = platform_get_mem_or_io(pdev, 0);
+ if (!io_res)
+ return -EINVAL;
/*
* Then the CTL base
*/
- ctl_res = platform_get_resource(pdev, IORESOURCE_IO, 1);
- if (ctl_res == NULL) {
- ctl_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (unlikely(ctl_res == NULL))
- return -EINVAL;
- }
+ ctl_res = platform_get_mem_or_io(pdev, 1);
+ if (!ctl_res)
+ return -EINVAL;
/*
* And the IRQ
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ata: pata_platform: Make use of platform_get_mem_or_io()
2022-01-17 2:01 [PATCH] ata: pata_platform: Make use of platform_get_mem_or_io() Lad Prabhakar
@ 2022-01-27 23:35 ` Damien Le Moal
0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2022-01-27 23:35 UTC (permalink / raw)
To: Lad Prabhakar, linux-ide; +Cc: Sergey Shtylyov, linux-kernel, Prabhakar
On 1/17/22 11:01, Lad Prabhakar wrote:
> 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: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> ---
> Hi All,
>
> This patch is part of series [1]. Just sending this lone patch
> for now.
>
> [1] http://patchwork.ozlabs.org/project/linux-ide/list/?series=278349
>
> Cheers,
> Prabhakar
Applied to for-5.18. Thanks !
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-27 23:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 2:01 [PATCH] ata: pata_platform: Make use of platform_get_mem_or_io() Lad Prabhakar
2022-01-27 23:35 ` Damien Le Moal
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.