[PATCH 3/9] mfd: da9063: use da906x_reg_update()

Sascha Hauer s.hauer at pengutronix.de
Thu Apr 12 00:22:25 PDT 2018


From: Enrico Scholz <enrico.scholz at sigma-chemnitz.de>

Use the previously added da906x_reg_update() function.

NOTE: patch depends on another patchset ("da9063: reset watchdog
timer"),

Signed-off-by: Enrico Scholz <enrico.scholz at sigma-chemnitz.de>
Tested-by: Stefan Christ <s.christ at phytec.de>
Signed-off-by: Christian Hemp <c.hemp at phytec.de>
---
 drivers/mfd/da9063.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/da9063.c b/drivers/mfd/da9063.c
index 68b0723b61..4f09bd384e 100644
--- a/drivers/mfd/da9063.c
+++ b/drivers/mfd/da9063.c
@@ -111,7 +111,6 @@ static int da9063_watchdog_set_timeout(struct watchdog *wd, unsigned timeout)
 	struct device_d *dev = priv->dev;
 	unsigned int scale = 0;
 	int ret;
-	u8 val;
 
 	if (timeout > 131)
 		return -EINVAL;
@@ -132,14 +131,8 @@ static int da9063_watchdog_set_timeout(struct watchdog *wd, unsigned timeout)
 		scale++; /* scale 0 disables the WD */
 	}
 
-	ret = i2c_read_reg(priv->client, DA9063_REG_CONTROL_D, &val, 1);
-	if (ret < 0)
-		return ret;
-
-	val &= ~DA9063_TWDSCALE_MASK;
-	val |= scale;
-
-	ret = i2c_write_reg(priv->client, DA9063_REG_CONTROL_D, &val, 1);
+	ret = da906x_reg_update(priv, DA9063_REG_CONTROL_D,
+				DA9063_TWDSCALE_MASK, scale);
 	if (ret < 0)
 		return ret;
 
-- 
2.16.1




More information about the barebox mailing list