Re: [PATCH printk v5 11/30] nbcon: Provide functions for drivers to acquire console for non-printing

From: John Ogness
Date: Mon May 06 2024 - 06:29:35 EST


On 2024-05-02, John Ogness <john.ogness@xxxxxxxxxxxxx> wrote:
> diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c
> index dd7c3180b335..b8a7e3e136d3 100644
> --- a/kernel/printk/nbcon.c
> +++ b/kernel/printk/nbcon.c
> @@ -989,3 +991,54 @@ void nbcon_free(struct console *con)
>
> con->pbufs = NULL;
> }
> +
> +/**
> + * nbcon_driver_try_acquire - Try to acquire nbcon console and enter unsafe
> + * section
> + * @con: The nbcon console to acquire
> + *
> + * Context: Under the locking mechanism implemented in
> + * @con->device_lock() including disabling migration.

* Return: True if the console was acquired. False otherwise.

John