summaryrefslogtreecommitdiffstats
path: root/drivers/clk
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/clk
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/clk')
-rw-r--r--drivers/clk/clk-ar933x.c8
-rw-r--r--drivers/clk/mvebu/common.c16
-rw-r--r--drivers/clk/mvebu/corediv.c8
-rw-r--r--drivers/clk/mxs/clk-imx23.c8
-rw-r--r--drivers/clk/mxs/clk-imx28.c8
-rw-r--r--drivers/clk/socfpga.c8
-rw-r--r--drivers/clk/tegra/clk-tegra124.c8
-rw-r--r--drivers/clk/tegra/clk-tegra20.c8
-rw-r--r--drivers/clk/tegra/clk-tegra30.c8
9 files changed, 50 insertions, 30 deletions
diff --git a/drivers/clk/clk-ar933x.c b/drivers/clk/clk-ar933x.c
index 79b257133..373f8cc08 100644
--- a/drivers/clk/clk-ar933x.c
+++ b/drivers/clk/clk-ar933x.c
@@ -137,11 +137,13 @@ static void ar933x_pll_init(void __iomem *base)
static int ar933x_clk_probe(struct device_d *dev)
{
+ struct resource *iores;
void __iomem *base;
- 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);
ar933x_ref_clk_init(base);
ar933x_pll_init(base);
diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c
index 1eded9037..a06b29f4e 100644
--- a/drivers/clk/mvebu/common.c
+++ b/drivers/clk/mvebu/common.c
@@ -42,6 +42,7 @@ static struct of_device_id mvebu_coreclk_ids[] = {
int mvebu_coreclk_probe(struct device_d *dev)
{
+ struct resource *iores;
struct device_node *np = dev->device_node;
const struct of_device_id *match;
const struct coreclk_soc_desc *desc;
@@ -57,9 +58,10 @@ int mvebu_coreclk_probe(struct device_d *dev)
desc = (const struct coreclk_soc_desc *)match->data;
/* Get SAR base address */
- 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);
/* Allocate struct for TCLK, cpu clk, and core ratio clocks */
clk_data.clk_num = 2 + desc->num_ratios;
@@ -151,6 +153,7 @@ static struct of_device_id mvebu_clk_gating_ids[] = {
int mvebu_clk_gating_probe(struct device_d *dev)
{
+ struct resource *iores;
struct device_node *np = dev->device_node;
const struct of_device_id *match;
const struct clk_gating_soc_desc *desc;
@@ -166,9 +169,10 @@ int mvebu_clk_gating_probe(struct device_d *dev)
return -EINVAL;
desc = (const struct clk_gating_soc_desc *)match->data;
- 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 = of_clk_get(np, 0);
if (IS_ERR(clk))
diff --git a/drivers/clk/mvebu/corediv.c b/drivers/clk/mvebu/corediv.c
index 55f6e6ad6..87b1f8bd7 100644
--- a/drivers/clk/mvebu/corediv.c
+++ b/drivers/clk/mvebu/corediv.c
@@ -199,6 +199,7 @@ static struct of_device_id mvebu_corediv_clk_ids[] = {
static int mvebu_corediv_clk_probe(struct device_d *dev)
{
+ struct resource *iores;
struct device_node *np = dev->device_node;
const struct of_device_id *match;
const struct clk_corediv_soc_desc *soc_desc;
@@ -212,9 +213,10 @@ static int mvebu_corediv_clk_probe(struct device_d *dev)
return -EINVAL;
soc_desc = (const struct clk_corediv_soc_desc *)match->data;
- 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);
parent = of_clk_get(np, 0);
if (IS_ERR(parent))
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c
index 8bf27c1c0..e28dae12f 100644
--- a/drivers/clk/mxs/clk-imx23.c
+++ b/drivers/clk/mxs/clk-imx23.c
@@ -126,11 +126,13 @@ int __init mx23_clocks_init(void __iomem *regs)
static int imx23_ccm_probe(struct device_d *dev)
{
+ struct resource *iores;
void __iomem *regs;
- 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);
mx23_clocks_init(regs);
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index a40804426..ffe03c866 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -167,11 +167,13 @@ int __init mx28_clocks_init(void __iomem *regs)
static int imx28_ccm_probe(struct device_d *dev)
{
+ struct resource *iores;
void __iomem *regs;
- 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);
mx28_clocks_init(regs);
diff --git a/drivers/clk/socfpga.c b/drivers/clk/socfpga.c
index 5952efb33..37ed038be 100644
--- a/drivers/clk/socfpga.c
+++ b/drivers/clk/socfpga.c
@@ -374,12 +374,14 @@ static void socfpga_register_clocks(struct device_d *dev, struct device_node *no
static int socfpga_ccm_probe(struct device_d *dev)
{
+ struct resource *iores;
void __iomem *regs;
struct device_node *clknode;
- 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);
clk_mgr_base_addr = regs;
diff --git a/drivers/clk/tegra/clk-tegra124.c b/drivers/clk/tegra/clk-tegra124.c
index 7a2f7c081..cec7b5f80 100644
--- a/drivers/clk/tegra/clk-tegra124.c
+++ b/drivers/clk/tegra/clk-tegra124.c
@@ -335,9 +335,11 @@ static struct tegra_clk_init_table init_table[] = {
static int tegra124_car_probe(struct device_d *dev)
{
- car_base = dev_request_mem_region(dev, 0);
- if (IS_ERR(car_base))
- return PTR_ERR(car_base);
+ struct resource *iores;
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ car_base = IOMEM(iores->start);
tegra124_osc_clk_init();
tegra124_pll_init();
diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c
index 2ff42d8bd..2f843bb9a 100644
--- a/drivers/clk/tegra/clk-tegra20.c
+++ b/drivers/clk/tegra/clk-tegra20.c
@@ -338,9 +338,11 @@ static struct tegra_clk_init_table init_table[] = {
static int tegra20_car_probe(struct device_d *dev)
{
- car_base = dev_request_mem_region(dev, 0);
- if (IS_ERR(car_base))
- return PTR_ERR(car_base);
+ struct resource *iores;
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ car_base = IOMEM(iores->start);
tegra20_osc_clk_init();
tegra20_pll_init();
diff --git a/drivers/clk/tegra/clk-tegra30.c b/drivers/clk/tegra/clk-tegra30.c
index 46fd6ddde..77f31d213 100644
--- a/drivers/clk/tegra/clk-tegra30.c
+++ b/drivers/clk/tegra/clk-tegra30.c
@@ -366,9 +366,11 @@ static struct tegra_clk_init_table init_table[] = {
static int tegra30_car_probe(struct device_d *dev)
{
- car_base = dev_request_mem_region(dev, 0);
- if (IS_ERR(car_base))
- return PTR_ERR(car_base);
+ struct resource *iores;
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ car_base = IOMEM(iores->start);
tegra30_osc_clk_init();
tegra30_pll_init();