summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-3.0/sakoman/0010-rtc-twl-Fix-registration-vs.-init-order.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-3.0/sakoman/0010-rtc-twl-Fix-registration-vs.-init-order.patch')
-rw-r--r--recipes-kernel/linux/linux-3.0/sakoman/0010-rtc-twl-Fix-registration-vs.-init-order.patch122
1 files changed, 0 insertions, 122 deletions
diff --git a/recipes-kernel/linux/linux-3.0/sakoman/0010-rtc-twl-Fix-registration-vs.-init-order.patch b/recipes-kernel/linux/linux-3.0/sakoman/0010-rtc-twl-Fix-registration-vs.-init-order.patch
deleted file mode 100644
index d710643a..00000000
--- a/recipes-kernel/linux/linux-3.0/sakoman/0010-rtc-twl-Fix-registration-vs.-init-order.patch
+++ /dev/null
@@ -1,122 +0,0 @@
1From 2cc62887b37d504df009d7241e6cebc3c65c32a5 Mon Sep 17 00:00:00 2001
2From: Todd Poynor <toddpoynor@google.com>
3Date: Wed, 27 Jul 2011 07:07:21 +0000
4Subject: [PATCH 10/14] rtc: twl: Fix registration vs. init order
5
6Only register as an RTC device after the hardware has been
7successfully initialized. The RTC class driver will call
8back to this driver to read a pending alarm, and other
9drivers watching for new devices on the RTC class may
10read the RTC time upon registration. Such access might
11occur while the RTC is stopped, prior to clearing
12pending alarms, etc.
13
14The new ordering also avoids leaving the platform
15device drvdata set to an unregistered struct rtc_device *
16on probe errors.
17
18Signed-off-by: Todd Poynor <toddpoynor@google.com>
19---
20 drivers/rtc/rtc-twl.c | 52 ++++++++++++++++++++++--------------------------
21 1 files changed, 24 insertions(+), 28 deletions(-)
22
23diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
24index 3fee95e..a64494e 100644
25--- a/drivers/rtc/rtc-twl.c
26+++ b/drivers/rtc/rtc-twl.c
27@@ -420,24 +420,12 @@ static struct rtc_class_ops twl_rtc_ops = {
28 static int __devinit twl_rtc_probe(struct platform_device *pdev)
29 {
30 struct rtc_device *rtc;
31- int ret = 0;
32+ int ret = -EINVAL;
33 int irq = platform_get_irq(pdev, 0);
34 u8 rd_reg;
35
36 if (irq <= 0)
37- return -EINVAL;
38-
39- rtc = rtc_device_register(pdev->name,
40- &pdev->dev, &twl_rtc_ops, THIS_MODULE);
41- if (IS_ERR(rtc)) {
42- ret = PTR_ERR(rtc);
43- dev_err(&pdev->dev, "can't register RTC device, err %ld\n",
44- PTR_ERR(rtc));
45- goto out0;
46-
47- }
48-
49- platform_set_drvdata(pdev, rtc);
50+ goto out1;
51
52 ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
53 if (ret < 0)
54@@ -454,14 +442,6 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev)
55 if (ret < 0)
56 goto out1;
57
58- ret = request_threaded_irq(irq, NULL, twl_rtc_interrupt,
59- IRQF_TRIGGER_RISING,
60- dev_name(&rtc->dev), rtc);
61- if (ret < 0) {
62- dev_err(&pdev->dev, "IRQ is not free.\n");
63- goto out1;
64- }
65-
66 if (twl_class_is_6030()) {
67 twl6030_interrupt_unmask(TWL6030_RTC_INT_MASK,
68 REG_INT_MSK_LINE_A);
69@@ -472,28 +452,44 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev)
70 /* Check RTC module status, Enable if it is off */
71 ret = twl_rtc_read_u8(&rd_reg, REG_RTC_CTRL_REG);
72 if (ret < 0)
73- goto out2;
74+ goto out1;
75
76 if (!(rd_reg & BIT_RTC_CTRL_REG_STOP_RTC_M)) {
77 dev_info(&pdev->dev, "Enabling TWL-RTC.\n");
78 rd_reg = BIT_RTC_CTRL_REG_STOP_RTC_M;
79 ret = twl_rtc_write_u8(rd_reg, REG_RTC_CTRL_REG);
80 if (ret < 0)
81- goto out2;
82+ goto out1;
83 }
84
85 /* init cached IRQ enable bits */
86 ret = twl_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG);
87 if (ret < 0)
88+ goto out1;
89+
90+ rtc = rtc_device_register(pdev->name,
91+ &pdev->dev, &twl_rtc_ops, THIS_MODULE);
92+ if (IS_ERR(rtc)) {
93+ ret = PTR_ERR(rtc);
94+ dev_err(&pdev->dev, "can't register RTC device, err %ld\n",
95+ PTR_ERR(rtc));
96+ goto out1;
97+ }
98+
99+ ret = request_threaded_irq(irq, NULL, twl_rtc_interrupt,
100+ IRQF_TRIGGER_RISING,
101+ dev_name(&rtc->dev), rtc);
102+ if (ret < 0) {
103+ dev_err(&pdev->dev, "IRQ is not free.\n");
104 goto out2;
105+ }
106
107- return ret;
108+ platform_set_drvdata(pdev, rtc);
109+ return 0;
110
111 out2:
112- free_irq(irq, rtc);
113-out1:
114 rtc_device_unregister(rtc);
115-out0:
116+out1:
117 return ret;
118 }
119
120--
1211.7.2.5
122