diff options
author | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2019-12-14 23:02:46 +0100 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2019-12-18 10:37:23 +0100 |
commit | af4273116d2ccc6e7712de54169d4a9998d52f8a (patch) | |
tree | 8adea75e36c0944884473bb0bbe55b21e02a0df7 /drivers/rtc/rtc-pcf2127.c | |
parent | rtc: abx80x: return meaningful value for RTC_VL_READ (diff) | |
download | linux-af4273116d2ccc6e7712de54169d4a9998d52f8a.tar.xz linux-af4273116d2ccc6e7712de54169d4a9998d52f8a.zip |
rtc: pcf2127: return meaningful value for RTC_VL_READ
PCF2127_BIT_CTRL3_BLF indicates the battery is low and needs to be replaced
soon.
Link: https://lore.kernel.org/r/20191214220259.621996-5-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-pcf2127.c')
-rw-r--r-- | drivers/rtc/rtc-pcf2127.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c index ba5baaca47be..4e50d6768f13 100644 --- a/drivers/rtc/rtc-pcf2127.c +++ b/drivers/rtc/rtc-pcf2127.c @@ -199,11 +199,9 @@ static int pcf2127_rtc_ioctl(struct device *dev, if (ret) return ret; - touser = touser & PCF2127_BIT_CTRL3_BLF ? 1 : 0; + touser = touser & PCF2127_BIT_CTRL3_BLF ? RTC_VL_BACKUP_LOW : 0; - if (copy_to_user((void __user *)arg, &touser, sizeof(int))) - return -EFAULT; - return 0; + return put_user(touser, (unsigned int __user *)arg); default: return -ENOIOCTLCMD; } |