Commit 9f05342a authored by Alexandre Belloni's avatar Alexandre Belloni

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.comSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 790a19f1
...@@ -523,12 +523,9 @@ static int abx80x_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) ...@@ -523,12 +523,9 @@ static int abx80x_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
if (status < 0) if (status < 0)
return status; 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 put_user(tmp, (unsigned int __user *)arg);
return -EFAULT;
return 0;
case RTC_VL_CLR: case RTC_VL_CLR:
status = i2c_smbus_read_byte_data(client, ABX8XX_REG_STATUS); status = i2c_smbus_read_byte_data(client, ABX8XX_REG_STATUS);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment