diff options
author | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2021-10-18 18:19:30 +0300 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2021-10-18 18:20:50 +0300 |
commit | a6d8c6e1a5c6fb982964861dc84c0c7cb0151c7c (patch) | |
tree | 8d2c5f907bf0414f056a087067ebc2f9ea7a6384 /drivers/rtc | |
parent | 2268551935dbf1abcbb4d4fb7b1ad74dbe0d1be0 (diff) | |
download | linux-a6d8c6e1a5c6fb982964861dc84c0c7cb0151c7c.tar.xz |
rtc: add correction parameter
Add a new parameter allowing the get and set the correction using ioctls
instead of just sysfs.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20211018151933.76865-5-alexandre.belloni@bootlin.com
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/dev.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/rtc/dev.c b/drivers/rtc/dev.c index 143c097eff0f..abee1fc4705e 100644 --- a/drivers/rtc/dev.c +++ b/drivers/rtc/dev.c @@ -398,6 +398,16 @@ static long rtc_dev_ioctl(struct file *file, param.uvalue = rtc->features[0]; break; + case RTC_PARAM_CORRECTION: + mutex_unlock(&rtc->ops_lock); + if (param.index != 0) + return -EINVAL; + err = rtc_read_offset(rtc, &offset); + mutex_lock(&rtc->ops_lock); + if (err == 0) + param.svalue = offset; + break; + default: err = -EINVAL; } @@ -416,6 +426,15 @@ static long rtc_dev_ioctl(struct file *file, switch(param.param) { case RTC_PARAM_FEATURES: + err = -EINVAL; + break; + + case RTC_PARAM_CORRECTION: + mutex_unlock(&rtc->ops_lock); + if (param.index != 0) + return -EINVAL; + return rtc_set_offset(rtc, param.svalue); + default: err = -EINVAL; } |