rtc: pcf85063: return meaningful value for RTC_VL_READ
PCF85063_REG_SC_OS means the voltage dropped too low and data has been lost. Link: https://lore.kernel.org/r/20191214220259.621996-12-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
parent
0295c27f90
commit
f86dc5bde1
@ -289,15 +289,9 @@ static int pcf85063_ioctl(struct device *dev, unsigned int cmd,
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (status & PCF85063_REG_SC_OS)
|
status = status & PCF85063_REG_SC_OS ? RTC_VL_DATA_INVALID : 0;
|
||||||
dev_warn(&pcf85063->rtc->dev, "Voltage low, data loss detected.\n");
|
|
||||||
|
|
||||||
status &= PCF85063_REG_SC_OS;
|
return put_user(status, (unsigned int __user *)arg);
|
||||||
|
|
||||||
if (copy_to_user((void __user *)arg, &status, sizeof(int)))
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOIOCTLCMD;
|
||||||
|
Loading…
Reference in New Issue
Block a user