Re: [patch] TTY: synclink, small cleanup in dtr_rts()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jan 27, 2013 at 12:04:38PM -0800, Joe Perches wrote:
> On Sun, 2013-01-27 at 22:40 +0300, Dan Carpenter wrote:
> > 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.
> 
> 
> Wouldn't it be clearer still to use | instead of +
> 

Yeah.  I think it would be, but adding bitflags together instead of
doing bitwise ORs is very common as well.

I would Ack the patch you sent though.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux