Commit af427311 authored by Alexandre Belloni's avatar Alexandre Belloni

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.comSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 9f05342a
......@@ -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;
}
......
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