Commit 09ef18bc authored by YueHaibing's avatar YueHaibing Committed by Alexandre Belloni

rtc: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20191006102953.57536-2-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-3-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-4-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-5-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-6-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-7-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-8-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-9-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-10-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-11-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-12-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-13-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-14-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-15-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-16-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-17-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-18-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-19-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-20-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-21-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-22-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-23-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-24-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-25-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-26-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-27-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-28-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-29-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-30-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-31-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-32-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-33-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-34-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-35-yuehaibing@huawei.comSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 89576beb
...@@ -245,7 +245,6 @@ static int asm9260_rtc_probe(struct platform_device *pdev) ...@@ -245,7 +245,6 @@ static int asm9260_rtc_probe(struct platform_device *pdev)
{ {
struct asm9260_rtc_priv *priv; struct asm9260_rtc_priv *priv;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct resource *res;
int irq_alarm, ret; int irq_alarm, ret;
u32 ccr; u32 ccr;
...@@ -260,8 +259,7 @@ static int asm9260_rtc_probe(struct platform_device *pdev) ...@@ -260,8 +259,7 @@ static int asm9260_rtc_probe(struct platform_device *pdev)
if (irq_alarm < 0) if (irq_alarm < 0)
return irq_alarm; return irq_alarm;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->iobase = devm_platform_ioremap_resource(pdev, 0);
priv->iobase = devm_ioremap_resource(dev, res);
if (IS_ERR(priv->iobase)) if (IS_ERR(priv->iobase))
return PTR_ERR(priv->iobase); return PTR_ERR(priv->iobase);
......
...@@ -85,14 +85,12 @@ static const struct rtc_class_ops aspeed_rtc_ops = { ...@@ -85,14 +85,12 @@ static const struct rtc_class_ops aspeed_rtc_ops = {
static int aspeed_rtc_probe(struct platform_device *pdev) static int aspeed_rtc_probe(struct platform_device *pdev)
{ {
struct aspeed_rtc *rtc; struct aspeed_rtc *rtc;
struct resource *res;
rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
if (!rtc) if (!rtc)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); rtc->base = devm_platform_ioremap_resource(pdev, 0);
rtc->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(rtc->base)) if (IS_ERR(rtc->base))
return PTR_ERR(rtc->base); return PTR_ERR(rtc->base);
......
...@@ -334,7 +334,6 @@ static const struct rtc_class_ops at91_rtc_ops = { ...@@ -334,7 +334,6 @@ static const struct rtc_class_ops at91_rtc_ops = {
*/ */
static int at91_rtc_probe(struct platform_device *pdev) static int at91_rtc_probe(struct platform_device *pdev)
{ {
struct resource *r;
struct sam9_rtc *rtc; struct sam9_rtc *rtc;
int ret, irq; int ret, irq;
u32 mr; u32 mr;
...@@ -358,8 +357,7 @@ static int at91_rtc_probe(struct platform_device *pdev) ...@@ -358,8 +357,7 @@ static int at91_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, rtc); platform_set_drvdata(pdev, rtc);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); rtc->rtt = devm_platform_ioremap_resource(pdev, 0);
rtc->rtt = devm_ioremap_resource(&pdev->dev, r);
if (IS_ERR(rtc->rtt)) if (IS_ERR(rtc->rtt))
return PTR_ERR(rtc->rtt); return PTR_ERR(rtc->rtt);
......
...@@ -200,7 +200,6 @@ static int brcmstb_waketmr_probe(struct platform_device *pdev) ...@@ -200,7 +200,6 @@ static int brcmstb_waketmr_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct brcmstb_waketmr *timer; struct brcmstb_waketmr *timer;
struct resource *res;
int ret; int ret;
timer = devm_kzalloc(dev, sizeof(*timer), GFP_KERNEL); timer = devm_kzalloc(dev, sizeof(*timer), GFP_KERNEL);
...@@ -210,8 +209,7 @@ static int brcmstb_waketmr_probe(struct platform_device *pdev) ...@@ -210,8 +209,7 @@ static int brcmstb_waketmr_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, timer); platform_set_drvdata(pdev, timer);
timer->dev = dev; timer->dev = dev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); timer->base = devm_platform_ioremap_resource(pdev, 0);
timer->base = devm_ioremap_resource(dev, res);
if (IS_ERR(timer->base)) if (IS_ERR(timer->base))
return PTR_ERR(timer->base); return PTR_ERR(timer->base);
......
...@@ -255,7 +255,6 @@ static const struct rtc_class_ops cdns_rtc_ops = { ...@@ -255,7 +255,6 @@ static const struct rtc_class_ops cdns_rtc_ops = {
static int cdns_rtc_probe(struct platform_device *pdev) static int cdns_rtc_probe(struct platform_device *pdev)
{ {
struct cdns_rtc *crtc; struct cdns_rtc *crtc;
struct resource *res;
int ret; int ret;
unsigned long ref_clk_freq; unsigned long ref_clk_freq;
...@@ -263,8 +262,7 @@ static int cdns_rtc_probe(struct platform_device *pdev) ...@@ -263,8 +262,7 @@ static int cdns_rtc_probe(struct platform_device *pdev)
if (!crtc) if (!crtc)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); crtc->regs = devm_platform_ioremap_resource(pdev, 0);
crtc->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(crtc->regs)) if (IS_ERR(crtc->regs))
return PTR_ERR(crtc->regs); return PTR_ERR(crtc->regs);
......
...@@ -164,15 +164,13 @@ static int __init coh901331_probe(struct platform_device *pdev) ...@@ -164,15 +164,13 @@ static int __init coh901331_probe(struct platform_device *pdev)
{ {
int ret; int ret;
struct coh901331_port *rtap; struct coh901331_port *rtap;
struct resource *res;
rtap = devm_kzalloc(&pdev->dev, rtap = devm_kzalloc(&pdev->dev,
sizeof(struct coh901331_port), GFP_KERNEL); sizeof(struct coh901331_port), GFP_KERNEL);
if (!rtap) if (!rtap)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); rtap->virtbase = devm_platform_ioremap_resource(pdev, 0);
rtap->virtbase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(rtap->virtbase)) if (IS_ERR(rtap->virtbase))
return PTR_ERR(rtap->virtbase); return PTR_ERR(rtap->virtbase);
......
...@@ -469,7 +469,6 @@ static int __init davinci_rtc_probe(struct platform_device *pdev) ...@@ -469,7 +469,6 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct davinci_rtc *davinci_rtc; struct davinci_rtc *davinci_rtc;
struct resource *res;
int ret = 0; int ret = 0;
davinci_rtc = devm_kzalloc(&pdev->dev, sizeof(struct davinci_rtc), GFP_KERNEL); davinci_rtc = devm_kzalloc(&pdev->dev, sizeof(struct davinci_rtc), GFP_KERNEL);
...@@ -480,8 +479,7 @@ static int __init davinci_rtc_probe(struct platform_device *pdev) ...@@ -480,8 +479,7 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
if (davinci_rtc->irq < 0) if (davinci_rtc->irq < 0)
return davinci_rtc->irq; return davinci_rtc->irq;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); davinci_rtc->base = devm_platform_ioremap_resource(pdev, 0);
davinci_rtc->base = devm_ioremap_resource(dev, res);
if (IS_ERR(davinci_rtc->base)) if (IS_ERR(davinci_rtc->base))
return PTR_ERR(davinci_rtc->base); return PTR_ERR(davinci_rtc->base);
......
...@@ -175,7 +175,6 @@ static irqreturn_t dc_rtc_irq(int irq, void *dev_id) ...@@ -175,7 +175,6 @@ static irqreturn_t dc_rtc_irq(int irq, void *dev_id)
static int __init dc_rtc_probe(struct platform_device *pdev) static int __init dc_rtc_probe(struct platform_device *pdev)
{ {
struct resource *res;
struct dc_rtc *rtc; struct dc_rtc *rtc;
int irq, ret; int irq, ret;
...@@ -183,8 +182,7 @@ static int __init dc_rtc_probe(struct platform_device *pdev) ...@@ -183,8 +182,7 @@ static int __init dc_rtc_probe(struct platform_device *pdev)
if (!rtc) if (!rtc)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); rtc->regs = devm_platform_ioremap_resource(pdev, 0);
rtc->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(rtc->regs)) if (IS_ERR(rtc->regs))
return PTR_ERR(rtc->regs); return PTR_ERR(rtc->regs);
......
...@@ -137,7 +137,6 @@ static const struct rtc_class_ops ds1216_rtc_ops = { ...@@ -137,7 +137,6 @@ static const struct rtc_class_ops ds1216_rtc_ops = {
static int __init ds1216_rtc_probe(struct platform_device *pdev) static int __init ds1216_rtc_probe(struct platform_device *pdev)
{ {
struct resource *res;
struct ds1216_priv *priv; struct ds1216_priv *priv;
u8 dummy[8]; u8 dummy[8];
...@@ -147,8 +146,7 @@ static int __init ds1216_rtc_probe(struct platform_device *pdev) ...@@ -147,8 +146,7 @@ static int __init ds1216_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv); platform_set_drvdata(pdev, priv);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->ioaddr = devm_platform_ioremap_resource(pdev, 0);
priv->ioaddr = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->ioaddr)) if (IS_ERR(priv->ioaddr))
return PTR_ERR(priv->ioaddr); return PTR_ERR(priv->ioaddr);
......
...@@ -323,15 +323,13 @@ static const struct rtc_class_ops ds1286_ops = { ...@@ -323,15 +323,13 @@ static const struct rtc_class_ops ds1286_ops = {
static int ds1286_probe(struct platform_device *pdev) static int ds1286_probe(struct platform_device *pdev)
{ {
struct rtc_device *rtc; struct rtc_device *rtc;
struct resource *res;
struct ds1286_priv *priv; struct ds1286_priv *priv;
priv = devm_kzalloc(&pdev->dev, sizeof(struct ds1286_priv), GFP_KERNEL); priv = devm_kzalloc(&pdev->dev, sizeof(struct ds1286_priv), GFP_KERNEL);
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->rtcregs = devm_platform_ioremap_resource(pdev, 0);
priv->rtcregs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(priv->rtcregs)) if (IS_ERR(priv->rtcregs))
return PTR_ERR(priv->rtcregs); return PTR_ERR(priv->rtcregs);
......
...@@ -414,7 +414,6 @@ static int ds1511_nvram_write(void *priv, unsigned int pos, void *buf, ...@@ -414,7 +414,6 @@ static int ds1511_nvram_write(void *priv, unsigned int pos, void *buf,
static int ds1511_rtc_probe(struct platform_device *pdev) static int ds1511_rtc_probe(struct platform_device *pdev)
{ {
struct resource *res;
struct rtc_plat_data *pdata; struct rtc_plat_data *pdata;
int ret = 0; int ret = 0;
struct nvmem_config ds1511_nvmem_cfg = { struct nvmem_config ds1511_nvmem_cfg = {
...@@ -431,8 +430,7 @@ static int ds1511_rtc_probe(struct platform_device *pdev) ...@@ -431,8 +430,7 @@ static int ds1511_rtc_probe(struct platform_device *pdev)
if (!pdata) if (!pdata)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ds1511_base = devm_platform_ioremap_resource(pdev, 0);
ds1511_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(ds1511_base)) if (IS_ERR(ds1511_base))
return PTR_ERR(ds1511_base); return PTR_ERR(ds1511_base);
pdata->ioaddr = ds1511_base; pdata->ioaddr = ds1511_base;
......
...@@ -249,7 +249,6 @@ static int ds1553_nvram_write(void *priv, unsigned int pos, void *val, ...@@ -249,7 +249,6 @@ static int ds1553_nvram_write(void *priv, unsigned int pos, void *val,
static int ds1553_rtc_probe(struct platform_device *pdev) static int ds1553_rtc_probe(struct platform_device *pdev)
{ {
struct resource *res;
unsigned int cen, sec; unsigned int cen, sec;
struct rtc_plat_data *pdata; struct rtc_plat_data *pdata;
void __iomem *ioaddr; void __iomem *ioaddr;
...@@ -268,8 +267,7 @@ static int ds1553_rtc_probe(struct platform_device *pdev) ...@@ -268,8 +267,7 @@ static int ds1553_rtc_probe(struct platform_device *pdev)
if (!pdata) if (!pdata)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ioaddr = devm_platform_ioremap_resource(pdev, 0);
ioaddr = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(ioaddr)) if (IS_ERR(ioaddr))
return PTR_ERR(ioaddr); return PTR_ERR(ioaddr);
pdata->ioaddr = ioaddr; pdata->ioaddr = ioaddr;
......
...@@ -122,15 +122,13 @@ static const struct attribute_group ep93xx_rtc_sysfs_files = { ...@@ -122,15 +122,13 @@ static const struct attribute_group ep93xx_rtc_sysfs_files = {
static int ep93xx_rtc_probe(struct platform_device *pdev) static int ep93xx_rtc_probe(struct platform_device *pdev)
{ {
struct ep93xx_rtc *ep93xx_rtc; struct ep93xx_rtc *ep93xx_rtc;
struct resource *res;
int err; int err;
ep93xx_rtc = devm_kzalloc(&pdev->dev, sizeof(*ep93xx_rtc), GFP_KERNEL); ep93xx_rtc = devm_kzalloc(&pdev->dev, sizeof(*ep93xx_rtc), GFP_KERNEL);
if (!ep93xx_rtc) if (!ep93xx_rtc)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ep93xx_rtc->mmio_base = devm_platform_ioremap_resource(pdev, 0);
ep93xx_rtc->mmio_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(ep93xx_rtc->mmio_base)) if (IS_ERR(ep93xx_rtc->mmio_base))
return PTR_ERR(ep93xx_rtc->mmio_base); return PTR_ERR(ep93xx_rtc->mmio_base);
......
...@@ -307,7 +307,6 @@ static int jz4740_rtc_probe(struct platform_device *pdev) ...@@ -307,7 +307,6 @@ static int jz4740_rtc_probe(struct platform_device *pdev)
{ {
int ret; int ret;
struct jz4740_rtc *rtc; struct jz4740_rtc *rtc;
struct resource *mem;
const struct platform_device_id *id = platform_get_device_id(pdev); const struct platform_device_id *id = platform_get_device_id(pdev);
const struct of_device_id *of_id = of_match_device( const struct of_device_id *of_id = of_match_device(
jz4740_rtc_of_match, &pdev->dev); jz4740_rtc_of_match, &pdev->dev);
...@@ -326,8 +325,7 @@ static int jz4740_rtc_probe(struct platform_device *pdev) ...@@ -326,8 +325,7 @@ static int jz4740_rtc_probe(struct platform_device *pdev)
if (rtc->irq < 0) if (rtc->irq < 0)
return -ENOENT; return -ENOENT;
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); rtc->base = devm_platform_ioremap_resource(pdev, 0);
rtc->base = devm_ioremap_resource(&pdev->dev, mem);
if (IS_ERR(rtc->base)) if (IS_ERR(rtc->base))
return PTR_ERR(rtc->base); return PTR_ERR(rtc->base);
......
...@@ -194,15 +194,13 @@ static const struct rtc_class_ops lpc24xx_rtc_ops = { ...@@ -194,15 +194,13 @@ static const struct rtc_class_ops lpc24xx_rtc_ops = {
static int lpc24xx_rtc_probe(struct platform_device *pdev) static int lpc24xx_rtc_probe(struct platform_device *pdev)
{ {
struct lpc24xx_rtc *rtc; struct lpc24xx_rtc *rtc;
struct resource *res;
int irq, ret; int irq, ret;
rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
if (!rtc) if (!rtc)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); rtc->rtc_base = devm_platform_ioremap_resource(pdev, 0);
rtc->rtc_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(rtc->rtc_base)) if (IS_ERR(rtc->rtc_base))
return PTR_ERR(rtc->rtc_base); return PTR_ERR(rtc->rtc_base);
......
...@@ -185,7 +185,6 @@ static const struct rtc_class_ops lpc32xx_rtc_ops = { ...@@ -185,7 +185,6 @@ static const struct rtc_class_ops lpc32xx_rtc_ops = {
static int lpc32xx_rtc_probe(struct platform_device *pdev) static int lpc32xx_rtc_probe(struct platform_device *pdev)
{ {
struct resource *res;
struct lpc32xx_rtc *rtc; struct lpc32xx_rtc *rtc;
int err; int err;
u32 tmp; u32 tmp;
...@@ -194,8 +193,7 @@ static int lpc32xx_rtc_probe(struct platform_device *pdev) ...@@ -194,8 +193,7 @@ static int lpc32xx_rtc_probe(struct platform_device *pdev)
if (unlikely(!rtc)) if (unlikely(!rtc))
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); rtc->rtc_base = devm_platform_ioremap_resource(pdev, 0);
rtc->rtc_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(rtc->rtc_base)) if (IS_ERR(rtc->rtc_base))
return PTR_ERR(rtc->rtc_base); return PTR_ERR(rtc->rtc_base);
......
...@@ -292,7 +292,6 @@ static int meson_rtc_probe(struct platform_device *pdev) ...@@ -292,7 +292,6 @@ static int meson_rtc_probe(struct platform_device *pdev)
}; };
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct meson_rtc *rtc; struct meson_rtc *rtc;
struct resource *res;
void __iomem *base; void __iomem *base;
int ret; int ret;
u32 tm; u32 tm;
...@@ -312,8 +311,7 @@ static int meson_rtc_probe(struct platform_device *pdev) ...@@ -312,8 +311,7 @@ static int meson_rtc_probe(struct platform_device *pdev)
rtc->rtc->ops = &meson_rtc_ops; rtc->rtc->ops = &meson_rtc_ops;
rtc->rtc->range_max = U32_MAX; rtc->rtc->range_max = U32_MAX;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_platform_ioremap_resource(pdev, 0);
base = devm_ioremap_resource(dev, res);
if (IS_ERR(base)) if (IS_ERR(base))
return PTR_ERR(base); return PTR_ERR(base);
......
...@@ -303,7 +303,6 @@ MODULE_DEVICE_TABLE(of, mtk_rtc_match); ...@@ -303,7 +303,6 @@ MODULE_DEVICE_TABLE(of, mtk_rtc_match);
static int mtk_rtc_probe(struct platform_device *pdev) static int mtk_rtc_probe(struct platform_device *pdev)
{ {
struct mtk_rtc *hw; struct mtk_rtc *hw;
struct resource *res;
int ret; int ret;
hw = devm_kzalloc(&pdev->dev, sizeof(*hw), GFP_KERNEL); hw = devm_kzalloc(&pdev->dev, sizeof(*hw), GFP_KERNEL);
...@@ -312,8 +311,7 @@ static int mtk_rtc_probe(struct platform_device *pdev) ...@@ -312,8 +311,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, hw); platform_set_drvdata(pdev, hw);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hw->base = devm_platform_ioremap_resource(pdev, 0);
hw->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(hw->base)) if (IS_ERR(hw->base))
return PTR_ERR(hw->base); return PTR_ERR(hw->base);
......
...@@ -212,7 +212,6 @@ static const struct rtc_class_ops mv_rtc_alarm_ops = { ...@@ -212,7 +212,6 @@ static const struct rtc_class_ops mv_rtc_alarm_ops = {
static int __init mv_rtc_probe(struct platform_device *pdev) static int __init mv_rtc_probe(struct platform_device *pdev)
{ {
struct resource *res;
struct rtc_plat_data *pdata; struct rtc_plat_data *pdata;
u32 rtc_time; u32 rtc_time;
int ret = 0; int ret = 0;
...@@ -221,8 +220,7 @@ static int __init mv_rtc_probe(struct platform_device *pdev) ...@@ -221,8 +220,7 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
if (!pdata) if (!pdata)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pdata->ioaddr = devm_platform_ioremap_resource(pdev, 0);
pdata->ioaddr = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pdata->ioaddr)) if (IS_ERR(pdata->ioaddr))
return PTR_ERR(pdata->ioaddr); return PTR_ERR(pdata->ioaddr);
......
...@@ -727,7 +727,6 @@ static struct nvmem_config omap_rtc_nvmem_config = { ...@@ -727,7 +727,6 @@ static struct nvmem_config omap_rtc_nvmem_config = {
static int omap_rtc_probe(struct platform_device *pdev) static int omap_rtc_probe(struct platform_device *pdev)
{ {
struct omap_rtc *rtc; struct omap_rtc *rtc;
struct resource *res;
u8 reg, mask, new_ctrl; u8 reg, mask, new_ctrl;
const struct platform_device_id *id_entry; const struct platform_device_id *id_entry;
const struct of_device_id *of_id; const struct of_device_id *of_id;
...@@ -764,8 +763,7 @@ static int omap_rtc_probe(struct platform_device *pdev) ...@@ -764,8 +763,7 @@ static int omap_rtc_probe(struct platform_device *pdev)
if (!IS_ERR(rtc->clk)) if (!IS_ERR(rtc->clk))
clk_prepare_enable(rtc->clk); clk_prepare_enable(rtc->clk);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); rtc->base = devm_platform_ioremap_resource(pdev, 0);
rtc->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(rtc->base)) { if (IS_ERR(rtc->base)) {
clk_disable_unprepare(rtc->clk); clk_disable_unprepare(rtc->clk);
return PTR_ERR(rtc->base); return PTR_ERR(rtc->base);
......
...@@ -298,7 +298,6 @@ static int pic32_rtc_remove(struct platform_device *pdev) ...@@ -298,7 +298,6 @@ static int pic32_rtc_remove(struct platform_device *pdev)
static int pic32_rtc_probe(struct platform_device *pdev) static int pic32_rtc_probe(struct platform_device *pdev)
{ {
struct pic32_rtc_dev *pdata; struct pic32_rtc_dev *pdata;
struct resource *res;
int ret; int ret;
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
...@@ -311,8 +310,7 @@ static int pic32_rtc_probe(struct platform_device *pdev) ...@@ -311,8 +310,7 @@ static int pic32_rtc_probe(struct platform_device *pdev)
if (pdata->alarm_irq < 0) if (pdata->alarm_irq < 0)
return pdata->alarm_irq; return pdata->alarm_irq;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pdata->reg_base = devm_platform_ioremap_resource(pdev, 0);
pdata->reg_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pdata->reg_base)) if (IS_ERR(pdata->reg_base))
return PTR_ERR(pdata->reg_base); return PTR_ERR(pdata->reg_base);
......
...@@ -167,7 +167,6 @@ static const struct of_device_id rtd119x_rtc_dt_ids[] = { ...@@ -167,7 +167,6 @@ static const struct of_device_id rtd119x_rtc_dt_ids[] = {
static int rtd119x_rtc_probe(struct platform_device *pdev) static int rtd119x_rtc_probe(struct platform_device *pdev)
{ {
struct rtd119x_rtc *data; struct rtd119x_rtc *data;
struct resource *res;
u32 val; u32 val;
int ret; int ret;
...@@ -178,8 +177,7 @@ static int rtd119x_rtc_probe(struct platform_device *pdev) ...@@ -178,8 +177,7 @@ static int rtd119x_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, data); platform_set_drvdata(pdev, data);
data->base_year = 2014; data->base_year = 2014;
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);
......
...@@ -444,7 +444,6 @@ static int s3c_rtc_probe(struct platform_device *pdev) ...@@ -444,7 +444,6 @@ static int s3c_rtc_probe(struct platform_device *pdev)
{ {
struct s3c_rtc *info = NULL; struct s3c_rtc *info = NULL;
struct rtc_time rtc_tm; struct rtc_time rtc_tm;
struct resource *res;
int ret; int ret;
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
...@@ -475,8 +474,7 @@ static int s3c_rtc_probe(struct platform_device *pdev) ...@@ -475,8 +474,7 @@ static int s3c_rtc_probe(struct platform_device *pdev)
info->irq_tick, info->irq_alarm); info->irq_tick, info->irq_alarm);
/* get the memory region */ /* get the memory region */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); info->base = devm_platform_ioremap_resource(pdev, 0);
info->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(info->base)) if (IS_ERR(info->base))
return PTR_ERR(info->base); return PTR_ERR(info->base);
......
...@@ -252,7 +252,6 @@ EXPORT_SYMBOL_GPL(sa1100_rtc_init); ...@@ -252,7 +252,6 @@ EXPORT_SYMBOL_GPL(sa1100_rtc_init);
static int sa1100_rtc_probe(struct platform_device *pdev) static int sa1100_rtc_probe(struct platform_device *pdev)
{ {
struct sa1100_rtc *info; struct sa1100_rtc *info;
struct resource *iores;
void __iomem *base; void __iomem *base;
int irq_1hz, irq_alarm; int irq_1hz, irq_alarm;
int ret; int ret;
...@@ -281,8 +280,7 @@ static int sa1100_rtc_probe(struct platform_device *pdev) ...@@ -281,8 +280,7 @@ static int sa1100_rtc_probe(struct platform_device *pdev)
return ret; return ret;
} }
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_platform_ioremap_resource(pdev, 0);
base = devm_ioremap_resource(&pdev->dev, iores);
if (IS_ERR(base)) if (IS_ERR(base))
return PTR_ERR(base); return PTR_ERR(base);
......
...@@ -347,7 +347,6 @@ static const struct rtc_class_ops spear_rtc_ops = { ...@@ -347,7 +347,6 @@ static const struct rtc_class_ops spear_rtc_ops = {
static int spear_rtc_probe(struct platform_device *pdev) static int spear_rtc_probe(struct platform_device *pdev)
{ {
struct resource *res;
struct spear_rtc_config *config; struct spear_rtc_config *config;
int status = 0; int status = 0;
int irq; int irq;
...@@ -369,8 +368,7 @@ static int spear_rtc_probe(struct platform_device *pdev) ...@@ -369,8 +368,7 @@ static int spear_rtc_probe(struct platform_device *pdev)
return status; return status;
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); config->ioaddr = devm_platform_ioremap_resource(pdev, 0);
config->ioaddr = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(config->ioaddr)) if (IS_ERR(config->ioaddr))
return PTR_ERR(config->ioaddr); return PTR_ERR(config->ioaddr);
......
...@@ -186,7 +186,6 @@ static int st_rtc_probe(struct platform_device *pdev) ...@@ -186,7 +186,6 @@ static int st_rtc_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct st_rtc *rtc; struct st_rtc *rtc;
struct resource *res;
uint32_t mode; uint32_t mode;
int ret = 0; int ret = 0;
...@@ -210,8 +209,7 @@ static int st_rtc_probe(struct platform_device *pdev) ...@@ -210,8 +209,7 @@ static int st_rtc_probe(struct platform_device *pdev)
spin_lock_init(&rtc->lock); spin_lock_init(&rtc->lock);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); rtc->ioaddr = devm_platform_ioremap_resource(pdev, 0);
rtc->ioaddr = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(rtc->ioaddr)) if (IS_ERR(rtc->ioaddr))
return PTR_ERR(rtc->ioaddr); return PTR_ERR(rtc->ioaddr);
......
...@@ -256,7 +256,6 @@ static int stk17ta8_nvram_write(void *priv, unsigned int pos, void *val, ...@@ -256,7 +256,6 @@ static int stk17ta8_nvram_write(void *priv, unsigned int pos, void *val,
static int stk17ta8_rtc_probe(struct platform_device *pdev) static int stk17ta8_rtc_probe(struct platform_device *pdev)
{ {
struct resource *res;
unsigned int cal; unsigned int cal;
unsigned int flags; unsigned int flags;
struct rtc_plat_data *pdata; struct rtc_plat_data *pdata;
...@@ -275,8 +274,7 @@ static int stk17ta8_rtc_probe(struct platform_device *pdev) ...@@ -275,8 +274,7 @@ static int stk17ta8_rtc_probe(struct platform_device *pdev)
if (!pdata) if (!pdata)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ioaddr = devm_platform_ioremap_resource(pdev, 0);
ioaddr = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(ioaddr)) if (IS_ERR(ioaddr))
return PTR_ERR(ioaddr); return PTR_ERR(ioaddr);
pdata->ioaddr = ioaddr; pdata->ioaddr = ioaddr;
......
...@@ -693,15 +693,13 @@ static int stm32_rtc_probe(struct platform_device *pdev) ...@@ -693,15 +693,13 @@ static int stm32_rtc_probe(struct platform_device *pdev)
{ {
struct stm32_rtc *rtc; struct stm32_rtc *rtc;
const struct stm32_rtc_registers *regs; const struct stm32_rtc_registers *regs;
struct resource *res;
int ret; int ret;
rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
if (!rtc) if (!rtc)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); rtc->base = devm_platform_ioremap_resource(pdev, 0);
rtc->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(rtc->base)) if (IS_ERR(rtc->base))
return PTR_ERR(rtc->base); return PTR_ERR(rtc->base);
......
...@@ -422,7 +422,6 @@ MODULE_DEVICE_TABLE(of, sunxi_rtc_dt_ids); ...@@ -422,7 +422,6 @@ MODULE_DEVICE_TABLE(of, sunxi_rtc_dt_ids);
static int sunxi_rtc_probe(struct platform_device *pdev) static int sunxi_rtc_probe(struct platform_device *pdev)
{ {
struct sunxi_rtc_dev *chip; struct sunxi_rtc_dev *chip;
struct resource *res;
int ret; int ret;
chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
...@@ -436,8 +435,7 @@ static int sunxi_rtc_probe(struct platform_device *pdev) ...@@ -436,8 +435,7 @@ static int sunxi_rtc_probe(struct platform_device *pdev)
if (IS_ERR(chip->rtc)) if (IS_ERR(chip->rtc))
return PTR_ERR(chip->rtc); return PTR_ERR(chip->rtc);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); chip->base = devm_platform_ioremap_resource(pdev, 0);
chip->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(chip->base)) if (IS_ERR(chip->base))
return PTR_ERR(chip->base); return PTR_ERR(chip->base);
......
...@@ -277,15 +277,13 @@ MODULE_DEVICE_TABLE(of, tegra_rtc_dt_match); ...@@ -277,15 +277,13 @@ MODULE_DEVICE_TABLE(of, tegra_rtc_dt_match);
static int tegra_rtc_probe(struct platform_device *pdev) static int tegra_rtc_probe(struct platform_device *pdev)
{ {
struct tegra_rtc_info *info; struct tegra_rtc_info *info;
struct resource *res;
int ret; int ret;
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
if (!info) if (!info)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); info->base = devm_platform_ioremap_resource(pdev, 0);
info->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(info->base)) if (IS_ERR(info->base))
return PTR_ERR(info->base); return PTR_ERR(info->base);
......
...@@ -236,7 +236,6 @@ static int __init tx4939_rtc_probe(struct platform_device *pdev) ...@@ -236,7 +236,6 @@ static int __init tx4939_rtc_probe(struct platform_device *pdev)
{ {
struct rtc_device *rtc; struct rtc_device *rtc;
struct tx4939rtc_plat_data *pdata; struct tx4939rtc_plat_data *pdata;
struct resource *res;
int irq, ret; int irq, ret;
struct nvmem_config nvmem_cfg = { struct nvmem_config nvmem_cfg = {
.name = "tx4939_nvram", .name = "tx4939_nvram",
...@@ -253,8 +252,7 @@ static int __init tx4939_rtc_probe(struct platform_device *pdev) ...@@ -253,8 +252,7 @@ static int __init tx4939_rtc_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
platform_set_drvdata(pdev, pdata); platform_set_drvdata(pdev, pdata);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pdata->rtcreg = devm_platform_ioremap_resource(pdev, 0);
pdata->rtcreg = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pdata->rtcreg)) if (IS_ERR(pdata->rtcreg))
return PTR_ERR(pdata->rtcreg); return PTR_ERR(pdata->rtcreg);
......
...@@ -200,7 +200,6 @@ static const struct rtc_class_ops vt8500_rtc_ops = { ...@@ -200,7 +200,6 @@ static const struct rtc_class_ops vt8500_rtc_ops = {
static int vt8500_rtc_probe(struct platform_device *pdev) static int vt8500_rtc_probe(struct platform_device *pdev)
{ {
struct vt8500_rtc *vt8500_rtc; struct vt8500_rtc *vt8500_rtc;
struct resource *res;
int ret; int ret;
vt8500_rtc = devm_kzalloc(&pdev->dev, vt8500_rtc = devm_kzalloc(&pdev->dev,
...@@ -215,8 +214,7 @@ static int vt8500_rtc_probe(struct platform_device *pdev) ...@@ -215,8 +214,7 @@ static int vt8500_rtc_probe(struct platform_device *pdev)
if (vt8500_rtc->irq_alarm < 0) if (vt8500_rtc->irq_alarm < 0)
return vt8500_rtc->irq_alarm; return vt8500_rtc->irq_alarm;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); vt8500_rtc->regbase = devm_platform_ioremap_resource(pdev, 0);
vt8500_rtc->regbase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(vt8500_rtc->regbase)) if (IS_ERR(vt8500_rtc->regbase))
return PTR_ERR(vt8500_rtc->regbase); return PTR_ERR(vt8500_rtc->regbase);
......
...@@ -137,7 +137,6 @@ static irqreturn_t xgene_rtc_interrupt(int irq, void *id) ...@@ -137,7 +137,6 @@ static irqreturn_t xgene_rtc_interrupt(int irq, void *id)
static int xgene_rtc_probe(struct platform_device *pdev) static int xgene_rtc_probe(struct platform_device *pdev)
{ {
struct xgene_rtc_dev *pdata; struct xgene_rtc_dev *pdata;
struct resource *res;
int ret; int ret;
int irq; int irq;
...@@ -147,8 +146,7 @@ static int xgene_rtc_probe(struct platform_device *pdev) ...@@ -147,8 +146,7 @@ static int xgene_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, pdata); platform_set_drvdata(pdev, pdata);
pdata->dev = &pdev->dev; pdata->dev = &pdev->dev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pdata->csr_base = devm_platform_ioremap_resource(pdev, 0);
pdata->csr_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pdata->csr_base)) if (IS_ERR(pdata->csr_base))
return PTR_ERR(pdata->csr_base); return PTR_ERR(pdata->csr_base);
......
...@@ -195,7 +195,6 @@ static irqreturn_t xlnx_rtc_interrupt(int irq, void *id) ...@@ -195,7 +195,6 @@ static irqreturn_t xlnx_rtc_interrupt(int irq, void *id)
static int xlnx_rtc_probe(struct platform_device *pdev) static int xlnx_rtc_probe(struct platform_device *pdev)
{ {
struct xlnx_rtc_dev *xrtcdev; struct xlnx_rtc_dev *xrtcdev;
struct resource *res;
int ret; int ret;
xrtcdev = devm_kzalloc(&pdev->dev, sizeof(*xrtcdev), GFP_KERNEL); xrtcdev = devm_kzalloc(&pdev->dev, sizeof(*xrtcdev), GFP_KERNEL);
...@@ -211,9 +210,7 @@ static int xlnx_rtc_probe(struct platform_device *pdev) ...@@ -211,9 +210,7 @@ static int xlnx_rtc_probe(struct platform_device *pdev)
xrtcdev->rtc->ops = &xlnx_rtc_ops; xrtcdev->rtc->ops = &xlnx_rtc_ops;
xrtcdev->rtc->range_max = U32_MAX; xrtcdev->rtc->range_max = U32_MAX;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); xrtcdev->reg_base = devm_platform_ioremap_resource(pdev, 0);
xrtcdev->reg_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(xrtcdev->reg_base)) if (IS_ERR(xrtcdev->reg_base))
return PTR_ERR(xrtcdev->reg_base); return PTR_ERR(xrtcdev->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