Re: [PATCH] 8250: Fix oops from setserial

Andrew Morton
2009-05-30T03:54:44Z

On Thu, 28 May 2009 14:01:35 +0100 Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:

> From: Alan Cox <alan@linux.intel.com>
>
> [Impact: ok I just put this here to wind up Linus]
>
> If you setserial a port which has never been initialised we change the type
> but don't update the I/O method pointers. The same problem is true if you
> change the io type of a port - but nobody ever does that so nobody noticed!
>
> Remember the old type and when attaching if the type has changed reload the
> port accessor pointers. We can't do it blindly as some 8250 drivers load custom
> accessors and we must not stomp those.
>
> Closes-bug: #13367

Please quote the full bug URL.

a) for consistency

b) because there are multiple bug tracking systems out there:

y:/usr/src/git26> git-log|grep bugzilla.redhat|wc -l
123

> static void set_io_from_upio(struct uart_port *p)
> {
> + struct uart_8250_port *up = (struct uart_8250_port *)p;

container_of() is nicer, IMO. It's clearer, and doesn't require that
the uart_port be the fist member.