[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20071005140050.655b7727.akpm@linux-foundation.org>
Date: Fri, 5 Oct 2007 14:00:50 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Jeremy Fitzhardinge <jeremy@...p.org>
Cc: bbpetkov@...oo.de, linux-kernel@...r.kernel.org, muli@...ibm.com,
satyam@...radead.org, amitkale@...xen.com,
achim_leubner@...ptec.com
Subject: Re: [PATCH 1/1] unify DMA_..BIT_MASK definitions: v3.1
On Fri, 05 Oct 2007 13:43:54 -0700
Jeremy Fitzhardinge <jeremy@...p.org> wrote:
> Andrew Morton wrote:
> > From: Andrew Morton <akpm@...ux-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)
_
it's irksome that there doesn't seem to be a neater way of doing
this, until they give us unsigned long long longs.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists