Re: [PATCH v2 4/4] serial: imx: serialize imx_uart_ports[] lifetime
From: Karl Mehltretter
Date: Fri Jul 31 2026 - 10:48:51 EST
On Thu, Jul 30, 2026 at 02:02:05PM +0100, Frank Li wrote:
> imx_uart_remove()
> {
> imx_uart_ports[line] = NULL;
> uart_remove_one_port(&imx_uart_uart_driver, &sport->port);
> }
>
> Is above sequence to avoid use mutex?
>
I now tried this, but it doesn't work as-is:
uart_add_one_port() may call imx_uart_console_setup(), so the entry
must be present before the call.
uart_remove_one_port() unregisters the console. Clearing the entry first
causes its callbacks to dereference NULL.
The mutex protects those sequences against sibling probes.
Thanks,
Karl