aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/dev.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-05-09 17:46:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-09 17:46:33 -0400
commit8e4ff713ce313dcabbb60e6ede1ffc193e67631f (patch)
tree8efdfe4925570ec8608d40e229ed01a5432d901e /drivers/rtc/dev.c
parent45182e4e1f8ac04708ca7508c51d9103f07d81ab (diff)
parentdacb6a4035a010e41abaf81c1cfe2beadfb05ec8 (diff)
Merge tag 'rtc-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
Pull RTC updates from Alexandre Belloni: "A huge series from me this cycle. I went through many drivers to set the date and time range supported by the RTC which helps solving HW limitation when the time comes (as early as next year for some). This time, I focused on drivers using .set_mms and .set_mmss64, allowing me to remove those callbacks. About a third of the patches got reviews, I actually own the RTCs and I tested another third and the remaining one are unlikely to cause any issues. Other than that, a single new driver and the usual fixes here and there. Summary: Subsystem: - set_mmss and set_mmss64 rtc_ops removal - Fix timestamp value for RTC_TIMESTAMP_BEGIN_1900 - Use SPDX identifier for the core - validate upper bound of tm->tm_year New driver: - Aspeed BMC SoC RTC Drivers: - abx80x: use rtc_add_group - ds3232: nvram support - pcf85063: add alarm, nvram, offset correction and microcrystal rv8263 support - x1205: add of_match_table - Use set_time instead of set_mms/set_mmss64 for: ab3100, coh901331, digicolor, ds1672, ds2404, ep93xx, imxdi, jz4740, lpc32xx, mc13xxx, mxc, pcap, stmp3xxx, test, wm831x, xgene. - Set RTC range for: ab3100, at91sam9, coh901331, da9063, digicolor, dm355evm, ds1672, ds2404, ep39xx, goldfish, imxdi, jz4740, lpc32xx, mc13xxx, mv, mxc, omap, pcap, pcf85063, pcf85363, ps3, sh, stmp3xxx, sun4v, tegra, wm831x, xgene. - Switch to rtc_time64_to_tm/rtc_tm_to_time64 for the driver that properly set the RTC range. - Use dev_get_drvdata instead of multiple indirections" * tag 'rtc-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (177 commits) rtc: snvs: Use __maybe_unused instead of #if CONFIG_PM_SLEEP rtc: imxdi: remove unused variable rtc: drop set_mms and set_mmss64 rtc: pcap: convert to SPDX identifier rtc: pcap: use .set_time rtc: pcap: switch to rtc_time64_to_tm/rtc_tm_to_time64 rtc: pcap: set range rtc: digicolor: convert to SPDX identifier rtc: digicolor: use .set_time rtc: digicolor: set range rtc: digicolor: fix possible race condition rtc: jz4740: convert to SPDX identifier rtc: jz4740: rework invalid time detection rtc: jz4740: use dev_pm_set_wake_irq() to simplify code rtc: jz4740: use .set_time rtc: jz4740: remove useless check rtc: jz4740: switch to rtc_time64_to_tm/rtc_tm_to_time64 rtc: jz4740: set range rtc: 88pm860x: prevent use-after-free on device remove rtc: Use dev_get_drvdata() ...
Diffstat (limited to 'drivers/rtc/dev.c')
-rw-r--r--drivers/rtc/dev.c20
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
74static void rtc_uie_timer(struct timer_list *t) 72static 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
204static long rtc_dev_ioctl(struct file *file, 202static 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:
403static int rtc_dev_fasync(int fd, struct file *file, int on) 402static 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