aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorSekhar Nori <nsekhar@ti.com>2014-06-06 17:36:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-06 19:08:08 -0400
commit337b600f898583b50b67e0bbff0667db2393d614 (patch)
tree66b6758d6ff96f6bd07b7b801f961b14d2e8a7a5 /drivers/rtc
parentc2a57550fec132c1e184c42ea13a619f9a9980e5 (diff)
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: Sekhar Nori <nsekhar@ti.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Lokesh Vutla <lokeshvutla@ti.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-omap.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 26de5f8c2ae4..70f51491809d 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -352,6 +352,12 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
352 if (of_id) 352 if (of_id)
353 pdev->id_entry = of_id->data; 353 pdev->id_entry = of_id->data;
354 354
355 id_entry = platform_get_device_id(pdev);
356 if (!id_entry) {
357 dev_err(&pdev->dev, "no matching device entry\n");
358 return -ENODEV;
359 }
360
355 omap_rtc_timer = platform_get_irq(pdev, 0); 361 omap_rtc_timer = platform_get_irq(pdev, 0);
356 if (omap_rtc_timer <= 0) { 362 if (omap_rtc_timer <= 0) {
357 pr_debug("%s: no update irq?\n", pdev->name); 363 pr_debug("%s: no update irq?\n", pdev->name);
@@ -373,8 +379,7 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
373 pm_runtime_enable(&pdev->dev); 379 pm_runtime_enable(&pdev->dev);
374 pm_runtime_get_sync(&pdev->dev); 380 pm_runtime_get_sync(&pdev->dev);
375 381
376 id_entry = platform_get_device_id(pdev); 382 if (id_entry->driver_data & OMAP_RTC_HAS_KICKER) {
377 if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER)) {
378 rtc_writel(KICK0_VALUE, OMAP_RTC_KICK0_REG); 383 rtc_writel(KICK0_VALUE, OMAP_RTC_KICK0_REG);
379 rtc_writel(KICK1_VALUE, OMAP_RTC_KICK1_REG); 384 rtc_writel(KICK1_VALUE, OMAP_RTC_KICK1_REG);
380 } 385 }
@@ -452,7 +457,7 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
452 return 0; 457 return 0;
453 458
454fail0: 459fail0:
455 if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER)) 460 if (id_entry->driver_data & OMAP_RTC_HAS_KICKER)
456 rtc_writel(0, OMAP_RTC_KICK0_REG); 461 rtc_writel(0, OMAP_RTC_KICK0_REG);
457 pm_runtime_put_sync(&pdev->dev); 462 pm_runtime_put_sync(&pdev->dev);
458 pm_runtime_disable(&pdev->dev); 463 pm_runtime_disable(&pdev->dev);
@@ -469,7 +474,7 @@ static int __exit omap_rtc_remove(struct platform_device *pdev)
469 /* leave rtc running, but disable irqs */ 474 /* leave rtc running, but disable irqs */
470 rtc_write(0, OMAP_RTC_INTERRUPTS_REG); 475 rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
471 476
472 if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER)) 477 if (id_entry->driver_data & OMAP_RTC_HAS_KICKER)
473 rtc_writel(0, OMAP_RTC_KICK0_REG); 478 rtc_writel(0, OMAP_RTC_KICK0_REG);
474 479
475 /* Disable the clock/module */ 480 /* Disable the clock/module */