lkml.org 
[lkml]   [2021]   [Dec]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 06/10] ata: pata_of_platform: Make use of platform_get_mem_or_io()
Date
To be consistent with pata_platform driver use
platform_get_mem_or_io() instead of of_address_to_resource().

Suggested-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v2-->v3
* New patch
---
drivers/ata/pata_of_platform.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c
index 2e2ec7d77726..b9c9b7311112 100644
--- a/drivers/ata/pata_of_platform.c
+++ b/drivers/ata/pata_of_platform.c
@@ -8,7 +8,6 @@

#include <linux/kernel.h>
#include <linux/module.h>
-#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/ata_platform.h>
#include <linux/libata.h>
@@ -21,10 +20,9 @@ static struct scsi_host_template pata_platform_sht = {

static int pata_of_platform_probe(struct platform_device *ofdev)
{
- int ret;
struct device_node *dn = ofdev->dev.of_node;
- struct resource io_res;
- struct resource ctl_res;
+ struct resource *io_res;
+ struct resource *ctl_res;
struct resource irq_res;
unsigned int reg_shift = 0;
int pio_mode = 0;
@@ -32,15 +30,15 @@ static int pata_of_platform_probe(struct platform_device *ofdev)
bool use16bit;
int irq;

- ret = of_address_to_resource(dn, 0, &io_res);
- if (ret) {
+ io_res = platform_get_mem_or_io(ofdev, 0);
+ if (!io_res) {
dev_err(&ofdev->dev, "can't get IO address from "
"device tree\n");
return -EINVAL;
}

- ret = of_address_to_resource(dn, 1, &ctl_res);
- if (ret) {
+ ctl_res = platform_get_mem_or_io(ofdev, 1);
+ if (!ctl_res) {
dev_err(&ofdev->dev, "can't get CTL address from "
"device tree\n");
return -EINVAL;
@@ -71,7 +69,7 @@ static int pata_of_platform_probe(struct platform_device *ofdev)
pio_mask = 1 << pio_mode;
pio_mask |= (1 << pio_mode) - 1;

- return __pata_platform_probe(&ofdev->dev, &io_res, &ctl_res, irq > 0 ? &irq_res : NULL,
+ return __pata_platform_probe(&ofdev->dev, io_res, ctl_res, irq > 0 ? &irq_res : NULL,
reg_shift, pio_mask, &pata_platform_sht,
use16bit);
}
--
2.17.1
\
 
 \ /
  Last update: 2021-12-24 14:14    [W:0.247 / U:1.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site