Skip to contentSkip to conversation

um: Don't use console_drivers directly

PATCH Superseded Andy Shevchenko 1 participant 2 messages Feb 12, 2020 User-mode Linux (UML)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 um: Don't use console_drivers directly

console_drivers is kind of (semi-)private variable to the console code. Direct use of it make us stuck with it being exported here and there. Reduce use of console_drivers by replacing it with for_each_console().

---
 arch/um/kernel/kmsg_dump.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
arch/um/kernel/kmsg_dump.c +5 -5
index 98bdf69e4c2e..a8683b717f94 100644
@@ -9,20 +9,20 @@ static void kmsg_dumper_stdout(struct kmsg_dumper *dumper,
 				enum kmsg_dump_reason reason)
 {
 	static char line[1024];
-
+	struct console *con;
 	size_t len = 0;
-	bool con_available = false;
 
 	/* only dump kmsg when no console is available */
 	if (!console_trylock())
 		return;
 
-	if (console_drivers != NULL)
-		con_available = true;
+	/* Any registered console is fine to us */
+	for_each_console(con)
+		break;
 
 	console_unlock();
 
-	if (con_available == true)
+	if (con == NULL)
 		return;
 
 	printf("kmsg_dump:\n");
Signature · 7 lines
2.25.0


_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
#1 lore raw
Quoted 3 lines · Andy Shevchenko

console_drivers is kind of (semi-)private variable to the console code. Direct use of it make us stuck with it being exported here and there. Reduce use of console_drivers by replacing it with for_each_console().

Oops, this one is wrong, v2 has been sent.

Signature · 9 lines
With Best Regards,
Andy Shevchenko



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