Commit 0f0a6a28 authored by Guenter Roeck's avatar Guenter Roeck Committed by Wim Van Sebroeck

watchdog: Convert to use devm_platform_ioremap_resource

Use devm_platform_ioremap_resource to reduce source code size,
improve readability, and reduce the likelyhood of bugs.

The conversion was done automatically with coccinelle using the
following semantic patch.

@r@
identifier res, pdev;
expression a;
expression index;
expression e;
@@

<+...
- res = platform_get_resource(pdev, IORESOURCE_MEM, index);
- a = devm_ioremap_resource(e, res);
+ a = devm_platform_ioremap_resource(pdev, index);
...+>

@depends on r@
identifier r.res;
@@
- struct resource *res;
  ... when != res

@@
identifier res, pdev;
expression index;
expression a;
@@
- struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, index);
- a = devm_ioremap_resource(&pdev->dev, res);
+ a = devm_platform_ioremap_resource(pdev, index);

Cc: Joel Stanley <joel@jms.id.au>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Keguang Zhang <keguang.zhang@gmail.com>
Cc: Vladimir Zapolskiy <vz@mleia.com>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Avi Fishman <avifishman70@gmail.com>
Cc: Nancy Yuen <yuenn@google.com>
Cc: Brendan Higgins <brendanhiggins@google.com>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Sylvain Lemieux <slemieux.tyco@gmail.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Barry Song <baohua@kernel.org>
Cc: Orson Zhai <orsonzhai@gmail.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Marc Gonzalez <marc.w.gonzalez@free.fr>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Acked-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Tested-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: default avatarJoel Stanley <joel@jms.id.au>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Acked-by: Michal Simek <michal.simek@xilinx.com> (cadence/xilinx wdts)
Acked-by: default avatarThierry Reding <treding@nvidia.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Acked-by: default avatarPatrice Chotard <patrice.chotard@st.com>
Acked-by: default avatarVladimir Zapolskiy <vz@mleia.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
parent 24b82256
...@@ -276,7 +276,6 @@ static int asm9260_wdt_probe(struct platform_device *pdev) ...@@ -276,7 +276,6 @@ static int asm9260_wdt_probe(struct platform_device *pdev)
{ {
struct asm9260_wdt_priv *priv; struct asm9260_wdt_priv *priv;
struct watchdog_device *wdd; struct watchdog_device *wdd;
struct resource *res;
int ret; int ret;
static const char * const mode_name[] = { "hw", "sw", "debug", }; static const char * const mode_name[] = { "hw", "sw", "debug", };
...@@ -287,8 +286,7 @@ static int asm9260_wdt_probe(struct platform_device *pdev) ...@@ -287,8 +286,7 @@ static int asm9260_wdt_probe(struct platform_device *pdev)
priv->dev = &pdev->dev; priv->dev = &pdev->dev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->iobase = devm_platform_ioremap_resource(pdev, 0);
priv->iobase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->iobase)) if (IS_ERR(priv->iobase))
return PTR_ERR(priv->iobase); return PTR_ERR(priv->iobase);
......
...@@ -190,7 +190,6 @@ static int aspeed_wdt_probe(struct platform_device *pdev) ...@@ -190,7 +190,6 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
const struct aspeed_wdt_config *config; const struct aspeed_wdt_config *config;
const struct of_device_id *ofdid; const struct of_device_id *ofdid;
struct aspeed_wdt *wdt; struct aspeed_wdt *wdt;
struct resource *res;
struct device_node *np; struct device_node *np;
const char *reset_type; const char *reset_type;
u32 duration; u32 duration;
...@@ -201,8 +200,7 @@ static int aspeed_wdt_probe(struct platform_device *pdev) ...@@ -201,8 +200,7 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
if (!wdt) if (!wdt)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt->base = devm_platform_ioremap_resource(pdev, 0);
wdt->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(wdt->base)) if (IS_ERR(wdt->base))
return PTR_ERR(wdt->base); return PTR_ERR(wdt->base);
......
...@@ -327,7 +327,6 @@ static inline int of_at91wdt_init(struct device_node *np, struct at91wdt *wdt) ...@@ -327,7 +327,6 @@ static inline int of_at91wdt_init(struct device_node *np, struct at91wdt *wdt)
static int __init at91wdt_probe(struct platform_device *pdev) static int __init at91wdt_probe(struct platform_device *pdev)
{ {
struct resource *r;
int err; int err;
struct at91wdt *wdt; struct at91wdt *wdt;
...@@ -346,8 +345,7 @@ static int __init at91wdt_probe(struct platform_device *pdev) ...@@ -346,8 +345,7 @@ static int __init at91wdt_probe(struct platform_device *pdev)
wdt->wdd.min_timeout = 1; wdt->wdd.min_timeout = 1;
wdt->wdd.max_timeout = 0xFFFF; wdt->wdd.max_timeout = 0xFFFF;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt->base = devm_platform_ioremap_resource(pdev, 0);
wdt->base = devm_ioremap_resource(&pdev->dev, r);
if (IS_ERR(wdt->base)) if (IS_ERR(wdt->base))
return PTR_ERR(wdt->base); return PTR_ERR(wdt->base);
......
...@@ -250,15 +250,13 @@ static struct miscdevice ath79_wdt_miscdev = { ...@@ -250,15 +250,13 @@ static struct miscdevice ath79_wdt_miscdev = {
static int ath79_wdt_probe(struct platform_device *pdev) static int ath79_wdt_probe(struct platform_device *pdev)
{ {
struct resource *res;
u32 ctrl; u32 ctrl;
int err; int err;
if (wdt_base) if (wdt_base)
return -EBUSY; return -EBUSY;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt_base = devm_platform_ioremap_resource(pdev, 0);
wdt_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(wdt_base)) if (IS_ERR(wdt_base))
return PTR_ERR(wdt_base); return PTR_ERR(wdt_base);
......
...@@ -129,15 +129,13 @@ static int atlas7_wdt_probe(struct platform_device *pdev) ...@@ -129,15 +129,13 @@ static int atlas7_wdt_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct atlas7_wdog *wdt; struct atlas7_wdog *wdt;
struct resource *res;
struct clk *clk; struct clk *clk;
int ret; int ret;
wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
if (!wdt) if (!wdt)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt->base = devm_platform_ioremap_resource(pdev, 0);
wdt->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(wdt->base)) if (IS_ERR(wdt->base))
return PTR_ERR(wdt->base); return PTR_ERR(wdt->base);
......
...@@ -111,7 +111,6 @@ static int bcm7038_wdt_probe(struct platform_device *pdev) ...@@ -111,7 +111,6 @@ static int bcm7038_wdt_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct bcm7038_watchdog *wdt; struct bcm7038_watchdog *wdt;
struct resource *res;
int err; int err;
wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
...@@ -120,8 +119,7 @@ static int bcm7038_wdt_probe(struct platform_device *pdev) ...@@ -120,8 +119,7 @@ static int bcm7038_wdt_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, wdt); platform_set_drvdata(pdev, wdt);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt->base = devm_platform_ioremap_resource(pdev, 0);
wdt->base = devm_ioremap_resource(dev, res);
if (IS_ERR(wdt->base)) if (IS_ERR(wdt->base))
return PTR_ERR(wdt->base); return PTR_ERR(wdt->base);
......
...@@ -280,7 +280,6 @@ static int bcm_kona_wdt_probe(struct platform_device *pdev) ...@@ -280,7 +280,6 @@ static int bcm_kona_wdt_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct bcm_kona_wdt *wdt; struct bcm_kona_wdt *wdt;
struct resource *res;
int ret; int ret;
wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
...@@ -289,8 +288,7 @@ static int bcm_kona_wdt_probe(struct platform_device *pdev) ...@@ -289,8 +288,7 @@ static int bcm_kona_wdt_probe(struct platform_device *pdev)
spin_lock_init(&wdt->lock); spin_lock_init(&wdt->lock);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt->base = devm_platform_ioremap_resource(pdev, 0);
wdt->base = devm_ioremap_resource(dev, res);
if (IS_ERR(wdt->base)) if (IS_ERR(wdt->base))
return -ENODEV; return -ENODEV;
......
...@@ -285,7 +285,6 @@ static const struct watchdog_ops cdns_wdt_ops = { ...@@ -285,7 +285,6 @@ static const struct watchdog_ops cdns_wdt_ops = {
*/ */
static int cdns_wdt_probe(struct platform_device *pdev) static int cdns_wdt_probe(struct platform_device *pdev)
{ {
struct resource *res;
int ret, irq; int ret, irq;
unsigned long clock_f; unsigned long clock_f;
struct cdns_wdt *wdt; struct cdns_wdt *wdt;
...@@ -302,8 +301,7 @@ static int cdns_wdt_probe(struct platform_device *pdev) ...@@ -302,8 +301,7 @@ static int cdns_wdt_probe(struct platform_device *pdev)
cdns_wdt_device->min_timeout = CDNS_WDT_MIN_TIMEOUT; cdns_wdt_device->min_timeout = CDNS_WDT_MIN_TIMEOUT;
cdns_wdt_device->max_timeout = CDNS_WDT_MAX_TIMEOUT; cdns_wdt_device->max_timeout = CDNS_WDT_MAX_TIMEOUT;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt->regs = devm_platform_ioremap_resource(pdev, 0);
wdt->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(wdt->regs)) if (IS_ERR(wdt->regs))
return PTR_ERR(wdt->regs); return PTR_ERR(wdt->regs);
......
...@@ -258,12 +258,10 @@ static int __init coh901327_probe(struct platform_device *pdev) ...@@ -258,12 +258,10 @@ static int __init coh901327_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
int ret; int ret;
u16 val; u16 val;
struct resource *res;
parent = dev; parent = dev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); virtbase = devm_platform_ioremap_resource(pdev, 0);
virtbase = devm_ioremap_resource(dev, res);
if (IS_ERR(virtbase)) if (IS_ERR(virtbase))
return PTR_ERR(virtbase); return PTR_ERR(virtbase);
......
...@@ -195,7 +195,6 @@ static int davinci_wdt_probe(struct platform_device *pdev) ...@@ -195,7 +195,6 @@ static int davinci_wdt_probe(struct platform_device *pdev)
{ {
int ret = 0; int ret = 0;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct resource *wdt_mem;
struct watchdog_device *wdd; struct watchdog_device *wdd;
struct davinci_wdt_device *davinci_wdt; struct davinci_wdt_device *davinci_wdt;
...@@ -235,8 +234,7 @@ static int davinci_wdt_probe(struct platform_device *pdev) ...@@ -235,8 +234,7 @@ static int davinci_wdt_probe(struct platform_device *pdev)
watchdog_set_nowayout(wdd, 1); watchdog_set_nowayout(wdd, 1);
watchdog_set_restart_priority(wdd, 128); watchdog_set_restart_priority(wdd, 128);
wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); davinci_wdt->base = devm_platform_ioremap_resource(pdev, 0);
davinci_wdt->base = devm_ioremap_resource(dev, wdt_mem);
if (IS_ERR(davinci_wdt->base)) { if (IS_ERR(davinci_wdt->base)) {
ret = PTR_ERR(davinci_wdt->base); ret = PTR_ERR(davinci_wdt->base);
goto err_clk_disable; goto err_clk_disable;
......
...@@ -116,7 +116,6 @@ static struct watchdog_device dc_wdt_wdd = { ...@@ -116,7 +116,6 @@ static struct watchdog_device dc_wdt_wdd = {
static int dc_wdt_probe(struct platform_device *pdev) static int dc_wdt_probe(struct platform_device *pdev)
{ {
struct resource *res;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct dc_wdt *wdt; struct dc_wdt *wdt;
int ret; int ret;
...@@ -125,8 +124,7 @@ static int dc_wdt_probe(struct platform_device *pdev) ...@@ -125,8 +124,7 @@ static int dc_wdt_probe(struct platform_device *pdev)
if (!wdt) if (!wdt)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt->base = devm_platform_ioremap_resource(pdev, 0);
wdt->base = devm_ioremap_resource(dev, res);
if (IS_ERR(wdt->base)) if (IS_ERR(wdt->base))
return PTR_ERR(wdt->base); return PTR_ERR(wdt->base);
......
...@@ -238,15 +238,13 @@ static int dw_wdt_drv_probe(struct platform_device *pdev) ...@@ -238,15 +238,13 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct watchdog_device *wdd; struct watchdog_device *wdd;
struct dw_wdt *dw_wdt; struct dw_wdt *dw_wdt;
struct resource *mem;
int ret; int ret;
dw_wdt = devm_kzalloc(dev, sizeof(*dw_wdt), GFP_KERNEL); dw_wdt = devm_kzalloc(dev, sizeof(*dw_wdt), GFP_KERNEL);
if (!dw_wdt) if (!dw_wdt)
return -ENOMEM; return -ENOMEM;
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); dw_wdt->regs = devm_platform_ioremap_resource(pdev, 0);
dw_wdt->regs = devm_ioremap_resource(dev, mem);
if (IS_ERR(dw_wdt->regs)) if (IS_ERR(dw_wdt->regs))
return PTR_ERR(dw_wdt->regs); return PTR_ERR(dw_wdt->regs);
......
...@@ -91,7 +91,6 @@ static int ep93xx_wdt_probe(struct platform_device *pdev) ...@@ -91,7 +91,6 @@ static int ep93xx_wdt_probe(struct platform_device *pdev)
{ {
struct ep93xx_wdt_priv *priv; struct ep93xx_wdt_priv *priv;
struct watchdog_device *wdd; struct watchdog_device *wdd;
struct resource *res;
unsigned long val; unsigned long val;
int ret; int ret;
...@@ -99,8 +98,7 @@ static int ep93xx_wdt_probe(struct platform_device *pdev) ...@@ -99,8 +98,7 @@ static int ep93xx_wdt_probe(struct platform_device *pdev)
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->mmio = devm_platform_ioremap_resource(pdev, 0);
priv->mmio = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->mmio)) if (IS_ERR(priv->mmio))
return PTR_ERR(priv->mmio); return PTR_ERR(priv->mmio);
......
...@@ -124,7 +124,6 @@ static const struct watchdog_info ftwdt010_wdt_info = { ...@@ -124,7 +124,6 @@ static const struct watchdog_info ftwdt010_wdt_info = {
static int ftwdt010_wdt_probe(struct platform_device *pdev) static int ftwdt010_wdt_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct resource *res;
struct ftwdt010_wdt *gwdt; struct ftwdt010_wdt *gwdt;
unsigned int reg; unsigned int reg;
int irq; int irq;
...@@ -134,8 +133,7 @@ static int ftwdt010_wdt_probe(struct platform_device *pdev) ...@@ -134,8 +133,7 @@ static int ftwdt010_wdt_probe(struct platform_device *pdev)
if (!gwdt) if (!gwdt)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); gwdt->base = devm_platform_ioremap_resource(pdev, 0);
gwdt->base = devm_ioremap_resource(dev, res);
if (IS_ERR(gwdt->base)) if (IS_ERR(gwdt->base))
return PTR_ERR(gwdt->base); return PTR_ERR(gwdt->base);
......
...@@ -183,15 +183,13 @@ static int pdc_wdt_probe(struct platform_device *pdev) ...@@ -183,15 +183,13 @@ static int pdc_wdt_probe(struct platform_device *pdev)
u64 div; u64 div;
int ret, val; int ret, val;
unsigned long clk_rate; unsigned long clk_rate;
struct resource *res;
struct pdc_wdt_dev *pdc_wdt; struct pdc_wdt_dev *pdc_wdt;
pdc_wdt = devm_kzalloc(&pdev->dev, sizeof(*pdc_wdt), GFP_KERNEL); pdc_wdt = devm_kzalloc(&pdev->dev, sizeof(*pdc_wdt), GFP_KERNEL);
if (!pdc_wdt) if (!pdc_wdt)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pdc_wdt->base = devm_platform_ioremap_resource(pdev, 0);
pdc_wdt->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pdc_wdt->base)) if (IS_ERR(pdc_wdt->base))
return PTR_ERR(pdc_wdt->base); return PTR_ERR(pdc_wdt->base);
......
...@@ -165,7 +165,6 @@ static int jz4740_wdt_probe(struct platform_device *pdev) ...@@ -165,7 +165,6 @@ static int jz4740_wdt_probe(struct platform_device *pdev)
{ {
struct jz4740_wdt_drvdata *drvdata; struct jz4740_wdt_drvdata *drvdata;
struct watchdog_device *jz4740_wdt; struct watchdog_device *jz4740_wdt;
struct resource *res;
int ret; int ret;
drvdata = devm_kzalloc(&pdev->dev, sizeof(struct jz4740_wdt_drvdata), drvdata = devm_kzalloc(&pdev->dev, sizeof(struct jz4740_wdt_drvdata),
...@@ -186,8 +185,7 @@ static int jz4740_wdt_probe(struct platform_device *pdev) ...@@ -186,8 +185,7 @@ static int jz4740_wdt_probe(struct platform_device *pdev)
watchdog_set_nowayout(jz4740_wdt, nowayout); watchdog_set_nowayout(jz4740_wdt, nowayout);
watchdog_set_drvdata(jz4740_wdt, drvdata); watchdog_set_drvdata(jz4740_wdt, drvdata);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); drvdata->base = devm_platform_ioremap_resource(pdev, 0);
drvdata->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(drvdata->base)) if (IS_ERR(drvdata->base))
return PTR_ERR(drvdata->base); return PTR_ERR(drvdata->base);
......
...@@ -203,7 +203,6 @@ static int ltq_wdt_probe(struct platform_device *pdev) ...@@ -203,7 +203,6 @@ static int ltq_wdt_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct ltq_wdt_priv *priv; struct ltq_wdt_priv *priv;
struct watchdog_device *wdt; struct watchdog_device *wdt;
struct resource *res;
struct clk *clk; struct clk *clk;
const struct ltq_wdt_hw *ltq_wdt_hw; const struct ltq_wdt_hw *ltq_wdt_hw;
int ret; int ret;
...@@ -213,8 +212,7 @@ static int ltq_wdt_probe(struct platform_device *pdev) ...@@ -213,8 +212,7 @@ static int ltq_wdt_probe(struct platform_device *pdev)
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->membase = devm_platform_ioremap_resource(pdev, 0);
priv->membase = devm_ioremap_resource(dev, res);
if (IS_ERR(priv->membase)) if (IS_ERR(priv->membase))
return PTR_ERR(priv->membase); return PTR_ERR(priv->membase);
......
...@@ -88,15 +88,13 @@ static int ls1x_wdt_probe(struct platform_device *pdev) ...@@ -88,15 +88,13 @@ static int ls1x_wdt_probe(struct platform_device *pdev)
struct ls1x_wdt_drvdata *drvdata; struct ls1x_wdt_drvdata *drvdata;
struct watchdog_device *ls1x_wdt; struct watchdog_device *ls1x_wdt;
unsigned long clk_rate; unsigned long clk_rate;
struct resource *res;
int err; int err;
drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
if (!drvdata) if (!drvdata)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); drvdata->base = devm_platform_ioremap_resource(pdev, 0);
drvdata->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(drvdata->base)) if (IS_ERR(drvdata->base))
return PTR_ERR(drvdata->base); return PTR_ERR(drvdata->base);
......
...@@ -204,15 +204,13 @@ static int lpc18xx_wdt_probe(struct platform_device *pdev) ...@@ -204,15 +204,13 @@ static int lpc18xx_wdt_probe(struct platform_device *pdev)
{ {
struct lpc18xx_wdt_dev *lpc18xx_wdt; struct lpc18xx_wdt_dev *lpc18xx_wdt;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct resource *res;
int ret; int ret;
lpc18xx_wdt = devm_kzalloc(dev, sizeof(*lpc18xx_wdt), GFP_KERNEL); lpc18xx_wdt = devm_kzalloc(dev, sizeof(*lpc18xx_wdt), GFP_KERNEL);
if (!lpc18xx_wdt) if (!lpc18xx_wdt)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); lpc18xx_wdt->base = devm_platform_ioremap_resource(pdev, 0);
lpc18xx_wdt->base = devm_ioremap_resource(dev, res);
if (IS_ERR(lpc18xx_wdt->base)) if (IS_ERR(lpc18xx_wdt->base))
return PTR_ERR(lpc18xx_wdt->base); return PTR_ERR(lpc18xx_wdt->base);
......
...@@ -187,9 +187,7 @@ static void max63xx_mmap_set(struct max63xx_wdt *wdt, u8 set) ...@@ -187,9 +187,7 @@ static void max63xx_mmap_set(struct max63xx_wdt *wdt, u8 set)
static int max63xx_mmap_init(struct platform_device *p, struct max63xx_wdt *wdt) static int max63xx_mmap_init(struct platform_device *p, struct max63xx_wdt *wdt)
{ {
struct resource *mem = platform_get_resource(p, IORESOURCE_MEM, 0); wdt->base = devm_platform_ioremap_resource(p, 0);
wdt->base = devm_ioremap_resource(&p->dev, mem);
if (IS_ERR(wdt->base)) if (IS_ERR(wdt->base))
return PTR_ERR(wdt->base); return PTR_ERR(wdt->base);
......
...@@ -139,15 +139,13 @@ MODULE_DEVICE_TABLE(of, meson_gxbb_wdt_dt_ids); ...@@ -139,15 +139,13 @@ MODULE_DEVICE_TABLE(of, meson_gxbb_wdt_dt_ids);
static int meson_gxbb_wdt_probe(struct platform_device *pdev) static int meson_gxbb_wdt_probe(struct platform_device *pdev)
{ {
struct meson_gxbb_wdt *data; struct meson_gxbb_wdt *data;
struct resource *res;
int ret; int ret;
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); data->reg_base = devm_platform_ioremap_resource(pdev, 0);
data->reg_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(data->reg_base)) if (IS_ERR(data->reg_base))
return PTR_ERR(data->reg_base); return PTR_ERR(data->reg_base);
......
...@@ -164,7 +164,6 @@ MODULE_DEVICE_TABLE(of, meson_wdt_dt_ids); ...@@ -164,7 +164,6 @@ MODULE_DEVICE_TABLE(of, meson_wdt_dt_ids);
static int meson_wdt_probe(struct platform_device *pdev) static int meson_wdt_probe(struct platform_device *pdev)
{ {
struct resource *res;
struct meson_wdt_dev *meson_wdt; struct meson_wdt_dev *meson_wdt;
const struct of_device_id *of_id; const struct of_device_id *of_id;
int err; int err;
...@@ -173,8 +172,7 @@ static int meson_wdt_probe(struct platform_device *pdev) ...@@ -173,8 +172,7 @@ static int meson_wdt_probe(struct platform_device *pdev)
if (!meson_wdt) if (!meson_wdt)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); meson_wdt->wdt_base = devm_platform_ioremap_resource(pdev, 0);
meson_wdt->wdt_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(meson_wdt->wdt_base)) if (IS_ERR(meson_wdt->wdt_base))
return PTR_ERR(meson_wdt->wdt_base); return PTR_ERR(meson_wdt->wdt_base);
......
...@@ -92,7 +92,6 @@ static int moxart_wdt_probe(struct platform_device *pdev) ...@@ -92,7 +92,6 @@ static int moxart_wdt_probe(struct platform_device *pdev)
struct moxart_wdt_dev *moxart_wdt; struct moxart_wdt_dev *moxart_wdt;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *node = dev->of_node; struct device_node *node = dev->of_node;
struct resource *res;
struct clk *clk; struct clk *clk;
int err; int err;
unsigned int max_timeout; unsigned int max_timeout;
...@@ -104,8 +103,7 @@ static int moxart_wdt_probe(struct platform_device *pdev) ...@@ -104,8 +103,7 @@ static int moxart_wdt_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, moxart_wdt); platform_set_drvdata(pdev, moxart_wdt);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); moxart_wdt->base = devm_platform_ioremap_resource(pdev, 0);
moxart_wdt->base = devm_ioremap_resource(dev, res);
if (IS_ERR(moxart_wdt->base)) if (IS_ERR(moxart_wdt->base))
return PTR_ERR(moxart_wdt->base); return PTR_ERR(moxart_wdt->base);
......
...@@ -149,8 +149,7 @@ static int mpc8xxx_wdt_probe(struct platform_device *ofdev) ...@@ -149,8 +149,7 @@ static int mpc8xxx_wdt_probe(struct platform_device *ofdev)
if (!ddata) if (!ddata)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(ofdev, IORESOURCE_MEM, 0); ddata->base = devm_platform_ioremap_resource(ofdev, 0);
ddata->base = devm_ioremap_resource(dev, res);
if (IS_ERR(ddata->base)) if (IS_ERR(ddata->base))
return PTR_ERR(ddata->base); return PTR_ERR(ddata->base);
......
...@@ -133,10 +133,7 @@ static struct watchdog_device mt7621_wdt_dev = { ...@@ -133,10 +133,7 @@ static struct watchdog_device mt7621_wdt_dev = {
static int mt7621_wdt_probe(struct platform_device *pdev) static int mt7621_wdt_probe(struct platform_device *pdev)
{ {
struct resource *res; mt7621_wdt_base = devm_platform_ioremap_resource(pdev, 0);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
mt7621_wdt_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(mt7621_wdt_base)) if (IS_ERR(mt7621_wdt_base))
return PTR_ERR(mt7621_wdt_base); return PTR_ERR(mt7621_wdt_base);
......
...@@ -154,7 +154,6 @@ static const struct watchdog_ops mtk_wdt_ops = { ...@@ -154,7 +154,6 @@ static const struct watchdog_ops mtk_wdt_ops = {
static int mtk_wdt_probe(struct platform_device *pdev) static int mtk_wdt_probe(struct platform_device *pdev)
{ {
struct mtk_wdt_dev *mtk_wdt; struct mtk_wdt_dev *mtk_wdt;
struct resource *res;
int err; int err;
mtk_wdt = devm_kzalloc(&pdev->dev, sizeof(*mtk_wdt), GFP_KERNEL); mtk_wdt = devm_kzalloc(&pdev->dev, sizeof(*mtk_wdt), GFP_KERNEL);
...@@ -163,8 +162,7 @@ static int mtk_wdt_probe(struct platform_device *pdev) ...@@ -163,8 +162,7 @@ static int mtk_wdt_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, mtk_wdt); platform_set_drvdata(pdev, mtk_wdt);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); mtk_wdt->wdt_base = devm_platform_ioremap_resource(pdev, 0);
mtk_wdt->wdt_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(mtk_wdt->wdt_base)) if (IS_ERR(mtk_wdt->wdt_base))
return PTR_ERR(mtk_wdt->wdt_base); return PTR_ERR(mtk_wdt->wdt_base);
......
...@@ -181,7 +181,6 @@ static int npcm_wdt_probe(struct platform_device *pdev) ...@@ -181,7 +181,6 @@ static int npcm_wdt_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct npcm_wdt *wdt; struct npcm_wdt *wdt;
struct resource *res;
int irq; int irq;
int ret; int ret;
...@@ -189,8 +188,7 @@ static int npcm_wdt_probe(struct platform_device *pdev) ...@@ -189,8 +188,7 @@ static int npcm_wdt_probe(struct platform_device *pdev)
if (!wdt) if (!wdt)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt->reg = devm_platform_ioremap_resource(pdev, 0);
wdt->reg = devm_ioremap_resource(dev, res);
if (IS_ERR(wdt->reg)) if (IS_ERR(wdt->reg))
return PTR_ERR(wdt->reg); return PTR_ERR(wdt->reg);
......
...@@ -242,7 +242,6 @@ static struct miscdevice nuc900wdt_miscdev = { ...@@ -242,7 +242,6 @@ static struct miscdevice nuc900wdt_miscdev = {
static int nuc900wdt_probe(struct platform_device *pdev) static int nuc900wdt_probe(struct platform_device *pdev)
{ {
struct resource *res;
int ret = 0; int ret = 0;
nuc900_wdt = devm_kzalloc(&pdev->dev, sizeof(*nuc900_wdt), nuc900_wdt = devm_kzalloc(&pdev->dev, sizeof(*nuc900_wdt),
...@@ -254,8 +253,7 @@ static int nuc900wdt_probe(struct platform_device *pdev) ...@@ -254,8 +253,7 @@ static int nuc900wdt_probe(struct platform_device *pdev)
spin_lock_init(&nuc900_wdt->wdt_lock); spin_lock_init(&nuc900_wdt->wdt_lock);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); nuc900_wdt->wdt_base = devm_platform_ioremap_resource(pdev, 0);
nuc900_wdt->wdt_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(nuc900_wdt->wdt_base)) if (IS_ERR(nuc900_wdt->wdt_base))
return PTR_ERR(nuc900_wdt->wdt_base); return PTR_ERR(nuc900_wdt->wdt_base);
......
...@@ -155,7 +155,6 @@ static int xwdt_probe(struct platform_device *pdev) ...@@ -155,7 +155,6 @@ static int xwdt_probe(struct platform_device *pdev)
{ {
int rc; int rc;
u32 pfreq = 0, enable_once = 0; u32 pfreq = 0, enable_once = 0;
struct resource *res;
struct xwdt_device *xdev; struct xwdt_device *xdev;
struct watchdog_device *xilinx_wdt_wdd; struct watchdog_device *xilinx_wdt_wdd;
...@@ -168,8 +167,7 @@ static int xwdt_probe(struct platform_device *pdev) ...@@ -168,8 +167,7 @@ static int xwdt_probe(struct platform_device *pdev)
xilinx_wdt_wdd->ops = &xilinx_wdt_ops; xilinx_wdt_wdd->ops = &xilinx_wdt_ops;
xilinx_wdt_wdd->parent = &pdev->dev; xilinx_wdt_wdd->parent = &pdev->dev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); xdev->base = devm_platform_ioremap_resource(pdev, 0);
xdev->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(xdev->base)) if (IS_ERR(xdev->base))
return PTR_ERR(xdev->base); return PTR_ERR(xdev->base);
......
...@@ -231,7 +231,6 @@ static const struct watchdog_ops omap_wdt_ops = { ...@@ -231,7 +231,6 @@ static const struct watchdog_ops omap_wdt_ops = {
static int omap_wdt_probe(struct platform_device *pdev) static int omap_wdt_probe(struct platform_device *pdev)
{ {
struct omap_wd_timer_platform_data *pdata = dev_get_platdata(&pdev->dev); struct omap_wd_timer_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct resource *res;
struct omap_wdt_dev *wdev; struct omap_wdt_dev *wdev;
int ret; int ret;
...@@ -245,8 +244,7 @@ static int omap_wdt_probe(struct platform_device *pdev) ...@@ -245,8 +244,7 @@ static int omap_wdt_probe(struct platform_device *pdev)
mutex_init(&wdev->lock); mutex_init(&wdev->lock);
/* reserve static register mappings */ /* reserve static register mappings */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdev->base = devm_platform_ioremap_resource(pdev, 0);
wdev->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(wdev->base)) if (IS_ERR(wdev->base))
return PTR_ERR(wdev->base); return PTR_ERR(wdev->base);
......
...@@ -494,8 +494,7 @@ static int orion_wdt_get_regs(struct platform_device *pdev, ...@@ -494,8 +494,7 @@ static int orion_wdt_get_regs(struct platform_device *pdev,
of_device_is_compatible(node, "marvell,armada-xp-wdt")) { of_device_is_compatible(node, "marvell,armada-xp-wdt")) {
/* Dedicated RSTOUT register, can be requested. */ /* Dedicated RSTOUT register, can be requested. */
res = platform_get_resource(pdev, IORESOURCE_MEM, 1); dev->rstout = devm_platform_ioremap_resource(pdev, 1);
dev->rstout = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(dev->rstout)) if (IS_ERR(dev->rstout))
return PTR_ERR(dev->rstout); return PTR_ERR(dev->rstout);
...@@ -503,8 +502,7 @@ static int orion_wdt_get_regs(struct platform_device *pdev, ...@@ -503,8 +502,7 @@ static int orion_wdt_get_regs(struct platform_device *pdev,
of_device_is_compatible(node, "marvell,armada-380-wdt")) { of_device_is_compatible(node, "marvell,armada-380-wdt")) {
/* Dedicated RSTOUT register, can be requested. */ /* Dedicated RSTOUT register, can be requested. */
res = platform_get_resource(pdev, IORESOURCE_MEM, 1); dev->rstout = devm_platform_ioremap_resource(pdev, 1);
dev->rstout = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(dev->rstout)) if (IS_ERR(dev->rstout))
return PTR_ERR(dev->rstout); return PTR_ERR(dev->rstout);
......
...@@ -172,15 +172,13 @@ static int pic32_dmt_probe(struct platform_device *pdev) ...@@ -172,15 +172,13 @@ static int pic32_dmt_probe(struct platform_device *pdev)
{ {
int ret; int ret;
struct pic32_dmt *dmt; struct pic32_dmt *dmt;
struct resource *mem;
struct watchdog_device *wdd = &pic32_dmt_wdd; struct watchdog_device *wdd = &pic32_dmt_wdd;
dmt = devm_kzalloc(&pdev->dev, sizeof(*dmt), GFP_KERNEL); dmt = devm_kzalloc(&pdev->dev, sizeof(*dmt), GFP_KERNEL);
if (!dmt) if (!dmt)
return -ENOMEM; return -ENOMEM;
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); dmt->regs = devm_platform_ioremap_resource(pdev, 0);
dmt->regs = devm_ioremap_resource(&pdev->dev, mem);
if (IS_ERR(dmt->regs)) if (IS_ERR(dmt->regs))
return PTR_ERR(dmt->regs); return PTR_ERR(dmt->regs);
......
...@@ -171,14 +171,12 @@ static int pic32_wdt_drv_probe(struct platform_device *pdev) ...@@ -171,14 +171,12 @@ static int pic32_wdt_drv_probe(struct platform_device *pdev)
int ret; int ret;
struct watchdog_device *wdd = &pic32_wdd; struct watchdog_device *wdd = &pic32_wdd;
struct pic32_wdt *wdt; struct pic32_wdt *wdt;
struct resource *mem;
wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
if (!wdt) if (!wdt)
return -ENOMEM; return -ENOMEM;
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt->regs = devm_platform_ioremap_resource(pdev, 0);
wdt->regs = devm_ioremap_resource(&pdev->dev, mem);
if (IS_ERR(wdt->regs)) if (IS_ERR(wdt->regs))
return PTR_ERR(wdt->regs); return PTR_ERR(wdt->regs);
......
...@@ -185,13 +185,11 @@ static struct watchdog_device pnx4008_wdd = { ...@@ -185,13 +185,11 @@ static struct watchdog_device pnx4008_wdd = {
static int pnx4008_wdt_probe(struct platform_device *pdev) static int pnx4008_wdt_probe(struct platform_device *pdev)
{ {
struct resource *r;
int ret = 0; int ret = 0;
watchdog_init_timeout(&pnx4008_wdd, heartbeat, &pdev->dev); watchdog_init_timeout(&pnx4008_wdd, heartbeat, &pdev->dev);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt_base = devm_platform_ioremap_resource(pdev, 0);
wdt_base = devm_ioremap_resource(&pdev->dev, r);
if (IS_ERR(wdt_base)) if (IS_ERR(wdt_base))
return PTR_ERR(wdt_base); return PTR_ERR(wdt_base);
......
...@@ -177,7 +177,6 @@ static inline bool rwdt_blacklisted(struct device *dev) { return false; } ...@@ -177,7 +177,6 @@ static inline bool rwdt_blacklisted(struct device *dev) { return false; }
static int rwdt_probe(struct platform_device *pdev) static int rwdt_probe(struct platform_device *pdev)
{ {
struct rwdt_priv *priv; struct rwdt_priv *priv;
struct resource *res;
struct clk *clk; struct clk *clk;
unsigned long clks_per_sec; unsigned long clks_per_sec;
int ret, i; int ret, i;
...@@ -189,8 +188,7 @@ static int rwdt_probe(struct platform_device *pdev) ...@@ -189,8 +188,7 @@ static int rwdt_probe(struct platform_device *pdev)
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->base = devm_platform_ioremap_resource(pdev, 0);
priv->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->base)) if (IS_ERR(priv->base))
return PTR_ERR(priv->base); return PTR_ERR(priv->base);
......
...@@ -141,11 +141,9 @@ static struct watchdog_device rt288x_wdt_dev = { ...@@ -141,11 +141,9 @@ static struct watchdog_device rt288x_wdt_dev = {
static int rt288x_wdt_probe(struct platform_device *pdev) static int rt288x_wdt_probe(struct platform_device *pdev)
{ {
struct resource *res;
int ret; int ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); rt288x_wdt_base = devm_platform_ioremap_resource(pdev, 0);
rt288x_wdt_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(rt288x_wdt_base)) if (IS_ERR(rt288x_wdt_base))
return PTR_ERR(rt288x_wdt_base); return PTR_ERR(rt288x_wdt_base);
......
...@@ -98,15 +98,13 @@ static const struct of_device_id rtd119x_wdt_dt_ids[] = { ...@@ -98,15 +98,13 @@ static const struct of_device_id rtd119x_wdt_dt_ids[] = {
static int rtd119x_wdt_probe(struct platform_device *pdev) static int rtd119x_wdt_probe(struct platform_device *pdev)
{ {
struct rtd119x_watchdog_device *data; struct rtd119x_watchdog_device *data;
struct resource *res;
int ret; int ret;
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); data->base = devm_platform_ioremap_resource(pdev, 0);
data->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(data->base)) if (IS_ERR(data->base))
return PTR_ERR(data->base); return PTR_ERR(data->base);
......
...@@ -167,7 +167,6 @@ static const struct watchdog_ops rza_wdt_ops = { ...@@ -167,7 +167,6 @@ static const struct watchdog_ops rza_wdt_ops = {
static int rza_wdt_probe(struct platform_device *pdev) static int rza_wdt_probe(struct platform_device *pdev)
{ {
struct rza_wdt *priv; struct rza_wdt *priv;
struct resource *res;
unsigned long rate; unsigned long rate;
int ret; int ret;
...@@ -175,8 +174,7 @@ static int rza_wdt_probe(struct platform_device *pdev) ...@@ -175,8 +174,7 @@ static int rza_wdt_probe(struct platform_device *pdev)
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->base = devm_platform_ioremap_resource(pdev, 0);
priv->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->base)) if (IS_ERR(priv->base))
return PTR_ERR(priv->base); return PTR_ERR(priv->base);
......
...@@ -522,7 +522,6 @@ static int s3c2410wdt_probe(struct platform_device *pdev) ...@@ -522,7 +522,6 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct s3c2410_wdt *wdt; struct s3c2410_wdt *wdt;
struct resource *wdt_mem;
struct resource *wdt_irq; struct resource *wdt_irq;
unsigned int wtcon; unsigned int wtcon;
int started = 0; int started = 0;
...@@ -554,8 +553,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev) ...@@ -554,8 +553,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
} }
/* get the memory region for the watchdog timer */ /* get the memory region for the watchdog timer */
wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt->reg_base = devm_platform_ioremap_resource(pdev, 0);
wdt->reg_base = devm_ioremap_resource(dev, wdt_mem);
if (IS_ERR(wdt->reg_base)) { if (IS_ERR(wdt->reg_base)) {
ret = PTR_ERR(wdt->reg_base); ret = PTR_ERR(wdt->reg_base);
goto err; goto err;
......
...@@ -201,7 +201,6 @@ static int sama5d4_wdt_probe(struct platform_device *pdev) ...@@ -201,7 +201,6 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)
{ {
struct watchdog_device *wdd; struct watchdog_device *wdd;
struct sama5d4_wdt *wdt; struct sama5d4_wdt *wdt;
struct resource *res;
void __iomem *regs; void __iomem *regs;
u32 irq = 0; u32 irq = 0;
u32 timeout; u32 timeout;
...@@ -221,8 +220,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev) ...@@ -221,8 +220,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)
watchdog_set_drvdata(wdd, wdt); watchdog_set_drvdata(wdd, wdt);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_platform_ioremap_resource(pdev, 0);
regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(regs)) if (IS_ERR(regs))
return PTR_ERR(regs); return PTR_ERR(regs);
......
...@@ -231,7 +231,6 @@ static int sbsa_gwdt_probe(struct platform_device *pdev) ...@@ -231,7 +231,6 @@ static int sbsa_gwdt_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct watchdog_device *wdd; struct watchdog_device *wdd;
struct sbsa_gwdt *gwdt; struct sbsa_gwdt *gwdt;
struct resource *res;
int ret, irq; int ret, irq;
u32 status; u32 status;
...@@ -240,13 +239,11 @@ static int sbsa_gwdt_probe(struct platform_device *pdev) ...@@ -240,13 +239,11 @@ static int sbsa_gwdt_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
platform_set_drvdata(pdev, gwdt); platform_set_drvdata(pdev, gwdt);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); cf_base = devm_platform_ioremap_resource(pdev, 0);
cf_base = devm_ioremap_resource(dev, res);
if (IS_ERR(cf_base)) if (IS_ERR(cf_base))
return PTR_ERR(cf_base); return PTR_ERR(cf_base);
res = platform_get_resource(pdev, IORESOURCE_MEM, 1); rf_base = devm_platform_ioremap_resource(pdev, 1);
rf_base = devm_ioremap_resource(dev, res);
if (IS_ERR(rf_base)) if (IS_ERR(rf_base))
return PTR_ERR(rf_base); return PTR_ERR(rf_base);
......
...@@ -220,7 +220,6 @@ static struct watchdog_device sh_wdt_dev = { ...@@ -220,7 +220,6 @@ static struct watchdog_device sh_wdt_dev = {
static int sh_wdt_probe(struct platform_device *pdev) static int sh_wdt_probe(struct platform_device *pdev)
{ {
struct sh_wdt *wdt; struct sh_wdt *wdt;
struct resource *res;
int rc; int rc;
/* /*
...@@ -245,8 +244,7 @@ static int sh_wdt_probe(struct platform_device *pdev) ...@@ -245,8 +244,7 @@ static int sh_wdt_probe(struct platform_device *pdev)
wdt->clk = NULL; wdt->clk = NULL;
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt->base = devm_platform_ioremap_resource(pdev, 0);
wdt->base = devm_ioremap_resource(wdt->dev, res);
if (IS_ERR(wdt->base)) if (IS_ERR(wdt->base))
return PTR_ERR(wdt->base); return PTR_ERR(wdt->base);
......
...@@ -146,12 +146,10 @@ static struct watchdog_device sirfsoc_wdd = { ...@@ -146,12 +146,10 @@ static struct watchdog_device sirfsoc_wdd = {
static int sirfsoc_wdt_probe(struct platform_device *pdev) static int sirfsoc_wdt_probe(struct platform_device *pdev)
{ {
struct resource *res;
int ret; int ret;
void __iomem *base; void __iomem *base;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_platform_ioremap_resource(pdev, 0);
base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base)) if (IS_ERR(base))
return PTR_ERR(base); return PTR_ERR(base);
......
...@@ -269,7 +269,6 @@ static const struct watchdog_info sprd_wdt_info = { ...@@ -269,7 +269,6 @@ static const struct watchdog_info sprd_wdt_info = {
static int sprd_wdt_probe(struct platform_device *pdev) static int sprd_wdt_probe(struct platform_device *pdev)
{ {
struct resource *wdt_res;
struct sprd_wdt *wdt; struct sprd_wdt *wdt;
int ret; int ret;
...@@ -277,8 +276,7 @@ static int sprd_wdt_probe(struct platform_device *pdev) ...@@ -277,8 +276,7 @@ static int sprd_wdt_probe(struct platform_device *pdev)
if (!wdt) if (!wdt)
return -ENOMEM; return -ENOMEM;
wdt_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt->base = devm_platform_ioremap_resource(pdev, 0);
wdt->base = devm_ioremap_resource(&pdev->dev, wdt_res);
if (IS_ERR(wdt->base)) if (IS_ERR(wdt->base))
return PTR_ERR(wdt->base); return PTR_ERR(wdt->base);
......
...@@ -148,7 +148,6 @@ static int st_wdog_probe(struct platform_device *pdev) ...@@ -148,7 +148,6 @@ static int st_wdog_probe(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct st_wdog *st_wdog; struct st_wdog *st_wdog;
struct regmap *regmap; struct regmap *regmap;
struct resource *res;
struct clk *clk; struct clk *clk;
void __iomem *base; void __iomem *base;
uint32_t mode; uint32_t mode;
...@@ -175,8 +174,7 @@ static int st_wdog_probe(struct platform_device *pdev) ...@@ -175,8 +174,7 @@ static int st_wdog_probe(struct platform_device *pdev)
} }
st_wdog->syscfg = (struct st_wdog_syscfg *)match->data; st_wdog->syscfg = (struct st_wdog_syscfg *)match->data;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_platform_ioremap_resource(pdev, 0);
base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base)) if (IS_ERR(base))
return PTR_ERR(base); return PTR_ERR(base);
......
...@@ -202,7 +202,6 @@ static int stm32_iwdg_probe(struct platform_device *pdev) ...@@ -202,7 +202,6 @@ static int stm32_iwdg_probe(struct platform_device *pdev)
struct watchdog_device *wdd; struct watchdog_device *wdd;
const struct of_device_id *match; const struct of_device_id *match;
struct stm32_iwdg *wdt; struct stm32_iwdg *wdt;
struct resource *res;
int ret; int ret;
match = of_match_device(stm32_iwdg_of_match, &pdev->dev); match = of_match_device(stm32_iwdg_of_match, &pdev->dev);
...@@ -216,8 +215,7 @@ static int stm32_iwdg_probe(struct platform_device *pdev) ...@@ -216,8 +215,7 @@ static int stm32_iwdg_probe(struct platform_device *pdev)
wdt->has_pclk = match->data; wdt->has_pclk = match->data;
/* This is the timer base. */ /* This is the timer base. */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt->regs = devm_platform_ioremap_resource(pdev, 0);
wdt->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(wdt->regs)) { if (IS_ERR(wdt->regs)) {
dev_err(&pdev->dev, "Could not get resource\n"); dev_err(&pdev->dev, "Could not get resource\n");
return PTR_ERR(wdt->regs); return PTR_ERR(wdt->regs);
......
...@@ -234,7 +234,6 @@ MODULE_DEVICE_TABLE(of, sunxi_wdt_dt_ids); ...@@ -234,7 +234,6 @@ MODULE_DEVICE_TABLE(of, sunxi_wdt_dt_ids);
static int sunxi_wdt_probe(struct platform_device *pdev) static int sunxi_wdt_probe(struct platform_device *pdev)
{ {
struct sunxi_wdt_dev *sunxi_wdt; struct sunxi_wdt_dev *sunxi_wdt;
struct resource *res;
int err; int err;
sunxi_wdt = devm_kzalloc(&pdev->dev, sizeof(*sunxi_wdt), GFP_KERNEL); sunxi_wdt = devm_kzalloc(&pdev->dev, sizeof(*sunxi_wdt), GFP_KERNEL);
...@@ -245,8 +244,7 @@ static int sunxi_wdt_probe(struct platform_device *pdev) ...@@ -245,8 +244,7 @@ static int sunxi_wdt_probe(struct platform_device *pdev)
if (!sunxi_wdt->wdt_regs) if (!sunxi_wdt->wdt_regs)
return -ENODEV; return -ENODEV;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); sunxi_wdt->wdt_base = devm_platform_ioremap_resource(pdev, 0);
sunxi_wdt->wdt_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(sunxi_wdt->wdt_base)) if (IS_ERR(sunxi_wdt->wdt_base))
return PTR_ERR(sunxi_wdt->wdt_base); return PTR_ERR(sunxi_wdt->wdt_base);
......
...@@ -111,7 +111,6 @@ static const struct watchdog_ops tangox_wdt_ops = { ...@@ -111,7 +111,6 @@ static const struct watchdog_ops tangox_wdt_ops = {
static int tangox_wdt_probe(struct platform_device *pdev) static int tangox_wdt_probe(struct platform_device *pdev)
{ {
struct tangox_wdt_device *dev; struct tangox_wdt_device *dev;
struct resource *res;
u32 config; u32 config;
int err; int err;
...@@ -119,8 +118,7 @@ static int tangox_wdt_probe(struct platform_device *pdev) ...@@ -119,8 +118,7 @@ static int tangox_wdt_probe(struct platform_device *pdev)
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); dev->base = devm_platform_ioremap_resource(pdev, 0);
dev->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(dev->base)) if (IS_ERR(dev->base))
return PTR_ERR(dev->base); return PTR_ERR(dev->base);
......
...@@ -183,13 +183,11 @@ static int tegra_wdt_probe(struct platform_device *pdev) ...@@ -183,13 +183,11 @@ static int tegra_wdt_probe(struct platform_device *pdev)
{ {
struct watchdog_device *wdd; struct watchdog_device *wdd;
struct tegra_wdt *wdt; struct tegra_wdt *wdt;
struct resource *res;
void __iomem *regs; void __iomem *regs;
int ret; int ret;
/* This is the timer base. */ /* This is the timer base. */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_platform_ioremap_resource(pdev, 0);
regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(regs)) if (IS_ERR(regs))
return PTR_ERR(regs); return PTR_ERR(regs);
......
...@@ -124,20 +124,17 @@ static int ts72xx_wdt_probe(struct platform_device *pdev) ...@@ -124,20 +124,17 @@ static int ts72xx_wdt_probe(struct platform_device *pdev)
{ {
struct ts72xx_wdt_priv *priv; struct ts72xx_wdt_priv *priv;
struct watchdog_device *wdd; struct watchdog_device *wdd;
struct resource *res;
int ret; int ret;
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->control_reg = devm_platform_ioremap_resource(pdev, 0);
priv->control_reg = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->control_reg)) if (IS_ERR(priv->control_reg))
return PTR_ERR(priv->control_reg); return PTR_ERR(priv->control_reg);
res = platform_get_resource(pdev, IORESOURCE_MEM, 1); priv->feed_reg = devm_platform_ioremap_resource(pdev, 1);
priv->feed_reg = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->feed_reg)) if (IS_ERR(priv->feed_reg))
return PTR_ERR(priv->feed_reg); return PTR_ERR(priv->feed_reg);
......
...@@ -103,7 +103,6 @@ static struct watchdog_device txx9wdt = { ...@@ -103,7 +103,6 @@ static struct watchdog_device txx9wdt = {
static int __init txx9wdt_probe(struct platform_device *dev) static int __init txx9wdt_probe(struct platform_device *dev)
{ {
struct resource *res;
int ret; int ret;
txx9_imclk = clk_get(NULL, "imbus_clk"); txx9_imclk = clk_get(NULL, "imbus_clk");
...@@ -119,8 +118,7 @@ static int __init txx9wdt_probe(struct platform_device *dev) ...@@ -119,8 +118,7 @@ static int __init txx9wdt_probe(struct platform_device *dev)
goto exit; goto exit;
} }
res = platform_get_resource(dev, IORESOURCE_MEM, 0); txx9wdt_reg = devm_platform_ioremap_resource(dev, 0);
txx9wdt_reg = devm_ioremap_resource(&dev->dev, res);
if (IS_ERR(txx9wdt_reg)) { if (IS_ERR(txx9wdt_reg)) {
ret = PTR_ERR(txx9wdt_reg); ret = PTR_ERR(txx9wdt_reg);
goto exit; goto exit;
......
...@@ -192,7 +192,6 @@ static int zx2967_wdt_probe(struct platform_device *pdev) ...@@ -192,7 +192,6 @@ static int zx2967_wdt_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct zx2967_wdt *wdt; struct zx2967_wdt *wdt;
struct resource *base;
int ret; int ret;
struct reset_control *rstc; struct reset_control *rstc;
...@@ -209,8 +208,7 @@ static int zx2967_wdt_probe(struct platform_device *pdev) ...@@ -209,8 +208,7 @@ static int zx2967_wdt_probe(struct platform_device *pdev)
wdt->wdt_device.min_timeout = ZX2967_WDT_MIN_TIMEOUT; wdt->wdt_device.min_timeout = ZX2967_WDT_MIN_TIMEOUT;
wdt->wdt_device.parent = &pdev->dev; wdt->wdt_device.parent = &pdev->dev;
base = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt->reg_base = devm_platform_ioremap_resource(pdev, 0);
wdt->reg_base = devm_ioremap_resource(dev, base);
if (IS_ERR(wdt->reg_base)) if (IS_ERR(wdt->reg_base))
return PTR_ERR(wdt->reg_base); return PTR_ERR(wdt->reg_base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment