Re: [PATCH printk v2 08/26] printk: nbcon: Implement processing in port->lock wrapper

From: John Ogness
Date: Thu Mar 14 2024 - 07:38:02 EST


On 2024-03-11, John Ogness <john.ogness@xxxxxxxxxxxxx> wrote:
>>> + if (!uart_is_nbcon(up))
>>> + return;
>>> +
>>> + WARN_ON_ONCE(up->nbcon_locked_port);
>>> +
>>> + do {
>>> + do {
>>> + memset(&ctxt, 0, sizeof(ctxt));
>>> + ctxt.console = con;
>>> + ctxt.prio = NBCON_PRIO_NORMAL;
>>> + } while (!nbcon_context_try_acquire(&ctxt));
>>> +
>>> + } while (!nbcon_context_enter_unsafe(&ctxt));
>>> +
>>> + up->nbcon_locked_port = true;
>>> +}
>>> +EXPORT_SYMBOL_GPL(uart_nbcon_acquire);
>>
>> I would prefer to split the uart and nbcon specific code, for
>> example:
>
> Can you explain why? This code will not be used anywhere else.

No need to respond to this point. The v3 will be quite different here,
but will follow your suggestion. I am splitting the uart-specific code
into serial_core.h and calling a generic nbcon function for the nbcon
locking.

John