diff options
Diffstat (limited to 'drivers/rtc/dev.c')
-rw-r--r-- | drivers/rtc/dev.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/rtc/dev.c b/drivers/rtc/dev.c index 1d006ef4bb57..84feb2565abd 100644 --- a/drivers/rtc/dev.c +++ b/drivers/rtc/dev.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * RTC subsystem, dev interface | 3 | * RTC subsystem, dev interface |
3 | * | 4 | * |
@@ -5,11 +6,7 @@ | |||
5 | * Author: Alessandro Zummo <a.zummo@towertech.it> | 6 | * Author: Alessandro Zummo <a.zummo@towertech.it> |
6 | * | 7 | * |
7 | * based on arch/arm/common/rtctime.c | 8 | * based on arch/arm/common/rtctime.c |
8 | * | 9 | */ |
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | 10 | ||
14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 11 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
15 | 12 | ||
@@ -60,7 +57,7 @@ static void rtc_uie_task(struct work_struct *work) | |||
60 | } else if (rtc->oldsecs != tm.tm_sec) { | 57 | } else if (rtc->oldsecs != tm.tm_sec) { |
61 | num = (tm.tm_sec + 60 - rtc->oldsecs) % 60; | 58 | num = (tm.tm_sec + 60 - rtc->oldsecs) % 60; |
62 | rtc->oldsecs = tm.tm_sec; | 59 | rtc->oldsecs = tm.tm_sec; |
63 | rtc->uie_timer.expires = jiffies + HZ - (HZ/10); | 60 | rtc->uie_timer.expires = jiffies + HZ - (HZ / 10); |
64 | rtc->uie_timer_active = 1; | 61 | rtc->uie_timer_active = 1; |
65 | rtc->uie_task_active = 0; | 62 | rtc->uie_task_active = 0; |
66 | add_timer(&rtc->uie_timer); | 63 | add_timer(&rtc->uie_timer); |
@@ -71,6 +68,7 @@ static void rtc_uie_task(struct work_struct *work) | |||
71 | if (num) | 68 | if (num) |
72 | rtc_handle_legacy_irq(rtc, num, RTC_UF); | 69 | rtc_handle_legacy_irq(rtc, num, RTC_UF); |
73 | } | 70 | } |
71 | |||
74 | static void rtc_uie_timer(struct timer_list *t) | 72 | static void rtc_uie_timer(struct timer_list *t) |
75 | { | 73 | { |
76 | struct rtc_device *rtc = from_timer(rtc, t, uie_timer); | 74 | struct rtc_device *rtc = from_timer(rtc, t, uie_timer); |
@@ -202,14 +200,14 @@ static __poll_t rtc_dev_poll(struct file *file, poll_table *wait) | |||
202 | } | 200 | } |
203 | 201 | ||
204 | static long rtc_dev_ioctl(struct file *file, | 202 | static long rtc_dev_ioctl(struct file *file, |
205 | unsigned int cmd, unsigned long arg) | 203 | unsigned int cmd, unsigned long arg) |
206 | { | 204 | { |
207 | int err = 0; | 205 | int err = 0; |
208 | struct rtc_device *rtc = file->private_data; | 206 | struct rtc_device *rtc = file->private_data; |
209 | const struct rtc_class_ops *ops = rtc->ops; | 207 | const struct rtc_class_ops *ops = rtc->ops; |
210 | struct rtc_time tm; | 208 | struct rtc_time tm; |
211 | struct rtc_wkalrm alarm; | 209 | struct rtc_wkalrm alarm; |
212 | void __user *uarg = (void __user *) arg; | 210 | void __user *uarg = (void __user *)arg; |
213 | 211 | ||
214 | err = mutex_lock_interruptible(&rtc->ops_lock); | 212 | err = mutex_lock_interruptible(&rtc->ops_lock); |
215 | if (err) | 213 | if (err) |
@@ -233,7 +231,7 @@ static long rtc_dev_ioctl(struct file *file, | |||
233 | 231 | ||
234 | case RTC_PIE_ON: | 232 | case RTC_PIE_ON: |
235 | if (rtc->irq_freq > rtc->max_user_freq && | 233 | if (rtc->irq_freq > rtc->max_user_freq && |
236 | !capable(CAP_SYS_RESOURCE)) | 234 | !capable(CAP_SYS_RESOURCE)) |
237 | err = -EACCES; | 235 | err = -EACCES; |
238 | break; | 236 | break; |
239 | } | 237 | } |
@@ -390,8 +388,9 @@ static long rtc_dev_ioctl(struct file *file, | |||
390 | err = ops->ioctl(rtc->dev.parent, cmd, arg); | 388 | err = ops->ioctl(rtc->dev.parent, cmd, arg); |
391 | if (err == -ENOIOCTLCMD) | 389 | if (err == -ENOIOCTLCMD) |
392 | err = -ENOTTY; | 390 | err = -ENOTTY; |
393 | } else | 391 | } else { |
394 | err = -ENOTTY; | 392 | err = -ENOTTY; |
393 | } | ||
395 | break; | 394 | break; |
396 | } | 395 | } |
397 | 396 | ||
@@ -403,6 +402,7 @@ done: | |||
403 | static int rtc_dev_fasync(int fd, struct file *file, int on) | 402 | static int rtc_dev_fasync(int fd, struct file *file, int on) |
404 | { | 403 | { |
405 | struct rtc_device *rtc = file->private_data; | 404 | struct rtc_device *rtc = file->private_data; |
405 | |||
406 | return fasync_helper(fd, file, on, &rtc->async_queue); | 406 | return fasync_helper(fd, file, on, &rtc->async_queue); |
407 | } | 407 | } |
408 | 408 | ||