• P
    serial: use serial_port_in/out vs serial_in/out in 8250 · 4fd996a1
    Paul Gortmaker 提交于
    The serial_in and serial_out helpers are expecting to operate
    on an 8250_port struct.  These in turn go after the contained
    normal port struct which actually has the actual in/out accessors.
    
    But what is happening in some cases, is that a function is passed
    in a port struct, and it runs container_of to get the 8250_port
    struct, and then it uses serial_in/out helpers on that.  But when
    you do, it goes full circle, since it jumps back inside the 8250_port
    to find the contained port struct (which we already knew!).
    
    So, if we are operating in a scope where we know the struct port,
    then use the serial_port_in/out helpers and avoid the bouncing
    around.  If we don't have the struct port handy, and it isn't
    worth making a local for it, then just leave things as-is which
    uses the serial_in/out helpers that will resolve the 8250_port
    onto the struct port.
    
    Mostly, gcc figures this out on its own -- so this doesn't bring to
    the table any revolutionary runtime delta.  However, it is somewhat
    misleading to always hammer away on 8250 structs, when the actual
    underlying property isn't at all 8250 specific -- and this change
    makes that clear.
    Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
    Acked-by: NAlan Cox <alan@linux.intel.com>
    Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    4fd996a1
8250.c 82.9 KB