Re: [PATCH] Provide better abstraction for the serial drivers toxmit buf and tty

From: Alan Cox
Date: Wed Apr 18 2007 - 15:08:59 EST


> Currently the uart_info structure is allocated on an open, so it's not
> available until that point in time. The trouble is that console_init() is
> called before memory is set up, so you can't allocate the uart_info
> until it's too late for the console or a debugger that wants to work
> early, though it's ok for IPMI.

A debugger can provide a pre-existing uart_info and buffer. The
initialisation is only done if the uart_state->info pointer is NULL.

> The uart_info struct is not very big, maybe it would be best to pull that
> into uart_port? But the circ buffer might still be a problem, since it
> would need to be dynamically allocated and it might need to be
> checked instead.

How about this (untested idea in the finest Linux tradition)

Add

uart_console_prepare(struct uart_port *port, struct uart_info
*info, void *buffer)
{
port->info = info;
info->xmit.buf = buffer;
... etc ...
info->flags |= UPF_BOOTALLOCATED;
}


in uart_shutdown() check UPF_BOOTALLOCATED and don't free xmit.buf if so.

ditto in uart_remove_one_port for info itself


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/