summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
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/pinctrl
parentfe7855bb4f2d82ac4559c46c586c2f29e9f123e2 (diff)
downloadbarebox-3bd69ad077a955b469baa90d938fd83510297335.tar.gz
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/pinctrl')
-rw-r--r--drivers/pinctrl/imx-iomux-v2.c8
-rw-r--r--drivers/pinctrl/imx-iomux-v3.c6
-rw-r--r--drivers/pinctrl/mvebu/armada-370.c8
-rw-r--r--drivers/pinctrl/mvebu/armada-xp.c8
-rw-r--r--drivers/pinctrl/mvebu/dove.c16
-rw-r--r--drivers/pinctrl/mvebu/kirkwood.c8
-rw-r--r--drivers/pinctrl/pinctrl-single.c6
-rw-r--r--drivers/pinctrl/pinctrl-tegra-xusb.c8
-rw-r--r--drivers/pinctrl/pinctrl-tegra20.c8
-rw-r--r--drivers/pinctrl/pinctrl-tegra30.c8
10 files changed, 55 insertions, 29 deletions
diff --git a/drivers/pinctrl/imx-iomux-v2.c b/drivers/pinctrl/imx-iomux-v2.c
index 1e0e8e9..0c985a6 100644
--- a/drivers/pinctrl/imx-iomux-v2.c
+++ b/drivers/pinctrl/imx-iomux-v2.c
@@ -118,9 +118,11 @@ int imx_iomux_setup_multiple_pins(const unsigned int *pin_list, unsigned count)
static int imx_iomux_probe(struct device_d *dev)
{
- base = dev_request_mem_region(dev, 0);
- if (IS_ERR(base))
- return PTR_ERR(base);
+ struct resource *iores;
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ base = IOMEM(iores->start);
return 0;
}
diff --git a/drivers/pinctrl/imx-iomux-v3.c b/drivers/pinctrl/imx-iomux-v3.c
index 62a352b..66443b7 100644
--- a/drivers/pinctrl/imx-iomux-v3.c
+++ b/drivers/pinctrl/imx-iomux-v3.c
@@ -171,12 +171,16 @@ static int imx_pinctrl_dt(struct device_d *dev, void __iomem *base)
static int imx_iomux_v3_probe(struct device_d *dev)
{
+ struct resource *iores;
int ret = 0;
if (iomuxv3_base)
return -EBUSY;
- iomuxv3_base = dev_request_mem_region(dev, 0);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ iomuxv3_base = IOMEM(iores->start);
iomuxv3_dev = dev;
if (IS_ENABLED(CONFIG_PINCTRL) && dev->device_node)
diff --git a/drivers/pinctrl/mvebu/armada-370.c b/drivers/pinctrl/mvebu/armada-370.c
index 7ad8d04..1c79bd6 100644
--- a/drivers/pinctrl/mvebu/armada-370.c
+++ b/drivers/pinctrl/mvebu/armada-370.c
@@ -391,14 +391,16 @@ static struct of_device_id armada_370_pinctrl_of_match[] = {
static int armada_370_pinctrl_probe(struct device_d *dev)
{
+ struct resource *iores;
const struct of_device_id *match =
of_match_node(armada_370_pinctrl_of_match, dev->device_node);
struct mvebu_pinctrl_soc_info *soc =
(struct mvebu_pinctrl_soc_info *)match->data;
- mpp_base = dev_request_mem_region(dev, 0);
- if (IS_ERR(mpp_base))
- return PTR_ERR(mpp_base);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ mpp_base = IOMEM(iores->start);
return mvebu_pinctrl_probe(dev, soc);
}
diff --git a/drivers/pinctrl/mvebu/armada-xp.c b/drivers/pinctrl/mvebu/armada-xp.c
index 51db35d..f1bc8b4 100644
--- a/drivers/pinctrl/mvebu/armada-xp.c
+++ b/drivers/pinctrl/mvebu/armada-xp.c
@@ -370,13 +370,15 @@ static struct of_device_id armada_xp_pinctrl_of_match[] = {
static int armada_xp_pinctrl_probe(struct device_d *dev)
{
+ struct resource *iores;
const struct of_device_id *match =
of_match_node(armada_xp_pinctrl_of_match, dev->device_node);
struct mvebu_pinctrl_soc_info *soc = &armada_xp_pinctrl_info;
- mpp_base = dev_request_mem_region(dev, 0);
- if (IS_ERR(mpp_base))
- return PTR_ERR(mpp_base);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ mpp_base = IOMEM(iores->start);
soc->variant = (enum armada_xp_variant)match->data;
diff --git a/drivers/pinctrl/mvebu/dove.c b/drivers/pinctrl/mvebu/dove.c
index 6e0ce84..8de01e7 100644
--- a/drivers/pinctrl/mvebu/dove.c
+++ b/drivers/pinctrl/mvebu/dove.c
@@ -696,6 +696,7 @@ static struct of_device_id dove_pinctrl_of_match[] = {
static int dove_pinctrl_probe(struct device_d *dev)
{
+ struct resource *iores;
const struct of_device_id *match =
of_match_node(dove_pinctrl_of_match, dev->device_node);
struct mvebu_pinctrl_soc_info *soc =
@@ -706,12 +707,15 @@ static int dove_pinctrl_probe(struct device_d *dev)
clk = clk_get(dev, NULL);
clk_enable(clk);
- mpp_base = dev_request_mem_region(dev, 0);
- if (IS_ERR(mpp_base))
- return PTR_ERR(mpp_base);
- mpp4_base = dev_request_mem_region(dev, 1);
- if (IS_ERR(mpp4_base))
- return PTR_ERR(mpp4_base);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ mpp_base = IOMEM(iores->start);
+
+ iores = dev_request_mem_resource(dev, 1);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ mpp4_base = IOMEM(iores->start);
/*
* Dove PMU does not have a stable binding, yet.
diff --git a/drivers/pinctrl/mvebu/kirkwood.c b/drivers/pinctrl/mvebu/kirkwood.c
index e2ac559..4b2618c 100644
--- a/drivers/pinctrl/mvebu/kirkwood.c
+++ b/drivers/pinctrl/mvebu/kirkwood.c
@@ -432,14 +432,16 @@ static struct of_device_id kirkwood_pinctrl_of_match[] = {
static int kirkwood_pinctrl_probe(struct device_d *dev)
{
+ struct resource *iores;
const struct of_device_id *match =
of_match_node(kirkwood_pinctrl_of_match, dev->device_node);
struct mvebu_pinctrl_soc_info *soc =
(struct mvebu_pinctrl_soc_info *)match->data;
- mpp_base = dev_request_mem_region(dev, 0);
- if (IS_ERR(mpp_base))
- return PTR_ERR(mpp_base);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ mpp_base = IOMEM(iores->start);
return mvebu_pinctrl_probe(dev, soc);
}
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 5c60c70..15b74cc 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -98,12 +98,16 @@ static struct pinctrl_ops pcs_ops = {
static int pcs_probe(struct device_d *dev)
{
+ struct resource *iores;
struct pinctrl_single *pcs;
struct device_node *np = dev->device_node;
int ret = 0;
pcs = xzalloc(sizeof(*pcs));
- pcs->base = dev_request_mem_region(dev, 0);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ pcs->base = IOMEM(iores->start);
pcs->pinctrl.dev = dev;
pcs->pinctrl.ops = &pcs_ops;
diff --git a/drivers/pinctrl/pinctrl-tegra-xusb.c b/drivers/pinctrl/pinctrl-tegra-xusb.c
index d567754..a7a75bb 100644
--- a/drivers/pinctrl/pinctrl-tegra-xusb.c
+++ b/drivers/pinctrl/pinctrl-tegra-xusb.c
@@ -378,6 +378,7 @@ static struct pinctrl_ops pinctrl_tegra_xusb_ops = {
static int pinctrl_tegra_xusb_probe(struct device_d *dev)
{
+ struct resource *iores;
struct tegra_xusb_padctl *padctl;
struct phy *phy;
int err;
@@ -389,11 +390,12 @@ static int pinctrl_tegra_xusb_probe(struct device_d *dev)
dev_get_drvdata(dev, (const void **)&padctl->soc);
- padctl->regs = dev_request_mem_region(dev, 0);
- if (IS_ERR(padctl->regs)) {
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores)) {
dev_err(dev, "Could not get iomem region\n");
- return PTR_ERR(padctl->regs);
+ return PTR_ERR(iores);
}
+ padctl->regs = IOMEM(iores->start);
padctl->rst = reset_control_get(dev, NULL);
if (IS_ERR(padctl->rst))
diff --git a/drivers/pinctrl/pinctrl-tegra20.c b/drivers/pinctrl/pinctrl-tegra20.c
index be9d8a9..eaaba9e 100644
--- a/drivers/pinctrl/pinctrl-tegra20.c
+++ b/drivers/pinctrl/pinctrl-tegra20.c
@@ -295,6 +295,7 @@ static struct pinctrl_ops pinctrl_tegra20_ops = {
static int pinctrl_tegra20_probe(struct device_d *dev)
{
+ struct resource *iores;
struct pinctrl_tegra20 *ctrl;
int i, ret;
u32 **regs;
@@ -309,11 +310,12 @@ static int pinctrl_tegra20_probe(struct device_d *dev)
*/
regs = (u32 **)&ctrl->regs;
for (i = 0; i <= 2; i++) {
- regs[i] = dev_request_mem_region(dev, i);
- if (IS_ERR(regs[i])) {
+ iores = dev_request_mem_resource(dev, i);
+ if (IS_ERR(iores)) {
dev_err(dev, "Could not get iomem region %d\n", i);
- return PTR_ERR(regs[i]);
+ return PTR_ERR(iores);
}
+ regs[i] = IOMEM(iores->start);
}
ctrl->pinctrl.dev = dev;
diff --git a/drivers/pinctrl/pinctrl-tegra30.c b/drivers/pinctrl/pinctrl-tegra30.c
index 145a1a8..4b271dd 100644
--- a/drivers/pinctrl/pinctrl-tegra30.c
+++ b/drivers/pinctrl/pinctrl-tegra30.c
@@ -870,6 +870,7 @@ static struct pinctrl_ops pinctrl_tegra30_ops = {
static int pinctrl_tegra30_probe(struct device_d *dev)
{
+ struct resource *iores;
struct pinctrl_tegra30 *ctrl;
int i, ret;
u32 **regs;
@@ -884,11 +885,12 @@ static int pinctrl_tegra30_probe(struct device_d *dev)
*/
regs = (u32 **)&ctrl->regs;
for (i = 0; i <= 1; i++) {
- regs[i] = dev_request_mem_region(dev, i);
- if (IS_ERR(regs[i])) {
+ iores = dev_request_mem_resource(dev, i);
+ if (IS_ERR(iores)) {
dev_err(dev, "Could not get iomem region %d\n", i);
- return PTR_ERR(regs[i]);
+ return PTR_ERR(iores);
}
+ regs[i] = IOMEM(iores->start);
}
dev_get_drvdata(dev, (const void **)&ctrl->drvdata);