• Joe Perches's avatar
    TTY: synclink: Convert + to | for bit operations · 9fe8074b
    Joe Perches authored
    Dan Carpenter noticed a missing set of parentheses
    around a multiple field addition.
    
    https://lkml.org/lkml/2013/1/27/166
    
    His original commit message:
    
    There is a kind of precedence problem here, but it doesn't affect how
    the code works because ->serial_signals is unsigned char.  We want to
    clear two flags here.
    
    #define SerialSignal_RTS            0x20     /* Request to Send */
    #define SerialSignal_DTR            0x80     /* Data Terminal Ready */
    
    Without the parenthesis then it does:
    
    	info->serial_signals &= 0x5f;
    
    With the parenthesis it does:
    
    	info->serial_signals &= 0xffffff5f;
    
    info->serial_signals is an unsigned char so the two statements are
    equivalent, but it's cleaner to add the parenthesis.  In other dtr_rts()
    functions the parenthesis are there so this makes it more consistent.
    
    Other changes:
    
    Convert all + uses to | for these bit operations.
    
    Reorder the multiple fields for consistency.
    Update the comments too.
    Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: default avatarJoe Perches <joe@perches.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    9fe8074b
synclink_cs.c 109 KB