diff options
| author | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-01-16 16:21:04 -0500 |
|---|---|---|
| committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-01-16 16:21:04 -0500 |
| commit | f652f6c5b7cfdf139f4155d78f397e99ae1c4acc (patch) | |
| tree | 71c6344688bf56ea6aaf18c586ab69ff4f077ade /include/linux/rtc.h | |
| parent | 140e3008e7fe1526cbb12f8f07dbc273ac713b75 (diff) | |
| parent | c66ac9db8d4ad9994a02b3e933ea2ccc643e1fe5 (diff) | |
Merge branch 'master' of /pub/scm/linux/kernel/git/jejb/scsi-post-merge-2.6 into for-linus
Diffstat (limited to 'include/linux/rtc.h')
| -rw-r--r-- | include/linux/rtc.h | 51 |
1 files changed, 36 insertions, 15 deletions
diff --git a/include/linux/rtc.h b/include/linux/rtc.h index 14dbc83ded20..3c995b4d742c 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h | |||
| @@ -107,12 +107,17 @@ extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year | |||
| 107 | extern int rtc_valid_tm(struct rtc_time *tm); | 107 | extern int rtc_valid_tm(struct rtc_time *tm); |
| 108 | extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time); | 108 | extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time); |
| 109 | extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm); | 109 | extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm); |
| 110 | ktime_t rtc_tm_to_ktime(struct rtc_time tm); | ||
| 111 | struct rtc_time rtc_ktime_to_tm(ktime_t kt); | ||
| 112 | |||
| 110 | 113 | ||
| 111 | #include <linux/device.h> | 114 | #include <linux/device.h> |
| 112 | #include <linux/seq_file.h> | 115 | #include <linux/seq_file.h> |
| 113 | #include <linux/cdev.h> | 116 | #include <linux/cdev.h> |
| 114 | #include <linux/poll.h> | 117 | #include <linux/poll.h> |
| 115 | #include <linux/mutex.h> | 118 | #include <linux/mutex.h> |
| 119 | #include <linux/timerqueue.h> | ||
| 120 | #include <linux/workqueue.h> | ||
| 116 | 121 | ||
| 117 | extern struct class *rtc_class; | 122 | extern struct class *rtc_class; |
| 118 | 123 | ||
| @@ -151,7 +156,19 @@ struct rtc_class_ops { | |||
| 151 | }; | 156 | }; |
| 152 | 157 | ||
| 153 | #define RTC_DEVICE_NAME_SIZE 20 | 158 | #define RTC_DEVICE_NAME_SIZE 20 |
| 154 | struct rtc_task; | 159 | typedef struct rtc_task { |
| 160 | void (*func)(void *private_data); | ||
| 161 | void *private_data; | ||
| 162 | } rtc_task_t; | ||
| 163 | |||
| 164 | |||
| 165 | struct rtc_timer { | ||
| 166 | struct rtc_task task; | ||
| 167 | struct timerqueue_node node; | ||
| 168 | ktime_t period; | ||
| 169 | int enabled; | ||
| 170 | }; | ||
| 171 | |||
| 155 | 172 | ||
| 156 | /* flags */ | 173 | /* flags */ |
| 157 | #define RTC_DEV_BUSY 0 | 174 | #define RTC_DEV_BUSY 0 |
| @@ -179,16 +196,13 @@ struct rtc_device | |||
| 179 | spinlock_t irq_task_lock; | 196 | spinlock_t irq_task_lock; |
| 180 | int irq_freq; | 197 | int irq_freq; |
| 181 | int max_user_freq; | 198 | int max_user_freq; |
| 182 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL | 199 | |
| 183 | struct work_struct uie_task; | 200 | struct timerqueue_head timerqueue; |
| 184 | struct timer_list uie_timer; | 201 | struct rtc_timer aie_timer; |
| 185 | /* Those fields are protected by rtc->irq_lock */ | 202 | struct rtc_timer uie_rtctimer; |
| 186 | unsigned int oldsecs; | 203 | struct hrtimer pie_timer; /* sub second exp, so needs hrtimer */ |
| 187 | unsigned int uie_irq_active:1; | 204 | int pie_enabled; |
| 188 | unsigned int stop_uie_polling:1; | 205 | struct work_struct irqwork; |
| 189 | unsigned int uie_task_active:1; | ||
| 190 | unsigned int uie_timer_active:1; | ||
| 191 | #endif | ||
| 192 | }; | 206 | }; |
| 193 | #define to_rtc_device(d) container_of(d, struct rtc_device, dev) | 207 | #define to_rtc_device(d) container_of(d, struct rtc_device, dev) |
| 194 | 208 | ||
| @@ -224,15 +238,22 @@ extern int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled); | |||
| 224 | extern int rtc_dev_update_irq_enable_emul(struct rtc_device *rtc, | 238 | extern int rtc_dev_update_irq_enable_emul(struct rtc_device *rtc, |
| 225 | unsigned int enabled); | 239 | unsigned int enabled); |
| 226 | 240 | ||
| 227 | typedef struct rtc_task { | 241 | void rtc_aie_update_irq(void *private); |
| 228 | void (*func)(void *private_data); | 242 | void rtc_uie_update_irq(void *private); |
| 229 | void *private_data; | 243 | enum hrtimer_restart rtc_pie_update_irq(struct hrtimer *timer); |
| 230 | } rtc_task_t; | ||
| 231 | 244 | ||
| 232 | int rtc_register(rtc_task_t *task); | 245 | int rtc_register(rtc_task_t *task); |
| 233 | int rtc_unregister(rtc_task_t *task); | 246 | int rtc_unregister(rtc_task_t *task); |
| 234 | int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); | 247 | int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); |
| 235 | 248 | ||
| 249 | void rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer); | ||
| 250 | void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer); | ||
| 251 | void rtc_timer_init(struct rtc_timer *timer, void (*f)(void* p), void* data); | ||
| 252 | int rtc_timer_start(struct rtc_device *rtc, struct rtc_timer* timer, | ||
| 253 | ktime_t expires, ktime_t period); | ||
| 254 | int rtc_timer_cancel(struct rtc_device *rtc, struct rtc_timer* timer); | ||
| 255 | void rtc_timer_do_work(struct work_struct *work); | ||
| 256 | |||
| 236 | static inline bool is_leap_year(unsigned int year) | 257 | static inline bool is_leap_year(unsigned int year) |
| 237 | { | 258 | { |
| 238 | return (!(year % 4) && (year % 100)) || !(year % 400); | 259 | return (!(year % 4) && (year % 100)) || !(year % 400); |
