diff for duplicates of <1469097692-103146-4-git-send-email-benoit@wsystem.com> diff --git a/a/1.txt b/N1/1.txt index ca74651..4964535 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,18 +1,17 @@ -The I=C2=B2C NACK issue of the RV-8803 may occur after any I=C2=B2C START +The I²C NACK issue of the RV-8803 may occur after any I²C START condition, depending on the timings. Consequently, the workaround must -be applied for all the I=C2=B2C transfers. +be applied for all the I²C transfers. -This commit abstracts the I=C2=B2C transfer code into register access -functions. This avoids duplicating the I=C2=B2C workaround everywhere. This +This commit abstracts the I²C transfer code into register access +functions. This avoids duplicating the I²C workaround everywhere. This also avoids the duplication of the code handling the return value of i2c_smbus_read_i2c_block_data(). Error messages are issued in case of definitive register access failures (if the workaround fails). This -change also makes the I=C2=B2C transfer return value checks consistent. +change also makes the I²C transfer return value checks consistent. -Signed-off-by: Beno=C3=AEt Th=C3=A9baudeau <benoit@wsystem.com> +Signed-off-by: Benoît Thébaudeau <benoit@wsystem.com> --- - drivers/rtc/rtc-rv8803.c | 179 ++++++++++++++++++++++++++++++-------------= ----- + drivers/rtc/rtc-rv8803.c | 179 ++++++++++++++++++++++++++++++----------------- 1 file changed, 113 insertions(+), 66 deletions(-) diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c @@ -22,7 +21,7 @@ index aa1d6b6..09ab5cb 100644 @@ -20,6 +20,8 @@ #include <linux/module.h> #include <linux/rtc.h> -=20 + +#define RV8803_I2C_TRY_COUNT 4 + #define RV8803_SEC 0x00 @@ -31,20 +30,19 @@ index aa1d6b6..09ab5cb 100644 @@ -57,19 +59,85 @@ struct rv8803_data { u8 ctrl; }; -=20 + +static int rv8803_read_reg(const struct i2c_client *client, u8 reg) +{ -+ int try =3D RV8803_I2C_TRY_COUNT; ++ int try = RV8803_I2C_TRY_COUNT; + s32 ret; + + /* -+ * There is a 61=C2=B5s window during which the RTC does not acknowledge = -I2C ++ * There is a 61µs window during which the RTC does not acknowledge I2C + * transfers. In that case, ensure that there are multiple attempts. + */ + do -+ ret =3D i2c_smbus_read_byte_data(client, reg); -+ while ((ret =3D=3D -ENXIO || ret =3D=3D -EIO) && --try); ++ ret = i2c_smbus_read_byte_data(client, reg); ++ while ((ret == -ENXIO || ret == -EIO) && --try); + if (ret < 0) + dev_err(&client->dev, "Unable to read register 0x%02x\n", reg); + @@ -54,13 +52,13 @@ I2C +static int rv8803_read_regs(const struct i2c_client *client, + u8 reg, u8 count, u8 *values) +{ -+ int try =3D RV8803_I2C_TRY_COUNT; ++ int try = RV8803_I2C_TRY_COUNT; + s32 ret; + + do -+ ret =3D i2c_smbus_read_i2c_block_data(client, reg, count, values); -+ while ((ret =3D=3D -ENXIO || ret =3D=3D -EIO) && --try); -+ if (ret !=3D count) { ++ ret = i2c_smbus_read_i2c_block_data(client, reg, count, values); ++ while ((ret == -ENXIO || ret == -EIO) && --try); ++ if (ret != count) { + dev_err(&client->dev, + "Unable to read registers 0x%02x..0x%02x\n", + reg, reg + count - 1); @@ -70,15 +68,14 @@ I2C + return 0; +} + -+static int rv8803_write_reg(const struct i2c_client *client, u8 reg, u8 va= -lue) ++static int rv8803_write_reg(const struct i2c_client *client, u8 reg, u8 value) +{ -+ int try =3D RV8803_I2C_TRY_COUNT; ++ int try = RV8803_I2C_TRY_COUNT; + s32 ret; + + do -+ ret =3D i2c_smbus_write_byte_data(client, reg, value); -+ while ((ret =3D=3D -ENXIO || ret =3D=3D -EIO) && --try); ++ ret = i2c_smbus_write_byte_data(client, reg, value); ++ while ((ret == -ENXIO || ret == -EIO) && --try); + if (ret) + dev_err(&client->dev, "Unable to write register 0x%02x\n", reg); + @@ -88,13 +85,13 @@ lue) +static int rv8803_write_regs(const struct i2c_client *client, + u8 reg, u8 count, const u8 *values) +{ -+ int try =3D RV8803_I2C_TRY_COUNT; ++ int try = RV8803_I2C_TRY_COUNT; + s32 ret; + + do -+ ret =3D i2c_smbus_write_i2c_block_data(client, reg, count, ++ ret = i2c_smbus_write_i2c_block_data(client, reg, count, + values); -+ while ((ret =3D=3D -ENXIO || ret =3D=3D -EIO) && --try); ++ while ((ret == -ENXIO || ret == -EIO) && --try); + if (ret) + dev_err(&client->dev, + "Unable to write registers 0x%02x..0x%02x\n", @@ -105,25 +102,24 @@ lue) + static irqreturn_t rv8803_handle_irq(int irq, void *dev_id) { - struct i2c_client *client =3D dev_id; - struct rv8803_data *rv8803 =3D i2c_get_clientdata(client); - unsigned long events =3D 0; -- int flags, try =3D 0; + struct i2c_client *client = dev_id; + struct rv8803_data *rv8803 = i2c_get_clientdata(client); + unsigned long events = 0; +- int flags, try = 0; + int flags; -=20 + mutex_lock(&rv8803->flags_lock); -=20 + - do { -- flags =3D i2c_smbus_read_byte_data(client, RV8803_FLAG); +- flags = i2c_smbus_read_byte_data(client, RV8803_FLAG); - try++; -- } while (((flags =3D=3D -ENXIO) || (flags =3D=3D -EIO)) && (try < 4)); -+ flags =3D rv8803_read_reg(client, RV8803_FLAG); - if (flags <=3D 0) { +- } while (((flags == -ENXIO) || (flags == -EIO)) && (try < 4)); ++ flags = rv8803_read_reg(client, RV8803_FLAG); + if (flags <= 0) { mutex_unlock(&rv8803->flags_lock); return IRQ_NONE; -@@ -101,9 +169,8 @@ static irqreturn_t rv8803_handle_irq(int irq, void *dev= -_id) -=20 +@@ -101,9 +169,8 @@ static irqreturn_t rv8803_handle_irq(int irq, void *dev_id) + if (events) { rtc_update_irq(rv8803->rtc, 1, events); - i2c_smbus_write_byte_data(client, RV8803_FLAG, flags); @@ -132,277 +128,250 @@ _id) + rv8803_write_reg(client, RV8803_FLAG, flags); + rv8803_write_reg(rv8803->client, RV8803_CTRL, rv8803->ctrl); } -=20 + mutex_unlock(&rv8803->flags_lock); -@@ -119,7 +186,7 @@ static int rv8803_get_time(struct device *dev, struct r= -tc_time *tm) - u8 *date =3D date1; +@@ -119,7 +186,7 @@ static int rv8803_get_time(struct device *dev, struct rtc_time *tm) + u8 *date = date1; int ret, flags; -=20 -- flags =3D i2c_smbus_read_byte_data(rv8803->client, RV8803_FLAG); -+ flags =3D rv8803_read_reg(rv8803->client, RV8803_FLAG); + +- flags = i2c_smbus_read_byte_data(rv8803->client, RV8803_FLAG); ++ flags = rv8803_read_reg(rv8803->client, RV8803_FLAG); if (flags < 0) return flags; -=20 -@@ -128,16 +195,14 @@ static int rv8803_get_time(struct device *dev, struct= - rtc_time *tm) + +@@ -128,16 +195,14 @@ static int rv8803_get_time(struct device *dev, struct rtc_time *tm) return -EINVAL; } -=20 -- ret =3D i2c_smbus_read_i2c_block_data(rv8803->client, RV8803_SEC, + +- ret = i2c_smbus_read_i2c_block_data(rv8803->client, RV8803_SEC, - 7, date); -- if (ret !=3D 7) +- if (ret != 7) - return ret < 0 ? ret : -EIO; -+ ret =3D rv8803_read_regs(rv8803->client, RV8803_SEC, 7, date); ++ ret = rv8803_read_regs(rv8803->client, RV8803_SEC, 7, date); + if (ret) + return ret; -=20 - if ((date1[RV8803_SEC] & 0x7f) =3D=3D bin2bcd(59)) { -- ret =3D i2c_smbus_read_i2c_block_data(rv8803->client, RV8803_SEC, + + if ((date1[RV8803_SEC] & 0x7f) == bin2bcd(59)) { +- ret = i2c_smbus_read_i2c_block_data(rv8803->client, RV8803_SEC, - 7, date2); -- if (ret !=3D 7) +- if (ret != 7) - return ret < 0 ? ret : -EIO; -+ ret =3D rv8803_read_regs(rv8803->client, RV8803_SEC, 7, date2); ++ ret = rv8803_read_regs(rv8803->client, RV8803_SEC, 7, date2); + if (ret) + return ret; -=20 - if ((date2[RV8803_SEC] & 0x7f) !=3D bin2bcd(59)) - date =3D date2; -@@ -171,21 +236,20 @@ static int rv8803_set_time(struct device *dev, struct= - rtc_time *tm) - date[RV8803_MONTH] =3D bin2bcd(tm->tm_mon + 1); - date[RV8803_YEAR] =3D bin2bcd(tm->tm_year - 100); -=20 -- ret =3D i2c_smbus_write_i2c_block_data(rv8803->client, RV8803_SEC, + + if ((date2[RV8803_SEC] & 0x7f) != bin2bcd(59)) + date = date2; +@@ -171,21 +236,20 @@ static int rv8803_set_time(struct device *dev, struct rtc_time *tm) + date[RV8803_MONTH] = bin2bcd(tm->tm_mon + 1); + date[RV8803_YEAR] = bin2bcd(tm->tm_year - 100); + +- ret = i2c_smbus_write_i2c_block_data(rv8803->client, RV8803_SEC, - 7, date); - if (ret < 0) -+ ret =3D rv8803_write_regs(rv8803->client, RV8803_SEC, 7, date); ++ ret = rv8803_write_regs(rv8803->client, RV8803_SEC, 7, date); + if (ret) return ret; -=20 + mutex_lock(&rv8803->flags_lock); -=20 -- flags =3D i2c_smbus_read_byte_data(rv8803->client, RV8803_FLAG); -+ flags =3D rv8803_read_reg(rv8803->client, RV8803_FLAG); + +- flags = i2c_smbus_read_byte_data(rv8803->client, RV8803_FLAG); ++ flags = rv8803_read_reg(rv8803->client, RV8803_FLAG); if (flags < 0) { mutex_unlock(&rv8803->flags_lock); return flags; } -=20 -- ret =3D i2c_smbus_write_byte_data(rv8803->client, RV8803_FLAG, + +- ret = i2c_smbus_write_byte_data(rv8803->client, RV8803_FLAG, - flags & ~RV8803_FLAG_V2F); -+ ret =3D rv8803_write_reg(rv8803->client, RV8803_FLAG, ++ ret = rv8803_write_reg(rv8803->client, RV8803_FLAG, + flags & ~RV8803_FLAG_V2F); -=20 + mutex_unlock(&rv8803->flags_lock); -=20 -@@ -199,12 +263,11 @@ static int rv8803_get_alarm(struct device *dev, struc= -t rtc_wkalrm *alrm) + +@@ -199,12 +263,11 @@ static int rv8803_get_alarm(struct device *dev, struct rtc_wkalrm *alrm) u8 alarmvals[3]; int flags, ret; -=20 -- ret =3D i2c_smbus_read_i2c_block_data(client, RV8803_ALARM_MIN, + +- ret = i2c_smbus_read_i2c_block_data(client, RV8803_ALARM_MIN, - 3, alarmvals); -- if (ret !=3D 3) +- if (ret != 3) - return ret < 0 ? ret : -EIO; -+ ret =3D rv8803_read_regs(client, RV8803_ALARM_MIN, 3, alarmvals); ++ ret = rv8803_read_regs(client, RV8803_ALARM_MIN, 3, alarmvals); + if (ret) + return ret; -=20 -- flags =3D i2c_smbus_read_byte_data(client, RV8803_FLAG); -+ flags =3D rv8803_read_reg(client, RV8803_FLAG); + +- flags = i2c_smbus_read_byte_data(client, RV8803_FLAG); ++ flags = rv8803_read_reg(client, RV8803_FLAG); if (flags < 0) return flags; -=20 -@@ -237,10 +300,10 @@ static int rv8803_set_alarm(struct device *dev, struc= -t rtc_wkalrm *alrm) -=20 + +@@ -237,10 +300,10 @@ static int rv8803_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) + mutex_lock(&rv8803->flags_lock); -=20 -- ret =3D i2c_smbus_read_i2c_block_data(client, RV8803_FLAG, 2, ctrl); -- if (ret !=3D 2) { -+ ret =3D rv8803_read_regs(client, RV8803_FLAG, 2, ctrl); + +- ret = i2c_smbus_read_i2c_block_data(client, RV8803_FLAG, 2, ctrl); +- if (ret != 2) { ++ ret = rv8803_read_regs(client, RV8803_FLAG, 2, ctrl); + if (ret) { mutex_unlock(&rv8803->flags_lock); - return ret < 0 ? ret : -EIO; + return ret; } -=20 - alarmvals[0] =3D bin2bcd(alrm->time.tm_min); -@@ -249,8 +312,8 @@ static int rv8803_set_alarm(struct device *dev, struct = -rtc_wkalrm *alrm) -=20 + + alarmvals[0] = bin2bcd(alrm->time.tm_min); +@@ -249,8 +312,8 @@ static int rv8803_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) + if (rv8803->ctrl & (RV8803_CTRL_AIE | RV8803_CTRL_UIE)) { - rv8803->ctrl &=3D ~(RV8803_CTRL_AIE | RV8803_CTRL_UIE); -- err =3D i2c_smbus_write_byte_data(rv8803->client, RV8803_CTRL, + rv8803->ctrl &= ~(RV8803_CTRL_AIE | RV8803_CTRL_UIE); +- err = i2c_smbus_write_byte_data(rv8803->client, RV8803_CTRL, - rv8803->ctrl); -+ err =3D rv8803_write_reg(rv8803->client, RV8803_CTRL, ++ err = rv8803_write_reg(rv8803->client, RV8803_CTRL, + rv8803->ctrl); if (err) { mutex_unlock(&rv8803->flags_lock); return err; -@@ -258,13 +321,12 @@ static int rv8803_set_alarm(struct device *dev, struc= -t rtc_wkalrm *alrm) +@@ -258,13 +321,12 @@ static int rv8803_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) } -=20 - ctrl[1] &=3D ~RV8803_FLAG_AF; -- err =3D i2c_smbus_write_byte_data(rv8803->client, RV8803_FLAG, ctrl[1]); -+ err =3D rv8803_write_reg(rv8803->client, RV8803_FLAG, ctrl[1]); + + ctrl[1] &= ~RV8803_FLAG_AF; +- err = i2c_smbus_write_byte_data(rv8803->client, RV8803_FLAG, ctrl[1]); ++ err = rv8803_write_reg(rv8803->client, RV8803_FLAG, ctrl[1]); mutex_unlock(&rv8803->flags_lock); if (err) return err; -=20 -- err =3D i2c_smbus_write_i2c_block_data(rv8803->client, RV8803_ALARM_MIN, + +- err = i2c_smbus_write_i2c_block_data(rv8803->client, RV8803_ALARM_MIN, - 3, alarmvals); -+ err =3D rv8803_write_regs(rv8803->client, RV8803_ALARM_MIN, 3, alarmvals)= -; ++ err = rv8803_write_regs(rv8803->client, RV8803_ALARM_MIN, 3, alarmvals); if (err) return err; -=20 -@@ -274,8 +336,8 @@ static int rv8803_set_alarm(struct device *dev, struct = -rtc_wkalrm *alrm) + +@@ -274,8 +336,8 @@ static int rv8803_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) if (rv8803->rtc->aie_timer.enabled) - rv8803->ctrl |=3D RV8803_CTRL_AIE; -=20 -- err =3D i2c_smbus_write_byte_data(rv8803->client, RV8803_CTRL, + rv8803->ctrl |= RV8803_CTRL_AIE; + +- err = i2c_smbus_write_byte_data(rv8803->client, RV8803_CTRL, - rv8803->ctrl); -+ err =3D rv8803_write_reg(rv8803->client, RV8803_CTRL, ++ err = rv8803_write_reg(rv8803->client, RV8803_CTRL, + rv8803->ctrl); if (err) return err; } -@@ -304,21 +366,20 @@ static int rv8803_alarm_irq_enable(struct device *dev= -, unsigned int enabled) +@@ -304,21 +366,20 @@ static int rv8803_alarm_irq_enable(struct device *dev, unsigned int enabled) } -=20 + mutex_lock(&rv8803->flags_lock); -- flags =3D i2c_smbus_read_byte_data(client, RV8803_FLAG); -+ flags =3D rv8803_read_reg(client, RV8803_FLAG); +- flags = i2c_smbus_read_byte_data(client, RV8803_FLAG); ++ flags = rv8803_read_reg(client, RV8803_FLAG); if (flags < 0) { mutex_unlock(&rv8803->flags_lock); return flags; } - flags &=3D ~(RV8803_FLAG_AF | RV8803_FLAG_UF); -- err =3D i2c_smbus_write_byte_data(client, RV8803_FLAG, flags); -+ err =3D rv8803_write_reg(client, RV8803_FLAG, flags); + flags &= ~(RV8803_FLAG_AF | RV8803_FLAG_UF); +- err = i2c_smbus_write_byte_data(client, RV8803_FLAG, flags); ++ err = rv8803_write_reg(client, RV8803_FLAG, flags); mutex_unlock(&rv8803->flags_lock); if (err) return err; -=20 - if (ctrl !=3D rv8803->ctrl) { - rv8803->ctrl =3D ctrl; -- err =3D i2c_smbus_write_byte_data(client, RV8803_CTRL, + + if (ctrl != rv8803->ctrl) { + rv8803->ctrl = ctrl; +- err = i2c_smbus_write_byte_data(client, RV8803_CTRL, - rv8803->ctrl); -+ err =3D rv8803_write_reg(client, RV8803_CTRL, rv8803->ctrl); ++ err = rv8803_write_reg(client, RV8803_CTRL, rv8803->ctrl); if (err) return err; } -@@ -334,7 +395,7 @@ static int rv8803_ioctl(struct device *dev, unsigned in= -t cmd, unsigned long arg) -=20 +@@ -334,7 +395,7 @@ static int rv8803_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) + switch (cmd) { case RTC_VL_READ: -- flags =3D i2c_smbus_read_byte_data(client, RV8803_FLAG); -+ flags =3D rv8803_read_reg(client, RV8803_FLAG); +- flags = i2c_smbus_read_byte_data(client, RV8803_FLAG); ++ flags = rv8803_read_reg(client, RV8803_FLAG); if (flags < 0) return flags; -=20 -@@ -353,16 +414,16 @@ static int rv8803_ioctl(struct device *dev, unsigned = -int cmd, unsigned long arg) -=20 + +@@ -353,16 +414,16 @@ static int rv8803_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) + case RTC_VL_CLR: mutex_lock(&rv8803->flags_lock); -- flags =3D i2c_smbus_read_byte_data(client, RV8803_FLAG); -+ flags =3D rv8803_read_reg(client, RV8803_FLAG); +- flags = i2c_smbus_read_byte_data(client, RV8803_FLAG); ++ flags = rv8803_read_reg(client, RV8803_FLAG); if (flags < 0) { mutex_unlock(&rv8803->flags_lock); return flags; } -=20 - flags &=3D ~(RV8803_FLAG_V1F | RV8803_FLAG_V2F); -- ret =3D i2c_smbus_write_byte_data(client, RV8803_FLAG, flags); -+ ret =3D rv8803_write_reg(client, RV8803_FLAG, flags); + + flags &= ~(RV8803_FLAG_V1F | RV8803_FLAG_V2F); +- ret = i2c_smbus_write_byte_data(client, RV8803_FLAG, flags); ++ ret = rv8803_write_reg(client, RV8803_FLAG, flags); mutex_unlock(&rv8803->flags_lock); - if (ret < 0) + if (ret) return ret; -=20 + return 0; -@@ -380,8 +441,8 @@ static ssize_t rv8803_nvram_write(struct file *filp, st= -ruct kobject *kobj, - struct i2c_client *client =3D to_i2c_client(dev); +@@ -380,8 +441,8 @@ static ssize_t rv8803_nvram_write(struct file *filp, struct kobject *kobj, + struct i2c_client *client = to_i2c_client(dev); int ret; -=20 -- ret =3D i2c_smbus_write_byte_data(client, RV8803_RAM, buf[0]); + +- ret = i2c_smbus_write_byte_data(client, RV8803_RAM, buf[0]); - if (ret < 0) -+ ret =3D rv8803_write_reg(client, RV8803_RAM, buf[0]); ++ ret = rv8803_write_reg(client, RV8803_RAM, buf[0]); + if (ret) return ret; -=20 + return 1; -@@ -395,7 +456,7 @@ static ssize_t rv8803_nvram_read(struct file *filp, str= -uct kobject *kobj, - struct i2c_client *client =3D to_i2c_client(dev); +@@ -395,7 +456,7 @@ static ssize_t rv8803_nvram_read(struct file *filp, struct kobject *kobj, + struct i2c_client *client = to_i2c_client(dev); int ret; -=20 -- ret =3D i2c_smbus_read_byte_data(client, RV8803_RAM); -+ ret =3D rv8803_read_reg(client, RV8803_RAM); + +- ret = i2c_smbus_read_byte_data(client, RV8803_RAM); ++ ret = rv8803_read_reg(client, RV8803_RAM); if (ret < 0) return ret; -=20 + @@ -425,7 +486,7 @@ static int rv8803_probe(struct i2c_client *client, { - struct i2c_adapter *adapter =3D to_i2c_adapter(client->dev.parent); + struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); struct rv8803_data *rv8803; -- int err, flags, try =3D 0; +- int err, flags, try = 0; + int err, flags; -=20 + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_I2C_BLOCK)) { @@ -442,16 +503,7 @@ static int rv8803_probe(struct i2c_client *client, - rv8803->client =3D client; + rv8803->client = client; i2c_set_clientdata(client, rv8803); -=20 + - /* -- * There is a 60=C2=B5s window where the RTC may not reply on the i2c bus= - in +- * There is a 60µs window where the RTC may not reply on the i2c bus in - * that case, the transfer is not ACKed. In that case, ensure there are - * multiple attempts. - */ - do { -- flags =3D i2c_smbus_read_byte_data(client, RV8803_FLAG); +- flags = i2c_smbus_read_byte_data(client, RV8803_FLAG); - try++; -- } while (((flags =3D=3D -ENXIO) || (flags =3D=3D -EIO)) && (try < 4)); +- } while (((flags == -ENXIO) || (flags == -EIO)) && (try < 4)); - -+ flags =3D rv8803_read_reg(client, RV8803_FLAG); ++ flags = rv8803_read_reg(client, RV8803_FLAG); if (flags < 0) return flags; -=20 + @@ -486,12 +538,7 @@ static int rv8803_probe(struct i2c_client *client, return PTR_ERR(rv8803->rtc); } -=20 -- try =3D 0; + +- try = 0; - do { -- err =3D i2c_smbus_write_byte_data(rv8803->client, RV8803_EXT, +- err = i2c_smbus_write_byte_data(rv8803->client, RV8803_EXT, - RV8803_EXT_WADA); - try++; -- } while (((err =3D=3D -ENXIO) || (flags =3D=3D -EIO)) && (try < 4)); -+ err =3D rv8803_write_reg(rv8803->client, RV8803_EXT, RV8803_EXT_WADA); +- } while (((err == -ENXIO) || (flags == -EIO)) && (try < 4)); ++ err = rv8803_write_reg(rv8803->client, RV8803_EXT, RV8803_EXT_WADA); if (err) return err; -=20 ---=20 + +-- 2.5.0 - ---=20 -You received this message because you are subscribed to "rtc-linux". -Membership options at http://groups.google.com/group/rtc-linux . -Please read http://groups.google.com/group/rtc-linux/web/checklist -before submitting a driver. ----=20 -You received this message because you are subscribed to the Google Groups "= -rtc-linux" group. -To unsubscribe from this group and stop receiving emails from it, send an e= -mail to rtc-linux+unsubscribe@googlegroups.com. -For more options, visit https://groups.google.com/d/optout. diff --git a/a/content_digest b/N1/content_digest index f52137c..dd5b622 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,6 +1,6 @@ "ref\01469097692-103146-1-git-send-email-benoit@wsystem.com\0" "From\0Beno\303\256t Th\303\251baudeau <benoit@wsystem.com>\0" - "Subject\0[rtc-linux] [PATCH 4/6] rtc: rv8803: Always apply the I\302\262C workaround\0" + "Subject\0[PATCH 4/6] rtc: rv8803: Always apply the I\302\262C workaround\0" "Date\0Thu, 21 Jul 2016 12:41:30 +0200\0" "To\0rtc-linux@googlegroups.com\0" "Cc\0linux-kernel@vger.kernel.org" @@ -9,21 +9,20 @@ " Beno\303\256t Th\303\251baudeau <benoit@wsystem.com>\0" "\00:1\0" "b\0" - "The I=C2=B2C NACK issue of the RV-8803 may occur after any I=C2=B2C START\n" + "The I\302\262C NACK issue of the RV-8803 may occur after any I\302\262C START\n" "condition, depending on the timings. Consequently, the workaround must\n" - "be applied for all the I=C2=B2C transfers.\n" + "be applied for all the I\302\262C transfers.\n" "\n" - "This commit abstracts the I=C2=B2C transfer code into register access\n" - "functions. This avoids duplicating the I=C2=B2C workaround everywhere. This\n" + "This commit abstracts the I\302\262C transfer code into register access\n" + "functions. This avoids duplicating the I\302\262C workaround everywhere. This\n" "also avoids the duplication of the code handling the return value of\n" "i2c_smbus_read_i2c_block_data(). Error messages are issued in case of\n" "definitive register access failures (if the workaround fails). This\n" - "change also makes the I=C2=B2C transfer return value checks consistent.\n" + "change also makes the I\302\262C transfer return value checks consistent.\n" "\n" - "Signed-off-by: Beno=C3=AEt Th=C3=A9baudeau <benoit@wsystem.com>\n" + "Signed-off-by: Beno\303\256t Th\303\251baudeau <benoit@wsystem.com>\n" "---\n" - " drivers/rtc/rtc-rv8803.c | 179 ++++++++++++++++++++++++++++++-------------=\n" - "----\n" + " drivers/rtc/rtc-rv8803.c | 179 ++++++++++++++++++++++++++++++-----------------\n" " 1 file changed, 113 insertions(+), 66 deletions(-)\n" "\n" "diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c\n" @@ -33,7 +32,7 @@ "@@ -20,6 +20,8 @@\n" " #include <linux/module.h>\n" " #include <linux/rtc.h>\n" - "=20\n" + " \n" "+#define RV8803_I2C_TRY_COUNT\t\t4\n" "+\n" " #define RV8803_SEC\t\t\t0x00\n" @@ -42,20 +41,19 @@ "@@ -57,19 +59,85 @@ struct rv8803_data {\n" " \tu8 ctrl;\n" " };\n" - "=20\n" + " \n" "+static int rv8803_read_reg(const struct i2c_client *client, u8 reg)\n" "+{\n" - "+\tint try =3D RV8803_I2C_TRY_COUNT;\n" + "+\tint try = RV8803_I2C_TRY_COUNT;\n" "+\ts32 ret;\n" "+\n" "+\t/*\n" - "+\t * There is a 61=C2=B5s window during which the RTC does not acknowledge =\n" - "I2C\n" + "+\t * There is a 61\302\265s window during which the RTC does not acknowledge I2C\n" "+\t * transfers. In that case, ensure that there are multiple attempts.\n" "+\t */\n" "+\tdo\n" - "+\t\tret =3D i2c_smbus_read_byte_data(client, reg);\n" - "+\twhile ((ret =3D=3D -ENXIO || ret =3D=3D -EIO) && --try);\n" + "+\t\tret = i2c_smbus_read_byte_data(client, reg);\n" + "+\twhile ((ret == -ENXIO || ret == -EIO) && --try);\n" "+\tif (ret < 0)\n" "+\t\tdev_err(&client->dev, \"Unable to read register 0x%02x\\n\", reg);\n" "+\n" @@ -65,13 +63,13 @@ "+static int rv8803_read_regs(const struct i2c_client *client,\n" "+\t\t\t u8 reg, u8 count, u8 *values)\n" "+{\n" - "+\tint try =3D RV8803_I2C_TRY_COUNT;\n" + "+\tint try = RV8803_I2C_TRY_COUNT;\n" "+\ts32 ret;\n" "+\n" "+\tdo\n" - "+\t\tret =3D i2c_smbus_read_i2c_block_data(client, reg, count, values);\n" - "+\twhile ((ret =3D=3D -ENXIO || ret =3D=3D -EIO) && --try);\n" - "+\tif (ret !=3D count) {\n" + "+\t\tret = i2c_smbus_read_i2c_block_data(client, reg, count, values);\n" + "+\twhile ((ret == -ENXIO || ret == -EIO) && --try);\n" + "+\tif (ret != count) {\n" "+\t\tdev_err(&client->dev,\n" "+\t\t\t\"Unable to read registers 0x%02x..0x%02x\\n\",\n" "+\t\t\treg, reg + count - 1);\n" @@ -81,15 +79,14 @@ "+\treturn 0;\n" "+}\n" "+\n" - "+static int rv8803_write_reg(const struct i2c_client *client, u8 reg, u8 va=\n" - "lue)\n" + "+static int rv8803_write_reg(const struct i2c_client *client, u8 reg, u8 value)\n" "+{\n" - "+\tint try =3D RV8803_I2C_TRY_COUNT;\n" + "+\tint try = RV8803_I2C_TRY_COUNT;\n" "+\ts32 ret;\n" "+\n" "+\tdo\n" - "+\t\tret =3D i2c_smbus_write_byte_data(client, reg, value);\n" - "+\twhile ((ret =3D=3D -ENXIO || ret =3D=3D -EIO) && --try);\n" + "+\t\tret = i2c_smbus_write_byte_data(client, reg, value);\n" + "+\twhile ((ret == -ENXIO || ret == -EIO) && --try);\n" "+\tif (ret)\n" "+\t\tdev_err(&client->dev, \"Unable to write register 0x%02x\\n\", reg);\n" "+\n" @@ -99,13 +96,13 @@ "+static int rv8803_write_regs(const struct i2c_client *client,\n" "+\t\t\t u8 reg, u8 count, const u8 *values)\n" "+{\n" - "+\tint try =3D RV8803_I2C_TRY_COUNT;\n" + "+\tint try = RV8803_I2C_TRY_COUNT;\n" "+\ts32 ret;\n" "+\n" "+\tdo\n" - "+\t\tret =3D i2c_smbus_write_i2c_block_data(client, reg, count,\n" + "+\t\tret = i2c_smbus_write_i2c_block_data(client, reg, count,\n" "+\t\t\t\t\t\t values);\n" - "+\twhile ((ret =3D=3D -ENXIO || ret =3D=3D -EIO) && --try);\n" + "+\twhile ((ret == -ENXIO || ret == -EIO) && --try);\n" "+\tif (ret)\n" "+\t\tdev_err(&client->dev,\n" "+\t\t\t\"Unable to write registers 0x%02x..0x%02x\\n\",\n" @@ -116,25 +113,24 @@ "+\n" " static irqreturn_t rv8803_handle_irq(int irq, void *dev_id)\n" " {\n" - " \tstruct i2c_client *client =3D dev_id;\n" - " \tstruct rv8803_data *rv8803 =3D i2c_get_clientdata(client);\n" - " \tunsigned long events =3D 0;\n" - "-\tint flags, try =3D 0;\n" + " \tstruct i2c_client *client = dev_id;\n" + " \tstruct rv8803_data *rv8803 = i2c_get_clientdata(client);\n" + " \tunsigned long events = 0;\n" + "-\tint flags, try = 0;\n" "+\tint flags;\n" - "=20\n" + " \n" " \tmutex_lock(&rv8803->flags_lock);\n" - "=20\n" + " \n" "-\tdo {\n" - "-\t\tflags =3D i2c_smbus_read_byte_data(client, RV8803_FLAG);\n" + "-\t\tflags = i2c_smbus_read_byte_data(client, RV8803_FLAG);\n" "-\t\ttry++;\n" - "-\t} while (((flags =3D=3D -ENXIO) || (flags =3D=3D -EIO)) && (try < 4));\n" - "+\tflags =3D rv8803_read_reg(client, RV8803_FLAG);\n" - " \tif (flags <=3D 0) {\n" + "-\t} while (((flags == -ENXIO) || (flags == -EIO)) && (try < 4));\n" + "+\tflags = rv8803_read_reg(client, RV8803_FLAG);\n" + " \tif (flags <= 0) {\n" " \t\tmutex_unlock(&rv8803->flags_lock);\n" " \t\treturn IRQ_NONE;\n" - "@@ -101,9 +169,8 @@ static irqreturn_t rv8803_handle_irq(int irq, void *dev=\n" - "_id)\n" - "=20\n" + "@@ -101,9 +169,8 @@ static irqreturn_t rv8803_handle_irq(int irq, void *dev_id)\n" + " \n" " \tif (events) {\n" " \t\trtc_update_irq(rv8803->rtc, 1, events);\n" "-\t\ti2c_smbus_write_byte_data(client, RV8803_FLAG, flags);\n" @@ -143,279 +139,252 @@ "+\t\trv8803_write_reg(client, RV8803_FLAG, flags);\n" "+\t\trv8803_write_reg(rv8803->client, RV8803_CTRL, rv8803->ctrl);\n" " \t}\n" - "=20\n" + " \n" " \tmutex_unlock(&rv8803->flags_lock);\n" - "@@ -119,7 +186,7 @@ static int rv8803_get_time(struct device *dev, struct r=\n" - "tc_time *tm)\n" - " \tu8 *date =3D date1;\n" + "@@ -119,7 +186,7 @@ static int rv8803_get_time(struct device *dev, struct rtc_time *tm)\n" + " \tu8 *date = date1;\n" " \tint ret, flags;\n" - "=20\n" - "-\tflags =3D i2c_smbus_read_byte_data(rv8803->client, RV8803_FLAG);\n" - "+\tflags =3D rv8803_read_reg(rv8803->client, RV8803_FLAG);\n" + " \n" + "-\tflags = i2c_smbus_read_byte_data(rv8803->client, RV8803_FLAG);\n" + "+\tflags = rv8803_read_reg(rv8803->client, RV8803_FLAG);\n" " \tif (flags < 0)\n" " \t\treturn flags;\n" - "=20\n" - "@@ -128,16 +195,14 @@ static int rv8803_get_time(struct device *dev, struct=\n" - " rtc_time *tm)\n" + " \n" + "@@ -128,16 +195,14 @@ static int rv8803_get_time(struct device *dev, struct rtc_time *tm)\n" " \t\treturn -EINVAL;\n" " \t}\n" - "=20\n" - "-\tret =3D i2c_smbus_read_i2c_block_data(rv8803->client, RV8803_SEC,\n" + " \n" + "-\tret = i2c_smbus_read_i2c_block_data(rv8803->client, RV8803_SEC,\n" "-\t\t\t\t\t 7, date);\n" - "-\tif (ret !=3D 7)\n" + "-\tif (ret != 7)\n" "-\t\treturn ret < 0 ? ret : -EIO;\n" - "+\tret =3D rv8803_read_regs(rv8803->client, RV8803_SEC, 7, date);\n" + "+\tret = rv8803_read_regs(rv8803->client, RV8803_SEC, 7, date);\n" "+\tif (ret)\n" "+\t\treturn ret;\n" - "=20\n" - " \tif ((date1[RV8803_SEC] & 0x7f) =3D=3D bin2bcd(59)) {\n" - "-\t\tret =3D i2c_smbus_read_i2c_block_data(rv8803->client, RV8803_SEC,\n" + " \n" + " \tif ((date1[RV8803_SEC] & 0x7f) == bin2bcd(59)) {\n" + "-\t\tret = i2c_smbus_read_i2c_block_data(rv8803->client, RV8803_SEC,\n" "-\t\t\t\t\t\t 7, date2);\n" - "-\t\tif (ret !=3D 7)\n" + "-\t\tif (ret != 7)\n" "-\t\t\treturn ret < 0 ? ret : -EIO;\n" - "+\t\tret =3D rv8803_read_regs(rv8803->client, RV8803_SEC, 7, date2);\n" + "+\t\tret = rv8803_read_regs(rv8803->client, RV8803_SEC, 7, date2);\n" "+\t\tif (ret)\n" "+\t\t\treturn ret;\n" - "=20\n" - " \t\tif ((date2[RV8803_SEC] & 0x7f) !=3D bin2bcd(59))\n" - " \t\t\tdate =3D date2;\n" - "@@ -171,21 +236,20 @@ static int rv8803_set_time(struct device *dev, struct=\n" - " rtc_time *tm)\n" - " \tdate[RV8803_MONTH] =3D bin2bcd(tm->tm_mon + 1);\n" - " \tdate[RV8803_YEAR] =3D bin2bcd(tm->tm_year - 100);\n" - "=20\n" - "-\tret =3D i2c_smbus_write_i2c_block_data(rv8803->client, RV8803_SEC,\n" + " \n" + " \t\tif ((date2[RV8803_SEC] & 0x7f) != bin2bcd(59))\n" + " \t\t\tdate = date2;\n" + "@@ -171,21 +236,20 @@ static int rv8803_set_time(struct device *dev, struct rtc_time *tm)\n" + " \tdate[RV8803_MONTH] = bin2bcd(tm->tm_mon + 1);\n" + " \tdate[RV8803_YEAR] = bin2bcd(tm->tm_year - 100);\n" + " \n" + "-\tret = i2c_smbus_write_i2c_block_data(rv8803->client, RV8803_SEC,\n" "-\t\t\t\t\t 7, date);\n" "-\tif (ret < 0)\n" - "+\tret =3D rv8803_write_regs(rv8803->client, RV8803_SEC, 7, date);\n" + "+\tret = rv8803_write_regs(rv8803->client, RV8803_SEC, 7, date);\n" "+\tif (ret)\n" " \t\treturn ret;\n" - "=20\n" + " \n" " \tmutex_lock(&rv8803->flags_lock);\n" - "=20\n" - "-\tflags =3D i2c_smbus_read_byte_data(rv8803->client, RV8803_FLAG);\n" - "+\tflags =3D rv8803_read_reg(rv8803->client, RV8803_FLAG);\n" + " \n" + "-\tflags = i2c_smbus_read_byte_data(rv8803->client, RV8803_FLAG);\n" + "+\tflags = rv8803_read_reg(rv8803->client, RV8803_FLAG);\n" " \tif (flags < 0) {\n" " \t\tmutex_unlock(&rv8803->flags_lock);\n" " \t\treturn flags;\n" " \t}\n" - "=20\n" - "-\tret =3D i2c_smbus_write_byte_data(rv8803->client, RV8803_FLAG,\n" + " \n" + "-\tret = i2c_smbus_write_byte_data(rv8803->client, RV8803_FLAG,\n" "-\t\t\t\t\tflags & ~RV8803_FLAG_V2F);\n" - "+\tret =3D rv8803_write_reg(rv8803->client, RV8803_FLAG,\n" + "+\tret = rv8803_write_reg(rv8803->client, RV8803_FLAG,\n" "+\t\t\t flags & ~RV8803_FLAG_V2F);\n" - "=20\n" + " \n" " \tmutex_unlock(&rv8803->flags_lock);\n" - "=20\n" - "@@ -199,12 +263,11 @@ static int rv8803_get_alarm(struct device *dev, struc=\n" - "t rtc_wkalrm *alrm)\n" + " \n" + "@@ -199,12 +263,11 @@ static int rv8803_get_alarm(struct device *dev, struct rtc_wkalrm *alrm)\n" " \tu8 alarmvals[3];\n" " \tint flags, ret;\n" - "=20\n" - "-\tret =3D i2c_smbus_read_i2c_block_data(client, RV8803_ALARM_MIN,\n" + " \n" + "-\tret = i2c_smbus_read_i2c_block_data(client, RV8803_ALARM_MIN,\n" "-\t\t\t\t\t 3, alarmvals);\n" - "-\tif (ret !=3D 3)\n" + "-\tif (ret != 3)\n" "-\t\treturn ret < 0 ? ret : -EIO;\n" - "+\tret =3D rv8803_read_regs(client, RV8803_ALARM_MIN, 3, alarmvals);\n" + "+\tret = rv8803_read_regs(client, RV8803_ALARM_MIN, 3, alarmvals);\n" "+\tif (ret)\n" "+\t\treturn ret;\n" - "=20\n" - "-\tflags =3D i2c_smbus_read_byte_data(client, RV8803_FLAG);\n" - "+\tflags =3D rv8803_read_reg(client, RV8803_FLAG);\n" + " \n" + "-\tflags = i2c_smbus_read_byte_data(client, RV8803_FLAG);\n" + "+\tflags = rv8803_read_reg(client, RV8803_FLAG);\n" " \tif (flags < 0)\n" " \t\treturn flags;\n" - "=20\n" - "@@ -237,10 +300,10 @@ static int rv8803_set_alarm(struct device *dev, struc=\n" - "t rtc_wkalrm *alrm)\n" - "=20\n" + " \n" + "@@ -237,10 +300,10 @@ static int rv8803_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)\n" + " \n" " \tmutex_lock(&rv8803->flags_lock);\n" - "=20\n" - "-\tret =3D i2c_smbus_read_i2c_block_data(client, RV8803_FLAG, 2, ctrl);\n" - "-\tif (ret !=3D 2) {\n" - "+\tret =3D rv8803_read_regs(client, RV8803_FLAG, 2, ctrl);\n" + " \n" + "-\tret = i2c_smbus_read_i2c_block_data(client, RV8803_FLAG, 2, ctrl);\n" + "-\tif (ret != 2) {\n" + "+\tret = rv8803_read_regs(client, RV8803_FLAG, 2, ctrl);\n" "+\tif (ret) {\n" " \t\tmutex_unlock(&rv8803->flags_lock);\n" "-\t\treturn ret < 0 ? ret : -EIO;\n" "+\t\treturn ret;\n" " \t}\n" - "=20\n" - " \talarmvals[0] =3D bin2bcd(alrm->time.tm_min);\n" - "@@ -249,8 +312,8 @@ static int rv8803_set_alarm(struct device *dev, struct =\n" - "rtc_wkalrm *alrm)\n" - "=20\n" + " \n" + " \talarmvals[0] = bin2bcd(alrm->time.tm_min);\n" + "@@ -249,8 +312,8 @@ static int rv8803_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)\n" + " \n" " \tif (rv8803->ctrl & (RV8803_CTRL_AIE | RV8803_CTRL_UIE)) {\n" - " \t\trv8803->ctrl &=3D ~(RV8803_CTRL_AIE | RV8803_CTRL_UIE);\n" - "-\t\terr =3D i2c_smbus_write_byte_data(rv8803->client, RV8803_CTRL,\n" + " \t\trv8803->ctrl &= ~(RV8803_CTRL_AIE | RV8803_CTRL_UIE);\n" + "-\t\terr = i2c_smbus_write_byte_data(rv8803->client, RV8803_CTRL,\n" "-\t\t\t\t\t\trv8803->ctrl);\n" - "+\t\terr =3D rv8803_write_reg(rv8803->client, RV8803_CTRL,\n" + "+\t\terr = rv8803_write_reg(rv8803->client, RV8803_CTRL,\n" "+\t\t\t\t rv8803->ctrl);\n" " \t\tif (err) {\n" " \t\t\tmutex_unlock(&rv8803->flags_lock);\n" " \t\t\treturn err;\n" - "@@ -258,13 +321,12 @@ static int rv8803_set_alarm(struct device *dev, struc=\n" - "t rtc_wkalrm *alrm)\n" + "@@ -258,13 +321,12 @@ static int rv8803_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)\n" " \t}\n" - "=20\n" - " \tctrl[1] &=3D ~RV8803_FLAG_AF;\n" - "-\terr =3D i2c_smbus_write_byte_data(rv8803->client, RV8803_FLAG, ctrl[1]);\n" - "+\terr =3D rv8803_write_reg(rv8803->client, RV8803_FLAG, ctrl[1]);\n" + " \n" + " \tctrl[1] &= ~RV8803_FLAG_AF;\n" + "-\terr = i2c_smbus_write_byte_data(rv8803->client, RV8803_FLAG, ctrl[1]);\n" + "+\terr = rv8803_write_reg(rv8803->client, RV8803_FLAG, ctrl[1]);\n" " \tmutex_unlock(&rv8803->flags_lock);\n" " \tif (err)\n" " \t\treturn err;\n" - "=20\n" - "-\terr =3D i2c_smbus_write_i2c_block_data(rv8803->client, RV8803_ALARM_MIN,\n" + " \n" + "-\terr = i2c_smbus_write_i2c_block_data(rv8803->client, RV8803_ALARM_MIN,\n" "-\t\t\t\t\t 3, alarmvals);\n" - "+\terr =3D rv8803_write_regs(rv8803->client, RV8803_ALARM_MIN, 3, alarmvals)=\n" - ";\n" + "+\terr = rv8803_write_regs(rv8803->client, RV8803_ALARM_MIN, 3, alarmvals);\n" " \tif (err)\n" " \t\treturn err;\n" - "=20\n" - "@@ -274,8 +336,8 @@ static int rv8803_set_alarm(struct device *dev, struct =\n" - "rtc_wkalrm *alrm)\n" + " \n" + "@@ -274,8 +336,8 @@ static int rv8803_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)\n" " \t\tif (rv8803->rtc->aie_timer.enabled)\n" - " \t\t\trv8803->ctrl |=3D RV8803_CTRL_AIE;\n" - "=20\n" - "-\t\terr =3D i2c_smbus_write_byte_data(rv8803->client, RV8803_CTRL,\n" + " \t\t\trv8803->ctrl |= RV8803_CTRL_AIE;\n" + " \n" + "-\t\terr = i2c_smbus_write_byte_data(rv8803->client, RV8803_CTRL,\n" "-\t\t\t\t\t\trv8803->ctrl);\n" - "+\t\terr =3D rv8803_write_reg(rv8803->client, RV8803_CTRL,\n" + "+\t\terr = rv8803_write_reg(rv8803->client, RV8803_CTRL,\n" "+\t\t\t\t rv8803->ctrl);\n" " \t\tif (err)\n" " \t\t\treturn err;\n" " \t}\n" - "@@ -304,21 +366,20 @@ static int rv8803_alarm_irq_enable(struct device *dev=\n" - ", unsigned int enabled)\n" + "@@ -304,21 +366,20 @@ static int rv8803_alarm_irq_enable(struct device *dev, unsigned int enabled)\n" " \t}\n" - "=20\n" + " \n" " \tmutex_lock(&rv8803->flags_lock);\n" - "-\tflags =3D i2c_smbus_read_byte_data(client, RV8803_FLAG);\n" - "+\tflags =3D rv8803_read_reg(client, RV8803_FLAG);\n" + "-\tflags = i2c_smbus_read_byte_data(client, RV8803_FLAG);\n" + "+\tflags = rv8803_read_reg(client, RV8803_FLAG);\n" " \tif (flags < 0) {\n" " \t\tmutex_unlock(&rv8803->flags_lock);\n" " \t\treturn flags;\n" " \t}\n" - " \tflags &=3D ~(RV8803_FLAG_AF | RV8803_FLAG_UF);\n" - "-\terr =3D i2c_smbus_write_byte_data(client, RV8803_FLAG, flags);\n" - "+\terr =3D rv8803_write_reg(client, RV8803_FLAG, flags);\n" + " \tflags &= ~(RV8803_FLAG_AF | RV8803_FLAG_UF);\n" + "-\terr = i2c_smbus_write_byte_data(client, RV8803_FLAG, flags);\n" + "+\terr = rv8803_write_reg(client, RV8803_FLAG, flags);\n" " \tmutex_unlock(&rv8803->flags_lock);\n" " \tif (err)\n" " \t\treturn err;\n" - "=20\n" - " \tif (ctrl !=3D rv8803->ctrl) {\n" - " \t\trv8803->ctrl =3D ctrl;\n" - "-\t\terr =3D i2c_smbus_write_byte_data(client, RV8803_CTRL,\n" + " \n" + " \tif (ctrl != rv8803->ctrl) {\n" + " \t\trv8803->ctrl = ctrl;\n" + "-\t\terr = i2c_smbus_write_byte_data(client, RV8803_CTRL,\n" "-\t\t\t\t\t\trv8803->ctrl);\n" - "+\t\terr =3D rv8803_write_reg(client, RV8803_CTRL, rv8803->ctrl);\n" + "+\t\terr = rv8803_write_reg(client, RV8803_CTRL, rv8803->ctrl);\n" " \t\tif (err)\n" " \t\t\treturn err;\n" " \t}\n" - "@@ -334,7 +395,7 @@ static int rv8803_ioctl(struct device *dev, unsigned in=\n" - "t cmd, unsigned long arg)\n" - "=20\n" + "@@ -334,7 +395,7 @@ static int rv8803_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)\n" + " \n" " \tswitch (cmd) {\n" " \tcase RTC_VL_READ:\n" - "-\t\tflags =3D i2c_smbus_read_byte_data(client, RV8803_FLAG);\n" - "+\t\tflags =3D rv8803_read_reg(client, RV8803_FLAG);\n" + "-\t\tflags = i2c_smbus_read_byte_data(client, RV8803_FLAG);\n" + "+\t\tflags = rv8803_read_reg(client, RV8803_FLAG);\n" " \t\tif (flags < 0)\n" " \t\t\treturn flags;\n" - "=20\n" - "@@ -353,16 +414,16 @@ static int rv8803_ioctl(struct device *dev, unsigned =\n" - "int cmd, unsigned long arg)\n" - "=20\n" + " \n" + "@@ -353,16 +414,16 @@ static int rv8803_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)\n" + " \n" " \tcase RTC_VL_CLR:\n" " \t\tmutex_lock(&rv8803->flags_lock);\n" - "-\t\tflags =3D i2c_smbus_read_byte_data(client, RV8803_FLAG);\n" - "+\t\tflags =3D rv8803_read_reg(client, RV8803_FLAG);\n" + "-\t\tflags = i2c_smbus_read_byte_data(client, RV8803_FLAG);\n" + "+\t\tflags = rv8803_read_reg(client, RV8803_FLAG);\n" " \t\tif (flags < 0) {\n" " \t\t\tmutex_unlock(&rv8803->flags_lock);\n" " \t\t\treturn flags;\n" " \t\t}\n" - "=20\n" - " \t\tflags &=3D ~(RV8803_FLAG_V1F | RV8803_FLAG_V2F);\n" - "-\t\tret =3D i2c_smbus_write_byte_data(client, RV8803_FLAG, flags);\n" - "+\t\tret =3D rv8803_write_reg(client, RV8803_FLAG, flags);\n" + " \n" + " \t\tflags &= ~(RV8803_FLAG_V1F | RV8803_FLAG_V2F);\n" + "-\t\tret = i2c_smbus_write_byte_data(client, RV8803_FLAG, flags);\n" + "+\t\tret = rv8803_write_reg(client, RV8803_FLAG, flags);\n" " \t\tmutex_unlock(&rv8803->flags_lock);\n" "-\t\tif (ret < 0)\n" "+\t\tif (ret)\n" " \t\t\treturn ret;\n" - "=20\n" + " \n" " \t\treturn 0;\n" - "@@ -380,8 +441,8 @@ static ssize_t rv8803_nvram_write(struct file *filp, st=\n" - "ruct kobject *kobj,\n" - " \tstruct i2c_client *client =3D to_i2c_client(dev);\n" + "@@ -380,8 +441,8 @@ static ssize_t rv8803_nvram_write(struct file *filp, struct kobject *kobj,\n" + " \tstruct i2c_client *client = to_i2c_client(dev);\n" " \tint ret;\n" - "=20\n" - "-\tret =3D i2c_smbus_write_byte_data(client, RV8803_RAM, buf[0]);\n" + " \n" + "-\tret = i2c_smbus_write_byte_data(client, RV8803_RAM, buf[0]);\n" "-\tif (ret < 0)\n" - "+\tret =3D rv8803_write_reg(client, RV8803_RAM, buf[0]);\n" + "+\tret = rv8803_write_reg(client, RV8803_RAM, buf[0]);\n" "+\tif (ret)\n" " \t\treturn ret;\n" - "=20\n" + " \n" " \treturn 1;\n" - "@@ -395,7 +456,7 @@ static ssize_t rv8803_nvram_read(struct file *filp, str=\n" - "uct kobject *kobj,\n" - " \tstruct i2c_client *client =3D to_i2c_client(dev);\n" + "@@ -395,7 +456,7 @@ static ssize_t rv8803_nvram_read(struct file *filp, struct kobject *kobj,\n" + " \tstruct i2c_client *client = to_i2c_client(dev);\n" " \tint ret;\n" - "=20\n" - "-\tret =3D i2c_smbus_read_byte_data(client, RV8803_RAM);\n" - "+\tret =3D rv8803_read_reg(client, RV8803_RAM);\n" + " \n" + "-\tret = i2c_smbus_read_byte_data(client, RV8803_RAM);\n" + "+\tret = rv8803_read_reg(client, RV8803_RAM);\n" " \tif (ret < 0)\n" " \t\treturn ret;\n" - "=20\n" + " \n" "@@ -425,7 +486,7 @@ static int rv8803_probe(struct i2c_client *client,\n" " {\n" - " \tstruct i2c_adapter *adapter =3D to_i2c_adapter(client->dev.parent);\n" + " \tstruct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);\n" " \tstruct rv8803_data *rv8803;\n" - "-\tint err, flags, try =3D 0;\n" + "-\tint err, flags, try = 0;\n" "+\tint err, flags;\n" - "=20\n" + " \n" " \tif (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |\n" " \t\t\t\t I2C_FUNC_SMBUS_I2C_BLOCK)) {\n" "@@ -442,16 +503,7 @@ static int rv8803_probe(struct i2c_client *client,\n" - " \trv8803->client =3D client;\n" + " \trv8803->client = client;\n" " \ti2c_set_clientdata(client, rv8803);\n" - "=20\n" + " \n" "-\t/*\n" - "-\t * There is a 60=C2=B5s window where the RTC may not reply on the i2c bus=\n" - " in\n" + "-\t * There is a 60\302\265s window where the RTC may not reply on the i2c bus in\n" "-\t * that case, the transfer is not ACKed. In that case, ensure there are\n" "-\t * multiple attempts.\n" "-\t */\n" "-\tdo {\n" - "-\t\tflags =3D i2c_smbus_read_byte_data(client, RV8803_FLAG);\n" + "-\t\tflags = i2c_smbus_read_byte_data(client, RV8803_FLAG);\n" "-\t\ttry++;\n" - "-\t} while (((flags =3D=3D -ENXIO) || (flags =3D=3D -EIO)) && (try < 4));\n" + "-\t} while (((flags == -ENXIO) || (flags == -EIO)) && (try < 4));\n" "-\n" - "+\tflags =3D rv8803_read_reg(client, RV8803_FLAG);\n" + "+\tflags = rv8803_read_reg(client, RV8803_FLAG);\n" " \tif (flags < 0)\n" " \t\treturn flags;\n" - "=20\n" + " \n" "@@ -486,12 +538,7 @@ static int rv8803_probe(struct i2c_client *client,\n" " \t\treturn PTR_ERR(rv8803->rtc);\n" " \t}\n" - "=20\n" - "-\ttry =3D 0;\n" + " \n" + "-\ttry = 0;\n" "-\tdo {\n" - "-\t\terr =3D i2c_smbus_write_byte_data(rv8803->client, RV8803_EXT,\n" + "-\t\terr = i2c_smbus_write_byte_data(rv8803->client, RV8803_EXT,\n" "-\t\t\t\t\t\tRV8803_EXT_WADA);\n" "-\t\ttry++;\n" - "-\t} while (((err =3D=3D -ENXIO) || (flags =3D=3D -EIO)) && (try < 4));\n" - "+\terr =3D rv8803_write_reg(rv8803->client, RV8803_EXT, RV8803_EXT_WADA);\n" + "-\t} while (((err == -ENXIO) || (flags == -EIO)) && (try < 4));\n" + "+\terr = rv8803_write_reg(rv8803->client, RV8803_EXT, RV8803_EXT_WADA);\n" " \tif (err)\n" " \t\treturn err;\n" - "=20\n" - "--=20\n" - "2.5.0\n" - "\n" - "--=20\n" - "You received this message because you are subscribed to \"rtc-linux\".\n" - "Membership options at http://groups.google.com/group/rtc-linux .\n" - "Please read http://groups.google.com/group/rtc-linux/web/checklist\n" - "before submitting a driver.\n" - "---=20\n" - "You received this message because you are subscribed to the Google Groups \"=\n" - "rtc-linux\" group.\n" - "To unsubscribe from this group and stop receiving emails from it, send an e=\n" - "mail to rtc-linux+unsubscribe@googlegroups.com.\n" - For more options, visit https://groups.google.com/d/optout. + " \n" + "-- \n" + 2.5.0 -0560396b50a3185a2f5327c98828874c0a6fb325903d283c33ac571216f28cd8 +7332aa2436e9913d99f55d7ffae00f8c96674f3bd44582ba18b8d7b91a166644
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.