Re: [PATCH] 8250: Fix oops from setserial

From: Andrew Morton
Date: Sat May 30 2009 - 04:43:59 EST

On Sat, 30 May 2009 09:25:57 +0100 Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> wrote:

> >
> > > 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.
> See the rest of the driver - it was written that way years ago and this
> is just following the existing design.

Sure, huge numbers of drivers use the cast.

But I've never seen past sinnings as being a reason to continue sinning.
Doing new code the right way doesn't result in worse code, and reduces
the chances of someone copying and pasting the wrong way.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at