/* Return the console tty driver structure and its associated index  */
struct tty_driver* console_device(int *index)
/* Return the console tty driver structure and its associated index  */
struct tty_driver* console_device(int *index)
{
	struct console *c;
	struct tty_driver *driver = NULL;
	acquire_console_sem();
	for_each_console(c) {
		if (!c->device)
			continue;
		driver = c->device(c, index);
		if (driver)
			break;
	}
	release_console_sem();
	return driver;
}