diff options
Diffstat (limited to 'drivers/rtc/class.c')
-rw-r--r-- | drivers/rtc/class.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index be5a6b73e601..9583cbcc6b79 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <linux/rtc.h> | 15 | #include <linux/rtc.h> |
16 | #include <linux/kdev_t.h> | 16 | #include <linux/kdev_t.h> |
17 | #include <linux/idr.h> | 17 | #include <linux/idr.h> |
18 | #include <linux/slab.h> | ||
19 | #include <linux/workqueue.h> | ||
18 | 20 | ||
19 | #include "rtc-core.h" | 21 | #include "rtc-core.h" |
20 | 22 | ||
@@ -151,14 +153,28 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev, | |||
151 | spin_lock_init(&rtc->irq_task_lock); | 153 | spin_lock_init(&rtc->irq_task_lock); |
152 | init_waitqueue_head(&rtc->irq_queue); | 154 | init_waitqueue_head(&rtc->irq_queue); |
153 | 155 | ||
156 | /* Init timerqueue */ | ||
157 | timerqueue_init_head(&rtc->timerqueue); | ||
158 | INIT_WORK(&rtc->irqwork, rtc_timer_do_work); | ||
159 | /* Init aie timer */ | ||
160 | rtc_timer_init(&rtc->aie_timer, rtc_aie_update_irq, (void *)rtc); | ||
161 | /* Init uie timer */ | ||
162 | rtc_timer_init(&rtc->uie_rtctimer, rtc_uie_update_irq, (void *)rtc); | ||
163 | /* Init pie timer */ | ||
164 | hrtimer_init(&rtc->pie_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
165 | rtc->pie_timer.function = rtc_pie_update_irq; | ||
166 | rtc->pie_enabled = 0; | ||
167 | |||
154 | strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); | 168 | strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); |
155 | dev_set_name(&rtc->dev, "rtc%d", id); | 169 | dev_set_name(&rtc->dev, "rtc%d", id); |
156 | 170 | ||
157 | rtc_dev_prepare(rtc); | 171 | rtc_dev_prepare(rtc); |
158 | 172 | ||
159 | err = device_register(&rtc->dev); | 173 | err = device_register(&rtc->dev); |
160 | if (err) | 174 | if (err) { |
175 | put_device(&rtc->dev); | ||
161 | goto exit_kfree; | 176 | goto exit_kfree; |
177 | } | ||
162 | 178 | ||
163 | rtc_dev_add_device(rtc); | 179 | rtc_dev_add_device(rtc); |
164 | rtc_sysfs_add_device(rtc); | 180 | rtc_sysfs_add_device(rtc); |
@@ -226,6 +242,7 @@ static void __exit rtc_exit(void) | |||
226 | { | 242 | { |
227 | rtc_dev_exit(); | 243 | rtc_dev_exit(); |
228 | class_destroy(rtc_class); | 244 | class_destroy(rtc_class); |
245 | idr_destroy(&rtc_idr); | ||
229 | } | 246 | } |
230 | 247 | ||
231 | subsys_initcall(rtc_init); | 248 | subsys_initcall(rtc_init); |