Re: [PATCH 2/2] printk: nbcon: check uart port is nbcon or not in nbcon_release

From: John Ogness
Date: Wed Jan 24 2024 - 04:59:08 EST


On 2024-01-23, Junxiao Chang <junxiao.chang@xxxxxxxxx> wrote:
> Try to release nbcon only if current uart port is nbcon, as it does
> in nbcon_acquire.

The release needs to undo what acquire did. Why should it have its own
checks that would cause it to _not_ undo what acquire did?

Keep in mind that an nbcon console could be unregistered while another
CPU is holding the nbcon lock. The port lock (and nbcon lock) are
protecting access to the hardware. They are not related to console
registration/unregistration.

John