summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
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/watchdog
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/watchdog')
-rw-r--r--drivers/watchdog/davinci_wdt.c8
-rw-r--r--drivers/watchdog/im28wd.c8
-rw-r--r--drivers/watchdog/imxwd.c8
-rw-r--r--drivers/watchdog/jz4740.c8
-rw-r--r--drivers/watchdog/omap_wdt.c8
5 files changed, 25 insertions, 15 deletions
diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index dfabee2..03dc834 100644
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@@ -131,14 +131,16 @@ static int davinci_wdt_set_timeout(struct watchdog *wd, unsigned timeout)
static int davinci_wdt_probe(struct device_d *dev)
{
+ struct resource *iores;
int ret = 0;
struct davinci_wdt *davinci_wdt;
davinci_wdt = xzalloc(sizeof(*davinci_wdt));
- davinci_wdt->base = dev_request_mem_region(dev, 0);
- if (IS_ERR(davinci_wdt->base))
- return PTR_ERR(davinci_wdt->base);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ davinci_wdt->base = IOMEM(iores->start);
davinci_wdt->clk = clk_get(dev, NULL);
if (WARN_ON(IS_ERR(davinci_wdt->clk)))
diff --git a/drivers/watchdog/im28wd.c b/drivers/watchdog/im28wd.c
index 3510776..1956fdb 100644
--- a/drivers/watchdog/im28wd.c
+++ b/drivers/watchdog/im28wd.c
@@ -189,13 +189,15 @@ static void __maybe_unused imx28_detect_reset_source(const struct imx28_wd *p)
static int imx28_wd_probe(struct device_d *dev)
{
+ struct resource *iores;
struct imx28_wd *priv;
int rc;
priv = xzalloc(sizeof(struct imx28_wd));
- priv->regs = dev_request_mem_region(dev, 0);
- if (IS_ERR(priv->regs))
- return PTR_ERR(priv->regs);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores))
+ return PTR_ERR(iores);
+ priv->regs = IOMEM(iores->start);
priv->wd.set_timeout = imx28_watchdog_set_timeout;
priv->wd.dev = dev;
diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c
index 1458894..03e116e 100644
--- a/drivers/watchdog/imxwd.c
+++ b/drivers/watchdog/imxwd.c
@@ -173,6 +173,7 @@ static int imx21_wd_init(struct imx_wd *priv)
static int imx_wd_probe(struct device_d *dev)
{
+ struct resource *iores;
struct imx_wd *priv;
void *ops;
int ret;
@@ -182,11 +183,12 @@ static int imx_wd_probe(struct device_d *dev)
return ret;
priv = xzalloc(sizeof(struct imx_wd));
- priv->base = dev_request_mem_region(dev, 0);
- if (IS_ERR(priv->base)) {
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores)) {
dev_err(dev, "could not get memory region\n");
- return PTR_ERR(priv->base);
+ return PTR_ERR(iores);
}
+ priv->base = IOMEM(iores->start);
priv->ops = ops;
priv->wd.set_timeout = imx_watchdog_set_timeout;
priv->wd.dev = dev;
diff --git a/drivers/watchdog/jz4740.c b/drivers/watchdog/jz4740.c
index 85a1c1d..f28bb91 100644
--- a/drivers/watchdog/jz4740.c
+++ b/drivers/watchdog/jz4740.c
@@ -67,14 +67,16 @@ static void __noreturn jz4740_reset_soc(struct restart_handler *rst)
static int jz4740_wdt_probe(struct device_d *dev)
{
+ struct resource *iores;
struct jz4740_wdt_drvdata *priv;
priv = xzalloc(sizeof(struct jz4740_wdt_drvdata));
- priv->base = dev_request_mem_region(dev, 0);
- if (IS_ERR(priv->base)) {
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores)) {
dev_err(dev, "could not get memory region\n");
- return PTR_ERR(priv->base);
+ return PTR_ERR(iores);
}
+ priv->base = IOMEM(iores->start);
dev->priv = priv;
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 06301b3..27fdfd1 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -154,6 +154,7 @@ static int omap_wdt_set_timeout(struct watchdog *wdog,
static int omap_wdt_probe(struct device_d *dev)
{
+ struct resource *iores;
struct omap_wdt_dev *wdev;
int ret;
@@ -162,11 +163,12 @@ static int omap_wdt_probe(struct device_d *dev)
wdev->wdt_trgr_pattern = 0x1234;
/* reserve static register mappings */
- wdev->base = dev_request_mem_region(dev, 0);
- if (IS_ERR(wdev->base)) {
- ret = PTR_ERR(wdev->base);
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores)) {
+ ret = PTR_ERR(iores);
goto error;
}
+ wdev->base = IOMEM(iores->start);
wdev->timeout = TIMER_MARGIN_DEFAULT;