watchdog: da9063: use atomic safe i2c transfer in reset handler
Subsystems (2)
PATCH 1/1 watchdog: da9063: use atomic safe i2c transfer in reset handler
From: Yunus Bas <[email protected]>
This patch is based on commit 057b52b4b3d5 ("watchdog: da9062: make restart handler atomic safe"), which uses the atomic transfer capability of the i2c framework.
Signed-off-by Yunus Bas <[email protected]>
Signed-off-by Andrej Picej <[email protected]>
--- drivers/watchdog/da9063_wdt.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/watchdog/da9063_wdt.c +9 -3
@@ -14,6 +14,7 @@#include <linux/platform_device.h> #include <linux/uaccess.h> #include <linux/slab.h> +#include <linux/i2c.h> #include <linux/delay.h> #include <linux/mfd/da9063/registers.h> #include <linux/mfd/da9063/core.h>
@@ -169,14 +170,19 @@ static int da9063_wdt_restart(struct watchdog_device *wdd, unsigned long action, void *data) {struct da9063 *da9063 =watchdog_get_drvdata (wdd); +struct i2c_client *client =to_i2c_client (da9063->dev);int ret; - ret =regmap_write (da9063->regmap,DA9063_REG_CONTROL_F , -DA9063_SHUTDOWN ); -if (ret) +/* Don't use regmap because it is not atomic safe */ + ret =i2c_smbus_write_byte_data (client,DA9063_REG_CONTROL_F , +DA9063_SHUTDOWN ); +if (ret <0 )dev_alert (da9063->dev,"Failed to shutdown (err = %d)\n" , ret); +/* wait for reset to assert... */ +mdelay (500 ); +return ret; }
Signature · 1 line
2.25.1
Quoted 9 lines · Andrej Picej
From: Yunus Bas <[email protected]>
This patch is based on commit
057b52b4b3d5("watchdog: da9062: make restart handler atomic safe"), which uses the atomic transfer capability of the i2c framework.Signed-off-by Yunus Bas <[email protected]>Signed-off-by Andrej Picej <[email protected]>---
Reviewed-by Adam Thomson <[email protected]>
Quoted 8 lines · Andrej Picej
From: Yunus Bas <[email protected]>
This patch is based on commit
057b52b4b3d5("watchdog: da9062: make restart handler atomic safe"), which uses the atomic transfer capability of the i2c framework.Signed-off-by Yunus Bas <[email protected]>Signed-off-by Andrej Picej <[email protected]>
Reviewed-by Guenter Roeck <[email protected]>
Quoted 42 lines
--- drivers/watchdog/da9063_wdt.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)drivers/watchdog/da9063_wdt.c +9
-3@@ -14,6 +14,7 @@#include <linux/platform_device.h> #include <linux/uaccess.h> #include <linux/slab.h> +#include <linux/i2c.h> #include <linux/delay.h> #include <linux/mfd/da9063/registers.h> #include <linux/mfd/da9063/core.h> @@ -169,14 +170,19 @@ static int da9063_wdt_restart(struct watchdog_device *wdd, unsigned long action, void *data) {struct da9063 *da9063 =watchdog_get_drvdata (wdd); +struct i2c_client *client =to_i2c_client (da9063->dev);int ret; - ret =regmap_write (da9063->regmap,DA9063_REG_CONTROL_F , -DA9063_SHUTDOWN ); -if (ret) +/* Don't use regmap because it is not atomic safe */ + ret =i2c_smbus_write_byte_data (client,DA9063_REG_CONTROL_F , +DA9063_SHUTDOWN ); +if (ret <0 )dev_alert (da9063->dev,"Failed to shutdown (err = %d)\n" , ret); +/* wait for reset to assert... */ +mdelay (500 ); +return ret; }Signature · 1 line
2.25.1