Skip to contentSkip to conversation

common: memtest: Allow memtest to be interrupted

PATCH New Marcel Hellwig 1 participant 1 message Feb 17, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common: memtest: Allow memtest to be interrupted

This change will allow the user to interrupt a running memtest, as well as poller to run in the background. This makes it possible to let a led blink while doing a memtest to indicate process.

---
 common/memtest.c | 6 ++++++
 1 file changed, 6 insertions(+)
common/memtest.c +6 -0
index d47e4a672..0834f344e 100644
@@ -390,6 +390,8 @@ int mem_test_moving_inversions(resource_size_t _start, resource_size_t _end)
 		if (ret)
 			return ret;
 		start[offset] = offset + 1;
+		if (ctrlc())
+			return -EINTR;
 	}
 
 	/* Check each location and invert it for the second pass */
@@ -409,6 +411,8 @@ int mem_test_moving_inversions(resource_size_t _start, resource_size_t _end)
 
 		anti_pattern = ~(offset + 1);
 		start[offset] = anti_pattern;
+		if (ctrlc())
+			return -EINTR;
 	}
 
 	/* Check each location for the inverted pattern and zero it */
@@ -429,6 +433,8 @@ int mem_test_moving_inversions(resource_size_t _start, resource_size_t _end)
 		}
 
 		start[offset] = 0;
+		if (ctrlc())
+			return -EINTR;
 	}
 	show_progress(3 * num_words);
 
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox