Coccinelle Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: joe@perches.com (Joe Perches)
To: cocci@systeme.lip6.fr
Subject: [Cocci] coccinelle and bitmask arithmetic
Date: Wed, 30 Jan 2013 08:53:29 -0800	[thread overview]
Message-ID: <1359564809.32305.23.camel@joe-AO722> (raw)
In-Reply-To: <20130130113533.GI23505@n2100.arm.linux.org.uk>

On Wed, 2013-01-30 at 11:35 +0000, Russell King - ARM Linux wrote:
> On Wed, Jan 30, 2013 at 12:21:21PM +0100, Julia Lawall wrote:
> > On Wed, 30 Jan 2013, Russell King - ARM Linux wrote:
> > > So, _either_ logical OR or addition works.
> > >
> > > If we _did_ end up with a PHYS_OFFSET with bits less than bit 26 set
> > > here, we'd have bigger problems - because the base of RAM in PCI space
> > > will not correspond with PHYS_OFFSET and all the DMA mapping stuff breaks.
> > 
> > The "problem" is that the computation is done inconsistently within the
> > same file.  Sometimes with + and sometimes with |.
> 
> And I say that is not a problem; if it _does_ become a problem, there are
> bigger problems that would also need solving, which given a multi-subarch
> kernel become a lot lot harder.
> 
> Sure, we can just change them to all be a bitwise OR (sorry, not logical)
> but that's really only half the story.

As far as I can tell, there'd be a lot of +'s to
change in arch/arm and only 2 uses of | in it8152.c

$ git grep -P "\(?\s*SZ_\d+[A-Z]\s*-\s*1\s*\)?\s*\|" arch/arm
arch/arm/common/it8152.c:                       *dev->dma_mask = (SZ_64M - 1) | PHYS_OFFSET;
arch/arm/common/it8152.c:               dev->coherent_dma_mask = (SZ_64M - 1) | PHYS_OFFSET;

$ git grep -P "\+\s*\(?\s*SZ_\d+[A-Z]\b\s*-\s*1\s*\)?" arch/arm | wc -l
460

I think consistently using + would make it simpler
for some possible future conversion.

  reply	other threads:[~2013-01-30 16:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20130127194039.GA18787@elgon.mountain>
     [not found] ` <1359317078.14406.12.camel@joe-AO722>
     [not found]   ` <20130127201947.GO16282@mwanda>
     [not found]     ` <9561.1359474916@turing-police.cc.vt.edu>
2013-01-29 16:13       ` [Cocci] 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
2013-01-29 17:30           ` Dan Carpenter
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             ` [Cocci] 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 [this message]
2013-01-30 18:23                       ` Russell King - ARM Linux
2013-01-29 18:38         ` [Cocci] 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=1359564809.32305.23.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=cocci@systeme.lip6.fr \
    /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