lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241210-da9052-wdt-v1-1-d026e0158688@gmail.com>
Date: Tue, 10 Dec 2024 14:13:48 +0100
From: Marcus Folkesson <marcus.folkesson@...il.com>
To: Support Opensource <support.opensource@...semi.com>, 
 Lee Jones <lee@...nel.org>, Wim Van Sebroeck <wim@...ux-watchdog.org>, 
 Guenter Roeck <linux@...ck-us.net>
Cc: linux-kernel@...r.kernel.org, linux-watchdog@...r.kernel.org, 
 Marcus Folkesson <marcus.folkesson@...il.com>
Subject: [PATCH 1/2] mfd: da9052: store result from fault_log

Other sub-components (da9052-wdt) could use the result to determine
reboot cause.
Expose the result by make it part of the da9052 structure.

Signed-off-by: Marcus Folkesson <marcus.folkesson@...il.com>
---
 drivers/mfd/da9052-core.c         | 26 +++++++++++++-------------
 include/linux/mfd/da9052/da9052.h |  2 ++
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index dc85801b9fa0850fe4dbc351014b7f2981460f02..17baf02b68d60198ff7ec69bf49102423b822d0b 100644
--- a/drivers/mfd/da9052-core.c
+++ b/drivers/mfd/da9052-core.c
@@ -545,35 +545,35 @@ EXPORT_SYMBOL_GPL(da9052_regmap_config);
 static int da9052_clear_fault_log(struct da9052 *da9052)
 {
 	int ret = 0;
-	int fault_log = 0;
+	int *fault_log = &da9052->fault_log;
 
-	fault_log = da9052_reg_read(da9052, DA9052_FAULTLOG_REG);
-	if (fault_log < 0) {
+	*fault_log = da9052_reg_read(da9052, DA9052_FAULTLOG_REG);
+	if (*fault_log < 0) {
 		dev_err(da9052->dev,
-			"Cannot read FAULT_LOG %d\n", fault_log);
-		return fault_log;
+			"Cannot read FAULT_LOG %d\n", *fault_log);
+		return *fault_log;
 	}
 
-	if (fault_log) {
-		if (fault_log & DA9052_FAULTLOG_TWDERROR)
+	if (*fault_log) {
+		if (*fault_log & DA9052_FAULTLOG_TWDERROR)
 			dev_dbg(da9052->dev,
 				"Fault log entry detected: TWD_ERROR\n");
-		if (fault_log & DA9052_FAULTLOG_VDDFAULT)
+		if (*fault_log & DA9052_FAULTLOG_VDDFAULT)
 			dev_dbg(da9052->dev,
 				"Fault log entry detected: VDD_FAULT\n");
-		if (fault_log & DA9052_FAULTLOG_VDDSTART)
+		if (*fault_log & DA9052_FAULTLOG_VDDSTART)
 			dev_dbg(da9052->dev,
 				"Fault log entry detected: VDD_START\n");
-		if (fault_log & DA9052_FAULTLOG_TEMPOVER)
+		if (*fault_log & DA9052_FAULTLOG_TEMPOVER)
 			dev_dbg(da9052->dev,
 				"Fault log entry detected: TEMP_OVER\n");
-		if (fault_log & DA9052_FAULTLOG_KEYSHUT)
+		if (*fault_log & DA9052_FAULTLOG_KEYSHUT)
 			dev_dbg(da9052->dev,
 				"Fault log entry detected: KEY_SHUT\n");
-		if (fault_log & DA9052_FAULTLOG_NSDSET)
+		if (*fault_log & DA9052_FAULTLOG_NSDSET)
 			dev_dbg(da9052->dev,
 				"Fault log entry detected: nSD_SHUT\n");
-		if (fault_log & DA9052_FAULTLOG_WAITSET)
+		if (*fault_log & DA9052_FAULTLOG_WAITSET)
 			dev_dbg(da9052->dev,
 				"Fault log entry detected: WAIT_SHUT\n");
 
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 76feb3a7066dd4ea2f7768794b8920f67726b211..9cb2fc2938cecf6ddb76da401ae3a098525c380e 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -93,6 +93,8 @@ struct da9052 {
 
 	int chip_irq;
 
+	int fault_log;
+
 	/* SOC I/O transfer related fixes for DA9052/53 */
 	int (*fix_io) (struct da9052 *da9052, unsigned char reg);
 };

-- 
2.47.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ