aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-abx80x.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2019-12-14 23:02:45 +0100
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2019-12-18 10:37:21 +0100
commit9f05342a9720a37096cbbead70909430c2e56358 (patch)
tree4daffc0fdc42a5abcf0ffa44ab805883eff67a99 /drivers/rtc/rtc-abx80x.c
parent790a19f18a70bf1e30b6b4d00559e1bb8a3f7e23 (diff)
downloadlinux-9f05342a9720a37096cbbead70909430c2e56358.tar.gz
rtc: abx80x: return meaningful value for RTC_VL_READ
ABX8XX_STATUS_BLF indicates the battery is low and needs to be replaced soon. Link: https://lore.kernel.org/r/20191214220259.621996-4-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-abx80x.c')
-rw-r--r--drivers/rtc/rtc-abx80x.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
index 73830670a41f1..3521d8e8dc38d 100644
--- a/drivers/rtc/rtc-abx80x.c
+++ b/drivers/rtc/rtc-abx80x.c
@@ -523,12 +523,9 @@ static int abx80x_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
if (status < 0)
return status;
- tmp = !!(status & ABX8XX_STATUS_BLF);
+ tmp = status & ABX8XX_STATUS_BLF ? RTC_VL_BACKUP_LOW : 0;
- if (copy_to_user((void __user *)arg, &tmp, sizeof(int)))
- return -EFAULT;
-
- return 0;
+ return put_user(tmp, (unsigned int __user *)arg);
case RTC_VL_CLR:
status = i2c_smbus_read_byte_data(client, ABX8XX_REG_STATUS);