unify DMA_..BIT_MASK definitions: v1
cover unify DMA_..BIT_MASK definitions: v1
These patches remove redundant DMA_..BIT_MASK definitions across two drivers. In this version of the patches, the computation of the bitmasks is done by the compiler.
--
include/linux/dma-mapping.h renamed from include/linux/dma-mapping.h.orig +13 -10
@@ -13,16 +13,19 @@ DMA_NONE = 3, }; -#define DMA_64BIT_MASK 0xffffffffffffffffULL -#define DMA_48BIT_MASK 0x0000ffffffffffffULL -#define DMA_40BIT_MASK 0x000000ffffffffffULL -#define DMA_39BIT_MASK 0x0000007fffffffffULL -#define DMA_32BIT_MASK 0x00000000ffffffffULL -#define DMA_31BIT_MASK 0x000000007fffffffULL -#define DMA_30BIT_MASK 0x000000003fffffffULL -#define DMA_29BIT_MASK 0x000000001fffffffULL -#define DMA_28BIT_MASK 0x000000000fffffffULL -#define DMA_24BIT_MASK 0x0000000000ffffffULL +#define DMA_BIT_MASK (n) ((1ULL<<(n))-1) + +#define DMA_64BIT_MASK DMA_BIT_MASK(64) +#define DMA_48BIT_MASK DMA_BIT_MASK(48) +#define DMA_40BIT_MASK DMA_BIT_MASK(40) +#define DMA_39BIT_MASK DMA_BIT_MASK(39) +#define DMA_35BIT_MASK DMA_BIT_MASK(35) +#define DMA_32BIT_MASK DMA_BIT_MASK(32) +#define DMA_31BIT_MASK DMA_BIT_MASK(31) +#define DMA_30BIT_MASK DMA_BIT_MASK(30) +#define DMA_29BIT_MASK DMA_BIT_MASK(29) +#define DMA_28BIT_MASK DMA_BIT_MASK(28) +#define DMA_24BIT_MASK DMA_BIT_MASK(24)static inline int valid_dma_direction (int dma_direction) {
Signature · 2 lines
Regards/Gruß,
Boris.Quoted 19 lines · Borislav Petkov
These patches remove redundant DMA_..BIT_MASK definitions across two drivers. In this version of the patches, the computation of the bitmasks is done by the compiler.
Signed-off-by Borislav Petkov <[email protected]>Cc Jeremy Fitzhardinge <[email protected]>--
Index:23-rc6/include/linux/dma-mapping.h
===================================================================include/linux/dma-mapping.h renamed from include/linux/dma-mapping.h.orig +0
-3@@ -13,16 +13,19 @@ DMA_NONE = 3, }; -#define DMA_64BIT_MASK 0xffffffffffffffffULL -#define DMA_48BIT_MASK 0x0000ffffffffffffULL -#define DMA_40BIT_MASK 0x000000ffffffffffULL
include/linux/dma-mapping.h line 18
Quoted 10 lines
include/linux/dma-mapping.h renamed from include/linux/dma-mapping.h.orig +3
-7-#define DMA_39BIT_MASK 0x0000007fffffffffULL -#define DMA_32BIT_MASK 0x00000000ffffffffULL -#define DMA_31BIT_MASK 0x000000007fffffffULL -#define DMA_30BIT_MASK 0x000000003fffffffULL -#define DMA_29BIT_MASK 0x000000001fffffffULL -#define DMA_28BIT_MASK 0x000000000fffffffULL -#define DMA_24BIT_MASK 0x0000000000ffffffULL +#define DMA_BIT_MASK (n) ((1ULL<<(n))-1) + +#define DMA_64BIT_MASK DMA_BIT_MASK(64)
This one does not do what you mean. You need an explicit mask or a ~0ULL here.
Cheers,
Muli
Quoted 5 lines · Muli Ben-Yehuda
Quoted 2 lines
+#define
DMA_64BIT_MASKDMA_BIT_MASK(64)This one does not do what you mean. You need an explicit mask or a ~0ULL here.
Yeah, I was just about to comment on it. Its possible the compiler might decide to shift by x%64 = 0.
J
Quoted 11 lines · Jeremy Fitzhardinge
Quoted 5 lines · Muli Ben-Yehuda
Quoted 2 lines
+#define
DMA_64BIT_MASKDMA_BIT_MASK(64)This one does not do what you mean. You need an explicit mask or a ~0ULL here.
Yeah, I was just about to comment on it. Its possible the compiler might decide to shift by x%64 = 0.
J
ups, i knew that this might be a corner/boundary case. Thanks, updated patches follow...
Signature · 2 lines
Regards/Gruß,
Boris.Hi Borislav,
Quoted 8 lines · Borislav Petkov
Quoted 7 lines · Jeremy Fitzhardinge
Quoted 5 lines · Muli Ben-Yehuda
Quoted 2 lines
+#define
DMA_64BIT_MASKDMA_BIT_MASK(64)This one does not do what you mean. You need an explicit mask or a ~0ULL here.
Quoted 6 lines
Quoted 4 lines
Yeah, I was just about to comment on it. Its possible the compiler might decide to shift by x%64 = 0.
J
ups, i knew that this might be a corner/boundary case. Thanks, updated patches follow...
Please fold all three patches into a single patch in the updated series, otherwise git bisecters falling in between these patches will see the "redefinition ... previous definition was here" warnings of gcc ...
Satyam
Quoted 16 lines · Satyam Sharma
Hi Borislav,
Quoted 11 lines · Borislav Petkov
Quoted 10 lines · Jeremy Fitzhardinge
Quoted 5 lines · Muli Ben-Yehuda
Quoted 2 lines
+#define
DMA_64BIT_MASKDMA_BIT_MASK(64)This one does not do what you mean. You need an explicit mask or a ~0ULL here.
Yeah, I was just about to comment on it. Its possible the compiler might decide to shift by x%64 = 0.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
J
ups, i knew that this might be a corner/boundary case. Thanks, updated patches follow...
Please fold all three patches into a single patch in the updated series, otherwise git bisecters falling in between these patches will see the "redefinition ... previous definition was here" warnings of gcc ...
Will do later today, thanks.
Signature · 2 lines
Regards/Gruß,
Boris.