From: Denis Osterland Date: Tue, 23 Jan 2018 12:17:58 +0000 (+0100) Subject: rtc: isl1208: Fix unintended clear of SR bits X-Git-Tag: v4.19~1240^2~77 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5b9fc795f90c0c509a24ba1f64d0d960f09e40da;p=platform%2Fkernel%2Flinux-rpi.git rtc: isl1208: Fix unintended clear of SR bits After successful sr = isl1208_i2c_set_regs(client, 0, regs, ISL1208_RTC_SECTION_LEN); sr will be 0. As a result sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, sr & ~ISL1208_REG_SR_WRTC); is equal to sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, 0); which clears all flags in SR. Add an additional read of SR, to have value of SR in sr again. Signed-off-by: Denis Osterland Signed-off-by: Michael Grzeschik Signed-off-by: Alexandre Belloni --- diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index 8dd299c..c8b4953 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c @@ -459,6 +459,11 @@ isl1208_i2c_set_time(struct i2c_client *client, struct rtc_time const *tm) } /* clear WRTC again */ + sr = isl1208_i2c_get_sr(client); + if (sr < 0) { + dev_err(&client->dev, "%s: reading SR failed\n", __func__); + return sr; + } sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, sr & ~ISL1208_REG_SR_WRTC); if (sr < 0) {