Commit 337b600f authored by Sekhar Nori's avatar Sekhar Nori Committed by Linus Torvalds

drivers/rtc/rtc-omap.c: remove multiple device id checks

Remove multiple superfluous device id checks.  Since an id_table is
present in the driver probe() should never encounter an empty device id
entry.  In case of OF style match, of_match_device() returns an matching
entry.

For paranoia sake, check for device id entry once and fail probe() if none
is found.  This is much better than checking for it multiple times.
Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c2a57550
...@@ -352,6 +352,12 @@ static int __init omap_rtc_probe(struct platform_device *pdev) ...@@ -352,6 +352,12 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
if (of_id) if (of_id)
pdev->id_entry = of_id->data; pdev->id_entry = of_id->data;
id_entry = platform_get_device_id(pdev);
if (!id_entry) {
dev_err(&pdev->dev, "no matching device entry\n");
return -ENODEV;
}
omap_rtc_timer = platform_get_irq(pdev, 0); omap_rtc_timer = platform_get_irq(pdev, 0);
if (omap_rtc_timer <= 0) { if (omap_rtc_timer <= 0) {
pr_debug("%s: no update irq?\n", pdev->name); pr_debug("%s: no update irq?\n", pdev->name);
...@@ -373,8 +379,7 @@ static int __init omap_rtc_probe(struct platform_device *pdev) ...@@ -373,8 +379,7 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev); pm_runtime_get_sync(&pdev->dev);
id_entry = platform_get_device_id(pdev); if (id_entry->driver_data & OMAP_RTC_HAS_KICKER) {
if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER)) {
rtc_writel(KICK0_VALUE, OMAP_RTC_KICK0_REG); rtc_writel(KICK0_VALUE, OMAP_RTC_KICK0_REG);
rtc_writel(KICK1_VALUE, OMAP_RTC_KICK1_REG); rtc_writel(KICK1_VALUE, OMAP_RTC_KICK1_REG);
} }
...@@ -452,7 +457,7 @@ static int __init omap_rtc_probe(struct platform_device *pdev) ...@@ -452,7 +457,7 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
return 0; return 0;
fail0: fail0:
if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER)) if (id_entry->driver_data & OMAP_RTC_HAS_KICKER)
rtc_writel(0, OMAP_RTC_KICK0_REG); rtc_writel(0, OMAP_RTC_KICK0_REG);
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
...@@ -469,7 +474,7 @@ static int __exit omap_rtc_remove(struct platform_device *pdev) ...@@ -469,7 +474,7 @@ static int __exit omap_rtc_remove(struct platform_device *pdev)
/* leave rtc running, but disable irqs */ /* leave rtc running, but disable irqs */
rtc_write(0, OMAP_RTC_INTERRUPTS_REG); rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER)) if (id_entry->driver_data & OMAP_RTC_HAS_KICKER)
rtc_writel(0, OMAP_RTC_KICK0_REG); rtc_writel(0, OMAP_RTC_KICK0_REG);
/* Disable the clock/module */ /* Disable the clock/module */
......
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