Commit faac9102 authored by Stephen Boyd's avatar Stephen Boyd Committed by Alexandre Belloni

rtc: Remove dev_err() usage after platform_get_irq()

We don't need dev_err() messages when platform_get_irq() fails now that
platform_get_irq() prints an error message itself when something goes
wrong. Let's remove these prints with a simple semantic patch.

// <smpl>
@@
expression ret;
struct platform_device *E;
@@

ret =
(
platform_get_irq(E, ...)
|
platform_get_irq_byname(E, ...)
);

if ( \( ret < 0 \| ret <= 0 \) )
{
(
-if (ret != -EPROBE_DEFER)
-{ ...
-dev_err(...);
-... }
|
...
-dev_err(...);
)
...
}
// </smpl>

While we're here, remove braces on if statements that only have one
statement (manually).

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: linux-rtc@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20190730181557.90391-40-swboyd@chromium.orgSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent b0a3fa44
......@@ -264,7 +264,6 @@ static int pm80x_rtc_probe(struct platform_device *pdev)
return -ENOMEM;
info->irq = platform_get_irq(pdev, 0);
if (info->irq < 0) {
dev_err(&pdev->dev, "No IRQ resource!\n");
ret = -EINVAL;
goto out;
}
......
......@@ -328,10 +328,8 @@ static int pm860x_rtc_probe(struct platform_device *pdev)
if (!info)
return -ENOMEM;
info->irq = platform_get_irq(pdev, 0);
if (info->irq < 0) {
dev_err(&pdev->dev, "No IRQ resource!\n");
if (info->irq < 0)
return info->irq;
}
info->chip = chip;
info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion;
......
......@@ -578,10 +578,8 @@ static int ac100_rtc_probe(struct platform_device *pdev)
chip->regmap = ac100->regmap;
chip->irq = platform_get_irq(pdev, 0);
if (chip->irq < 0) {
dev_err(&pdev->dev, "No IRQ resource\n");
if (chip->irq < 0)
return chip->irq;
}
chip->rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(chip->rtc))
......
......@@ -530,11 +530,8 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev)
return PTR_ERR(rtc->regs_soc);
rtc->irq = platform_get_irq(pdev, 0);
if (rtc->irq < 0) {
dev_err(&pdev->dev, "no irq\n");
if (rtc->irq < 0)
return rtc->irq;
}
rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(rtc->rtc_dev))
......
......@@ -257,10 +257,8 @@ static int asm9260_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv);
irq_alarm = platform_get_irq(pdev, 0);
if (irq_alarm < 0) {
dev_err(dev, "No alarm IRQ resource defined\n");
if (irq_alarm < 0)
return irq_alarm;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
priv->iobase = devm_ioremap_resource(dev, res);
......
......@@ -378,10 +378,8 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
}
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "no irq resource defined\n");
if (irq < 0)
return -ENXIO;
}
at91_rtc_regs = devm_ioremap(&pdev->dev, regs->start,
resource_size(regs));
......
......@@ -342,10 +342,8 @@ static int at91_rtc_probe(struct platform_device *pdev)
struct of_phandle_args args;
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "failed to get interrupt resource\n");
if (irq < 0)
return irq;
}
rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
if (!rtc)
......
......@@ -416,11 +416,8 @@ static int bd70528_probe(struct platform_device *pdev)
bd_rtc->dev = &pdev->dev;
irq = platform_get_irq_byname(pdev, "bd70528-rtc-alm");
if (irq < 0) {
dev_err(&pdev->dev, "Failed to get irq\n");
if (irq < 0)
return irq;
}
platform_set_drvdata(pdev, bd_rtc);
......
......@@ -477,10 +477,8 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
return -ENOMEM;
davinci_rtc->irq = platform_get_irq(pdev, 0);
if (davinci_rtc->irq < 0) {
dev_err(dev, "no RTC irq\n");
if (davinci_rtc->irq < 0)
return davinci_rtc->irq;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
davinci_rtc->base = devm_ioremap_resource(dev, res);
......
......@@ -323,10 +323,8 @@ static int jz4740_rtc_probe(struct platform_device *pdev)
rtc->type = id->driver_data;
rtc->irq = platform_get_irq(pdev, 0);
if (rtc->irq < 0) {
dev_err(&pdev->dev, "Failed to get platform irq\n");
if (rtc->irq < 0)
return -ENOENT;
}
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
rtc->base = devm_ioremap_resource(&pdev->dev, mem);
......
......@@ -673,11 +673,8 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
struct platform_device *pdev = to_platform_device(info->dev);
info->rtc_irq = platform_get_irq(pdev, 0);
if (info->rtc_irq < 0) {
dev_err(info->dev, "Failed to get rtc interrupts: %d\n",
info->rtc_irq);
if (info->rtc_irq < 0)
return info->rtc_irq;
}
} else {
info->rtc_irq = parent_i2c->irq;
}
......
......@@ -329,7 +329,6 @@ static int mtk_rtc_probe(struct platform_device *pdev)
hw->irq = platform_get_irq(pdev, 0);
if (hw->irq < 0) {
dev_err(&pdev->dev, "No IRQ resource\n");
ret = hw->irq;
goto err;
}
......
......@@ -308,10 +308,8 @@ static int pic32_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, pdata);
pdata->alarm_irq = platform_get_irq(pdev, 0);
if (pdata->alarm_irq < 0) {
dev_err(&pdev->dev, "no irq for alarm\n");
if (pdata->alarm_irq < 0)
return pdata->alarm_irq;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
pdata->reg_base = devm_ioremap_resource(&pdev->dev, res);
......
......@@ -468,10 +468,8 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
}
rtc_dd->rtc_alarm_irq = platform_get_irq(pdev, 0);
if (rtc_dd->rtc_alarm_irq < 0) {
dev_err(&pdev->dev, "Alarm IRQ resource absent!\n");
if (rtc_dd->rtc_alarm_irq < 0)
return -ENXIO;
}
rtc_dd->allow_set_time = of_property_read_bool(pdev->dev.of_node,
"allow-set-time");
......
......@@ -186,16 +186,12 @@ static int puv3_rtc_probe(struct platform_device *pdev)
/* find the IRQs */
puv3_rtc_tickno = platform_get_irq(pdev, 1);
if (puv3_rtc_tickno < 0) {
dev_err(&pdev->dev, "no irq for rtc tick\n");
if (puv3_rtc_tickno < 0)
return -ENOENT;
}
puv3_rtc_alarmno = platform_get_irq(pdev, 0);
if (puv3_rtc_alarmno < 0) {
dev_err(&pdev->dev, "no irq for alarm\n");
if (puv3_rtc_alarmno < 0)
return -ENOENT;
}
dev_dbg(&pdev->dev, "PKUnity_rtc: tick irq %d, alarm irq %d\n",
puv3_rtc_tickno, puv3_rtc_alarmno);
......
......@@ -324,15 +324,11 @@ static int __init pxa_rtc_probe(struct platform_device *pdev)
}
sa1100_rtc->irq_1hz = platform_get_irq(pdev, 0);
if (sa1100_rtc->irq_1hz < 0) {
dev_err(dev, "No 1Hz IRQ resource defined\n");
if (sa1100_rtc->irq_1hz < 0)
return -ENXIO;
}
sa1100_rtc->irq_alarm = platform_get_irq(pdev, 1);
if (sa1100_rtc->irq_alarm < 0) {
dev_err(dev, "No alarm IRQ resource defined\n");
if (sa1100_rtc->irq_alarm < 0)
return -ENXIO;
}
pxa_rtc->base = devm_ioremap(dev, pxa_rtc->ress->start,
resource_size(pxa_rtc->ress));
......
......@@ -434,12 +434,8 @@ static int rk808_rtc_probe(struct platform_device *pdev)
rk808_rtc->rtc->ops = &rk808_rtc_ops;
rk808_rtc->irq = platform_get_irq(pdev, 0);
if (rk808_rtc->irq < 0) {
if (rk808_rtc->irq != -EPROBE_DEFER)
dev_err(&pdev->dev, "Wake up is not possible as irq = %d\n",
rk808_rtc->irq);
if (rk808_rtc->irq < 0)
return rk808_rtc->irq;
}
/* request alarm irq of rk808 */
ret = devm_request_threaded_irq(&pdev->dev, rk808_rtc->irq, NULL,
......
......@@ -453,10 +453,8 @@ static int s3c_rtc_probe(struct platform_device *pdev)
/* find the IRQs */
info->irq_tick = platform_get_irq(pdev, 1);
if (info->irq_tick < 0) {
dev_err(&pdev->dev, "no irq for rtc tick\n");
if (info->irq_tick < 0)
return info->irq_tick;
}
info->dev = &pdev->dev;
info->data = of_device_get_match_data(&pdev->dev);
......@@ -470,10 +468,8 @@ static int s3c_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, info);
info->irq_alarm = platform_get_irq(pdev, 0);
if (info->irq_alarm < 0) {
dev_err(&pdev->dev, "no irq for alarm\n");
if (info->irq_alarm < 0)
return info->irq_alarm;
}
dev_dbg(&pdev->dev, "s3c2410_rtc: tick irq %d, alarm irq %d\n",
info->irq_tick, info->irq_alarm);
......
......@@ -614,10 +614,8 @@ static int sprd_rtc_probe(struct platform_device *pdev)
}
rtc->irq = platform_get_irq(pdev, 0);
if (rtc->irq < 0) {
dev_err(&pdev->dev, "failed to get RTC irq number\n");
if (rtc->irq < 0)
return rtc->irq;
}
rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(rtc->rtc))
......
......@@ -358,10 +358,8 @@ static int spear_rtc_probe(struct platform_device *pdev)
/* alarm irqs */
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "no update irq?\n");
if (irq < 0)
return irq;
}
status = devm_request_irq(&pdev->dev, irq, spear_rtc_irq, 0, pdev->name,
config);
......
......@@ -776,7 +776,6 @@ static int stm32_rtc_probe(struct platform_device *pdev)
rtc->irq_alarm = platform_get_irq(pdev, 0);
if (rtc->irq_alarm <= 0) {
dev_err(&pdev->dev, "no alarm irq\n");
ret = rtc->irq_alarm;
goto err;
}
......
......@@ -610,10 +610,8 @@ static int sun6i_rtc_probe(struct platform_device *pdev)
chip->dev = &pdev->dev;
chip->irq = platform_get_irq(pdev, 0);
if (chip->irq < 0) {
dev_err(&pdev->dev, "No IRQ resource\n");
if (chip->irq < 0)
return chip->irq;
}
ret = devm_request_irq(&pdev->dev, chip->irq, sun6i_rtc_alarmirq,
0, dev_name(&pdev->dev), chip);
......
......@@ -442,10 +442,8 @@ static int sunxi_rtc_probe(struct platform_device *pdev)
return PTR_ERR(chip->base);
chip->irq = platform_get_irq(pdev, 0);
if (chip->irq < 0) {
dev_err(&pdev->dev, "No IRQ resource\n");
if (chip->irq < 0)
return chip->irq;
}
ret = devm_request_irq(&pdev->dev, chip->irq, sunxi_rtc_alarmirq,
0, dev_name(&pdev->dev), chip);
if (ret) {
......
......@@ -290,10 +290,8 @@ static int tegra_rtc_probe(struct platform_device *pdev)
return PTR_ERR(info->base);
ret = platform_get_irq(pdev, 0);
if (ret <= 0) {
dev_err(&pdev->dev, "failed to get platform IRQ: %d\n", ret);
if (ret <= 0)
return ret;
}
info->irq = ret;
......
......@@ -212,10 +212,8 @@ static int vt8500_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, vt8500_rtc);
vt8500_rtc->irq_alarm = platform_get_irq(pdev, 0);
if (vt8500_rtc->irq_alarm < 0) {
dev_err(&pdev->dev, "No alarm IRQ resource defined\n");
if (vt8500_rtc->irq_alarm < 0)
return vt8500_rtc->irq_alarm;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
vt8500_rtc->regbase = devm_ioremap_resource(&pdev->dev, res);
......
......@@ -157,10 +157,8 @@ static int xgene_rtc_probe(struct platform_device *pdev)
return PTR_ERR(pdata->rtc);
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "No IRQ resource\n");
if (irq < 0)
return irq;
}
ret = devm_request_irq(&pdev->dev, irq, xgene_rtc_interrupt, 0,
dev_name(&pdev->dev), pdata);
if (ret) {
......
......@@ -218,10 +218,8 @@ static int xlnx_rtc_probe(struct platform_device *pdev)
return PTR_ERR(xrtcdev->reg_base);
xrtcdev->alarm_irq = platform_get_irq_byname(pdev, "alarm");
if (xrtcdev->alarm_irq < 0) {
dev_err(&pdev->dev, "no irq resource\n");
if (xrtcdev->alarm_irq < 0)
return xrtcdev->alarm_irq;
}
ret = devm_request_irq(&pdev->dev, xrtcdev->alarm_irq,
xlnx_rtc_interrupt, 0,
dev_name(&pdev->dev), xrtcdev);
......@@ -231,10 +229,8 @@ static int xlnx_rtc_probe(struct platform_device *pdev)
}
xrtcdev->sec_irq = platform_get_irq_byname(pdev, "sec");
if (xrtcdev->sec_irq < 0) {
dev_err(&pdev->dev, "no irq resource\n");
if (xrtcdev->sec_irq < 0)
return xrtcdev->sec_irq;
}
ret = devm_request_irq(&pdev->dev, xrtcdev->sec_irq,
xlnx_rtc_interrupt, 0,
dev_name(&pdev->dev), xrtcdev);
......
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