From: Borislav Petkov <bbpetkov@yahoo.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
linux-kernel@vger.kernel.org, muli@il.ibm.com,
satyam@infradead.org, amitkale@netxen.com,
achim_leubner@adaptec.com
Subject: Re: [PATCH 1/1] unify DMA_..BIT_MASK definitions: v3.1
Date: Sat, 6 Oct 2007 10:37:35 +0200 [thread overview]
Message-ID: <20071006083734.GB8930@gollum.tnic> (raw)
In-Reply-To: <20071005140050.655b7727.akpm@linux-foundation.org>
On Fri, Oct 05, 2007 at 02:00:50PM -0700, Andrew Morton wrote:
> On Fri, 05 Oct 2007 13:43:54 -0700
> Jeremy Fitzhardinge <jeremy@goop.org> wrote:
>
> > Andrew Morton wrote:
> > > From: Andrew Morton <akpm@linux-foundation.org>
> > >
> > > Now that we have DMA_BIT_MASK(), these macros are pointless.
> > >
> >
> > Except, unfortunately, DMA_64BIT_MASK. I guess we could special case
> > it, assuming this works in all the contexts the macro is used in (ie,
> > compile-time constant?):
> >
> > #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
> >
>
> doh. Thanks.
>
> --- a/include/linux/dma-mapping.h~stop-using-dma_xxbit_mask-fix
> +++ a/include/linux/dma-mapping.h
> @@ -13,7 +13,7 @@ enum dma_data_direction {
> DMA_NONE = 3,
> };
>
> -#define DMA_BIT_MASK(n) ((1ULL<<(n))-1)
> +#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
>
> /*
> * NOTE: do not use the below macros in new code and do not add new definitions
> @@ -21,7 +21,7 @@ enum dma_data_direction {
> *
> * Instead, just open-code DMA_BIT_MASK(n) within your driver
> */
> -#define DMA_64BIT_MASK (~0ULL)
> +#define DMA_64BIT_MASK DMA_BIT_MASK(64)
> #define DMA_48BIT_MASK DMA_BIT_MASK(48)
> #define DMA_47BIT_MASK DMA_BIT_MASK(47)
> #define DMA_40BIT_MASK DMA_BIT_MASK(40)
>
Hi and sorry for the late reply. IMHO, this solution is the most concise and still
clear enough a macro to understand what it does after a quick scan (unlike
uglies like IO_COND() in lib/iomap.c¹, :)) And, as a next step, we probably
should do
perl -pi -e 's/DMA_(..)BIT_MASK/DMA_BIT_MASK($1)/g' *
after removing the #define DMA_..BIT_MASK defines in /include/linux/dma-mapping.h
and the other two headers in the original patch after the x86 merge.
Current git (9f34073b4e54ad58541e0e2b4a87f4f6c1460e21) contains about 394
instances of usage of those macros, including the #definitions.
¹ this is not a flame!
--
Regards/Gruß,
Boris.
prev parent reply other threads:[~2007-10-06 8:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-18 19:46 Borislav Petkov
2007-09-19 15:03 ` Satyam Sharma
2007-10-05 19:47 ` Andrew Morton
2007-10-05 20:43 ` Jeremy Fitzhardinge
2007-10-05 21:00 ` Andrew Morton
2007-10-05 21:03 ` Robert P. J. Day
2007-10-05 21:23 ` Jeremy Fitzhardinge
2007-10-06 7:54 ` Borislav Petkov
2007-10-05 21:24 ` Andreas Schwab
2007-10-05 21:28 ` Jeremy Fitzhardinge
2007-10-05 22:24 ` Andrew Morton
2007-10-05 22:32 ` Jeremy Fitzhardinge
2007-10-06 8:37 ` Borislav Petkov [this message]
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=20071006083734.GB8930@gollum.tnic \
--to=bbpetkov@yahoo.de \
--cc=achim_leubner@adaptec.com \
--cc=akpm@linux-foundation.org \
--cc=amitkale@netxen.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=muli@il.ibm.com \
--cc=satyam@infradead.org \
/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
all inboxes | Powered by JetHome®