Skip to contentSkip to conversation

kgdboc: Use for_each_console() helper

PATCH In review Andy Shevchenko 2 participants 2 messages Jan 24, 2020 – Jan 31, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kgdboc: Use for_each_console() helper

Replace open coded single-linked list iteration loop with for_each_console() helper in use.

---
 drivers/tty/serial/kgdboc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/tty/serial/kgdboc.c +1 -3
index c7d51b51898f..c9f94fa82be4 100644
@@ -169,15 +169,13 @@ static int configure_kgdboc(void)
 	if (!p)
 		goto noconfig;
 
-	cons = console_drivers;
-	while (cons) {
+	for_each_console(cons) {
 		int idx;
 		if (cons->device && cons->device(cons, &idx) == p &&
 		    idx == tty_line) {
 			kgdboc_io_ops.is_console = 1;
 			break;
 		}
-		cons = cons->next;
 	}
 
 	kgdb_tty_driver = p;
Signature · 1 line
2.24.1
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Andy Shevchenko

Replace open coded single-linked list iteration loop with for_each_console() helper in use.

Quoted 28 lines
---
 drivers/tty/serial/kgdboc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/tty/serial/kgdboc.c +1 -3
index c7d51b51898f..c9f94fa82be4 100644
@@ -169,15 +169,13 @@ static int configure_kgdboc(void)
 	if (!p)
 		goto noconfig;
 
-	cons = console_drivers;
-	while (cons) {
+	for_each_console(cons) {
 		int idx;
 		if (cons->device && cons->device(cons, &idx) == p &&
 		    idx == tty_line) {
 			kgdboc_io_ops.is_console = 1;
 			break;
 		}
-		cons = cons->next;
 	}
 
 	kgdb_tty_driver = p;
Signature · 1 line
2.24.1