summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-tegra
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 /arch/arm/mach-tegra
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 'arch/arm/mach-tegra')
-rw-r--r--arch/arm/mach-tegra/tegra20-pmc.c8
-rw-r--r--arch/arm/mach-tegra/tegra20-timer.c8
2 files changed, 10 insertions, 6 deletions
diff --git a/arch/arm/mach-tegra/tegra20-pmc.c b/arch/arm/mach-tegra/tegra20-pmc.c
index 02f0bf7499..f7c7ac918f 100644
--- a/arch/arm/mach-tegra/tegra20-pmc.c
+++ b/arch/arm/mach-tegra/tegra20-pmc.c
@@ -202,11 +202,13 @@ static void tegra20_pmc_detect_reset_cause(void)
static int tegra20_pmc_probe(struct device_d *dev)
{
- pmc_base = dev_request_mem_region(dev, 0);
- if (IS_ERR(pmc_base)) {
+ struct resource *iores;
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores)) {
dev_err(dev, "could not get memory region\n");
- return PTR_ERR(pmc_base);
+ return PTR_ERR(iores);
}
+ pmc_base = IOMEM(iores->start);
tegra_powergate_init();
diff --git a/arch/arm/mach-tegra/tegra20-timer.c b/arch/arm/mach-tegra/tegra20-timer.c
index a8e4d7b53d..2ba58bd65e 100644
--- a/arch/arm/mach-tegra/tegra20-timer.c
+++ b/arch/arm/mach-tegra/tegra20-timer.c
@@ -45,17 +45,19 @@ static struct clocksource cs = {
static int tegra20_timer_probe(struct device_d *dev)
{
+ struct resource *iores;
u32 reg;
/* use only one timer */
if (timer_base)
return -EBUSY;
- timer_base = dev_request_mem_region(dev, 0);
- if (IS_ERR(timer_base)) {
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores)) {
dev_err(dev, "could not get memory region\n");
- return PTR_ERR(timer_base);
+ return PTR_ERR(iores);
}
+ timer_base = IOMEM(iores->start);
/*
* calibrate timer to run at 1MHz