summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-rv3028.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2019-12-15 01:02:55 +0300
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2019-12-18 12:37:39 +0300
commit86e655f9f3e6aa2fd8066133e58a976bd861af6b (patch)
tree742c992a3b395c6fca87364c571b596fe8a33d2b /drivers/rtc/rtc-rv3028.c
parent92c02daabae61df37c9743e15f239a27f4917df3 (diff)
downloadlinux-86e655f9f3e6aa2fd8066133e58a976bd861af6b.tar.xz
rtc: rv3028: return meaningful value for RTC_VL_READ
RV3028_STATUS_PORF means the voltage dropped too low and data has been lost. Link: https://lore.kernel.org/r/20191214220259.621996-14-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-rv3028.c')
-rw-r--r--drivers/rtc/rtc-rv3028.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/rtc/rtc-rv3028.c b/drivers/rtc/rtc-rv3028.c
index d1a2c22861f2..a0ddc86c975a 100644
--- a/drivers/rtc/rtc-rv3028.c
+++ b/drivers/rtc/rtc-rv3028.c
@@ -428,15 +428,8 @@ static int rv3028_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
if (ret < 0)
return ret;
- if (status & RV3028_STATUS_PORF)
- dev_warn(&rv3028->rtc->dev, "Voltage low, data loss detected.\n");
-
- status &= RV3028_STATUS_PORF;
-
- if (copy_to_user((void __user *)arg, &status, sizeof(int)))
- return -EFAULT;
-
- return 0;
+ status = status & RV3028_STATUS_PORF ? RTC_VL_DATA_INVALID : 0;
+ return put_user(status, (unsigned int __user *)arg);
default:
return -ENOIOCTLCMD;