aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-s5m.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2014-08-29 18:18:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-29 19:28:16 -0400
commitb7d5b9a9686674eedffe5b8745c85265f3fe3367 (patch)
tree8e485240fd6ac750a1ad9014c50dd560e02eb7ab /drivers/rtc/rtc-s5m.c
parentbfcfd44cce2774f19daeb59fb4e43fc9aa80e7b8 (diff)
drivers/rtc/rtc-s5m.c: re-add support for devices without irq specified
The rtc-s5m driver used to support devices without irq specified in the past. Re-add this support. The patch fixes boot for Insignal's Exynos4412 based Origen board. Error messages before the patch: ... Unable to handle kernel NULL pointer dereference at virtual address 00000094 pgd = c0004000 [00000094] *pgd=00000000 Internal error: Oops: 5 [#1] PREEMPT SMP ARM Modules linked in: CPU: 1 PID: 1 Comm: swapper/0 Not tainted 3.16.0-next-20140804-00008-ga59480f-dirty #701 task: ea80f000 ti: ea882000 task.ti: ea882000 PC is at regmap_irq_get_virq+0x0/0x28 LR is at s5m_rtc_probe+0xdc/0x310 pc : [<c02574fc>] lr : [<c02de75c>] psr: 80000153 sp : ea883e48 ip : 00000000 fp : 00000000 r10: 0000000c r9 : c05de7ac r8 : eaabc600 r7 : eaa6b4d0 r6 : c0439e8c r5 : eaabc610 r4 : eab30e50 r3 : 00000000 r2 : 00000000 r1 : 0000000c r0 : 00000000 Flags: Nzcv IRQs on FIQs off Mode SVC_32 ISA ARM Segment kernel Control: 10c5387d Table: 4000404a DAC: 00000015 Process swapper/0 (pid: 1, stack limit = 0xea882240) Backtrace: regmap_irq_get_virq s5m_rtc_probe platform_drv_probe driver_probe_device __driver_attach bus_for_each_dev bus_add_driver driver_register do_one_initcall kernel_init_freeable kernel_init ---[ end trace a954d7f019122700 ]--- Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ... Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-s5m.c')
-rw-r--r--drivers/rtc/rtc-s5m.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index 8f06250a0389..8754c33361e8 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -717,12 +717,14 @@ static int s5m_rtc_probe(struct platform_device *pdev)
717 info->device_type = s5m87xx->device_type; 717 info->device_type = s5m87xx->device_type;
718 info->wtsr_smpl = s5m87xx->wtsr_smpl; 718 info->wtsr_smpl = s5m87xx->wtsr_smpl;
719 719
720 info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq); 720 if (s5m87xx->irq_data) {
721 if (info->irq <= 0) { 721 info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq);
722 ret = -EINVAL; 722 if (info->irq <= 0) {
723 dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n", 723 ret = -EINVAL;
724 dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n",
724 alarm_irq); 725 alarm_irq);
725 goto err; 726 goto err;
727 }
726 } 728 }
727 729
728 platform_set_drvdata(pdev, info); 730 platform_set_drvdata(pdev, info);
@@ -744,6 +746,11 @@ static int s5m_rtc_probe(struct platform_device *pdev)
744 goto err; 746 goto err;
745 } 747 }
746 748
749 if (!info->irq) {
750 dev_info(&pdev->dev, "Alarm IRQ not available\n");
751 return 0;
752 }
753
747 ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, 754 ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
748 s5m_rtc_alarm_irq, 0, "rtc-alarm0", 755 s5m_rtc_alarm_irq, 0, "rtc-alarm0",
749 info); 756 info);
@@ -802,7 +809,7 @@ static int s5m_rtc_resume(struct device *dev)
802 struct s5m_rtc_info *info = dev_get_drvdata(dev); 809 struct s5m_rtc_info *info = dev_get_drvdata(dev);
803 int ret = 0; 810 int ret = 0;
804 811
805 if (device_may_wakeup(dev)) 812 if (info->irq && device_may_wakeup(dev))
806 ret = disable_irq_wake(info->irq); 813 ret = disable_irq_wake(info->irq);
807 814
808 return ret; 815 return ret;
@@ -813,7 +820,7 @@ static int s5m_rtc_suspend(struct device *dev)
813 struct s5m_rtc_info *info = dev_get_drvdata(dev); 820 struct s5m_rtc_info *info = dev_get_drvdata(dev);
814 int ret = 0; 821 int ret = 0;
815 822
816 if (device_may_wakeup(dev)) 823 if (info->irq && device_may_wakeup(dev))
817 ret = enable_irq_wake(info->irq); 824 ret = enable_irq_wake(info->irq);
818 825
819 return ret; 826 return ret;