summaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-02-18 11:38:58 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-03-07 08:57:56 +0100
commit3bd69ad077a955b469baa90d938fd83510297335 (patch)
tree94d314d51fd295e6cb7de9f682582c29fdd50eed /drivers/ata
parentfe7855bb4f2d82ac4559c46c586c2f29e9f123e2 (diff)
downloadbarebox-3bd69ad077a955b469baa90d938fd83510297335.tar.gz
barebox-3bd69ad077a955b469baa90d938fd83510297335.tar.xz
driver: replace dev_request_mem_region with dev_request_mem_resource
dev_request_mem_region doesn't work properly one some SoCs on which PTR_ERR() values clash with valid return values from dev_request_mem_region. Replace them with dev_request_mem_resource where possible. This patch has been generated with the following semantic patch: // <smpl> @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { ... - return PTR_ERR(io); -} + return PTR_ERR(iores); +} +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) - return PTR_ERR(io); -} + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { - ret = PTR_ERR(io); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { + ret = PTR_ERR(iores); ... } +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ identifier func; @@ func(...) { <+... struct resource *iores; -struct resource *iores; ...+> } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ahci.c8
-rw-r--r--drivers/ata/intf_platform_ide.c11
-rw-r--r--drivers/ata/pata-imx.c8
-rw-r--r--drivers/ata/sata-imx.c8
4 files changed, 24 insertions, 11 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 4e42180d9e..c31b337ba2 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -659,15 +659,17 @@ int ahci_add_host(struct ahci_device *ahci)
static int ahci_probe(struct device_d *dev)
{
+ struct resource *iores;
struct ahci_device *ahci;
void __iomem *regs;
int ret;
ahci = xzalloc(sizeof(*ahci));
- regs = dev_request_mem_region(dev, 0);
- if (IS_ERR(regs))
- return PTR_ERR(regs);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ regs = IOMEM(iores->start);
ahci->dev = dev;
ahci->mmio_base = regs;
diff --git a/drivers/ata/intf_platform_ide.c b/drivers/ata/intf_platform_ide.c
index d0f7984a2c..6e74bfb089 100644
--- a/drivers/ata/intf_platform_ide.c
+++ b/drivers/ata/intf_platform_ide.c
@@ -80,6 +80,7 @@ static void platform_ide_setup_port(void *reg_base, void *alt_base,
static int platform_ide_probe(struct device_d *dev)
{
+ struct resource *iores;
int rc;
struct ide_port_info *pdata = dev->platform_data;
struct ide_port *ide;
@@ -102,11 +103,17 @@ static int platform_ide_probe(struct device_d *dev)
return -EINVAL;
}
- reg_base = dev_request_mem_region(dev, 0);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ reg_base = IOMEM(iores->start);
if (!IS_ERR(reg_base)) {
mmio = 1;
- alt_base = dev_request_mem_region(dev, 1);
+ iores = dev_request_mem_resource(dev, 1);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ alt_base = IOMEM(iores->start);
if (IS_ERR(alt_base))
alt_base = NULL;
} else {
diff --git a/drivers/ata/pata-imx.c b/drivers/ata/pata-imx.c
index d8deba1461..842957331e 100644
--- a/drivers/ata/pata-imx.c
+++ b/drivers/ata/pata-imx.c
@@ -153,6 +153,7 @@ static int pata_imx_detect(struct device_d *dev)
static int imx_pata_probe(struct device_d *dev)
{
+ struct resource *iores;
struct ide_port *ide;
struct clk *clk;
void __iomem *base;
@@ -160,9 +161,10 @@ static int imx_pata_probe(struct device_d *dev)
const char *devname = NULL;
ide = xzalloc(sizeof(*ide));
- base = dev_request_mem_region(dev, 0);
- if (IS_ERR(base))
- return PTR_ERR(base);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ base = IOMEM(iores->start);
clk = clk_get(dev, NULL);
if (IS_ERR(clk)) {
diff --git a/drivers/ata/sata-imx.c b/drivers/ata/sata-imx.c
index 612762e229..6a601956db 100644
--- a/drivers/ata/sata-imx.c
+++ b/drivers/ata/sata-imx.c
@@ -84,6 +84,7 @@ static int imx_sata_init_1ms(struct imx_ahci *imx_ahci)
static int imx_sata_probe(struct device_d *dev)
{
+ struct resource *iores;
struct imx_ahci *imx_ahci;
struct imx_sata_data *data;
int ret;
@@ -100,9 +101,10 @@ static int imx_sata_probe(struct device_d *dev)
goto err_free;
}
- imx_ahci->ahci.mmio_base = dev_request_mem_region(dev, 0);
- if (IS_ERR(imx_ahci->ahci.mmio_base))
- return PTR_ERR(imx_ahci->ahci.mmio_base);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ imx_ahci->ahci.mmio_base = IOMEM(iores->start);
data->init(imx_ahci);