console: add console unregistering
Some console are transient, like the USB connected serial console which should be removed when the USB connection is severed. Enable console removal for such devices. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
2504dcd332
commit
ea8314d19f
|
@ -154,13 +154,9 @@ int console_register(struct console_device *newcdev)
|
|||
|
||||
list_add_tail(&newcdev->list, &console_list);
|
||||
|
||||
if (console_output_buffer) {
|
||||
while (kfifo_getc(console_output_buffer, &ch) == 0)
|
||||
console_putc(CONSOLE_STDOUT, ch);
|
||||
kfifo_free(console_output_buffer);
|
||||
console_output_buffer = NULL;
|
||||
}
|
||||
|
||||
while (kfifo_getc(console_output_buffer, &ch) == 0)
|
||||
console_putc(CONSOLE_STDOUT, ch);
|
||||
if (first)
|
||||
barebox_banner();
|
||||
|
||||
|
@ -168,6 +164,22 @@ int console_register(struct console_device *newcdev)
|
|||
}
|
||||
EXPORT_SYMBOL(console_register);
|
||||
|
||||
int console_unregister(struct console_device *cdev)
|
||||
{
|
||||
struct device_d *dev = &cdev->class_dev;
|
||||
int status;
|
||||
|
||||
list_del(&cdev->list);
|
||||
if (list_empty(&console_list))
|
||||
initialized = CONSOLE_UNINITIALIZED;
|
||||
|
||||
status = unregister_device(dev);
|
||||
if (!status)
|
||||
memset(cdev, 0, sizeof(*cdev));
|
||||
return status;
|
||||
}
|
||||
EXPORT_SYMBOL(console_unregister);
|
||||
|
||||
static int getc_raw(void)
|
||||
{
|
||||
struct console_device *cdev;
|
||||
|
|
|
@ -157,3 +157,7 @@ int console_register(struct console_device *newcdev)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int console_unregister(struct console_device *cdev)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ struct console_device {
|
|||
};
|
||||
|
||||
int console_register(struct console_device *cdev);
|
||||
int console_unregister(struct console_device *cdev);
|
||||
|
||||
extern struct list_head console_list;
|
||||
#define for_each_console(console) list_for_each_entry(console, &console_list, list)
|
||||
|
|
Loading…
Reference in New Issue