ssize_t count = 0;
/*
- * Hold the console_lock to guarantee that no consoles are
+ * Hold the console_list_lock to guarantee that no consoles are
* unregistered until all console processing is complete.
* This also allows safe traversal of the console list and
* race-free reading of @flags.
- *
- * Take console_lock to serialize device() callback with
- * other console operations. For example, fg_console is
- * modified under console_lock when switching vt.
*/
- console_lock();
+ console_list_lock();
+
for_each_console(c) {
if (!c->device)
continue;
if (i >= ARRAY_SIZE(cs))
break;
}
+
+ /*
+ * Take console_lock to serialize device() callback with
+ * other console operations. For example, fg_console is
+ * modified under console_lock when switching vt.
+ */
+ console_lock();
while (i--) {
int index = cs[i]->index;
struct tty_driver *drv = cs[i]->device(cs[i], &index);
}
console_unlock();
+ console_list_unlock();
+
return count;
}
static DEVICE_ATTR(active, S_IRUGO, show_cons_active, NULL);