public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Joe Perches <joe@perches.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.cz>, Paul Fulghum <paulkf@microgate.com>,
	David Howells <dhowells@redhat.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] TTY: synclink, small cleanup in dtr_rts()
Date: Sun, 27 Jan 2013 20:19:47 +0000	[thread overview]
Message-ID: <20130127201947.GO16282@mwanda> (raw)
In-Reply-To: <1359317078.14406.12.camel@joe-AO722>

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


  parent reply	other threads:[~2013-01-27 20:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-27 19:40 [patch] TTY: synclink, small cleanup in dtr_rts() Dan Carpenter
2013-01-27 20:04 ` Joe Perches
2013-01-27 20:16   ` Jiri Slaby
2013-01-27 20:19   ` Dan Carpenter [this message]
2013-01-27 21:00     ` Joe Perches
     [not found]       ` <C8AFB2C4-4974-4265-A41C-A56C71784F39@microgate.com>
2013-01-28  2:21         ` [PATCH] TTY: synclink: Convert + to | for bit operations Joe Perches
2013-01-28 12:06       ` [patch] TTY: synclink, small cleanup in dtr_rts() walter harms
2013-01-29 15:55     ` Valdis.Kletnieks
2013-01-29 16:13       ` coccinelle and bitmask arithmetic (was: Re: [patch] TTY: synclink, small cleanup in dtr_rts()) Joe Perches
2013-01-29 16:19         ` Julia Lawall
2013-01-29 16:31           ` Joe Perches
     [not found]           ` <20130129173004.GP16282@mwanda>
2013-01-29 17:42             ` Dan Carpenter
2013-01-29 17:49         ` Julia Lawall
2013-01-29 18:03           ` Joe Perches
2013-01-30  8:21             ` coccinelle and bitmask arithmetic walter harms
2013-01-30  8:29               ` Joe Perches
2013-01-30 11:14               ` Russell King - ARM Linux
2013-01-30 11:21                 ` Julia Lawall
2013-01-30 11:35                   ` Russell King - ARM Linux
2013-01-30 16:53                     ` Joe Perches
2013-01-30 18:23                       ` Russell King - ARM Linux
2013-01-29 18:38         ` coccinelle and bitmask arithmetic (was: Re: [patch] TTY: synclink, small cleanup in dtr_rts()) Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130127201947.GO16282@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=dhowells@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=jslaby@suse.cz \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulkf@microgate.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox