mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] unify DMA_..BIT_MASK definitions: v2
@ 2007-09-18  6:16 Borislav Petkov
  2007-09-18  6:38 ` Satyam Sharma
  0 siblings, 1 reply; 2+ messages in thread
From: Borislav Petkov @ 2007-09-18  6:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jeremy Fitzhardinge, Muli Ben-Yehuda

These patches remove redundant DMA_..BIT_MASK definitions across
two drivers. In this version of the patches, the computation
of the majority of the bitmasks is done by the compiler.

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Muli Ben-Yehuda <muli@il.ibm.com>

---
 23-rc6/include/linux/dma-mapping.h |   23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

Index: b/23-rc6/include/linux/dma-mapping.h
===================================================================
--- a/23-rc6/include/linux/dma-mapping.h	2007-09-17 17:48:20.000000000 +0200
+++ b/23-rc6/include/linux/dma-mapping.h	2007-09-18 08:11:19.000000000 +0200
@@ -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	~0ULL
+#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)
 {

-- 
Regards/Gruß,
    Boris.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 0/2] unify DMA_..BIT_MASK definitions: v2
  2007-09-18  6:16 [PATCH 0/2] unify DMA_..BIT_MASK definitions: v2 Borislav Petkov
@ 2007-09-18  6:38 ` Satyam Sharma
  0 siblings, 0 replies; 2+ messages in thread
From: Satyam Sharma @ 2007-09-18  6:38 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: linux-kernel, Jeremy Fitzhardinge, Muli Ben-Yehuda



On Tue, 18 Sep 2007, Borislav Petkov wrote:

> These patches remove redundant DMA_..BIT_MASK definitions across
> two drivers. In this version of the patches, the computation
> of the majority of the bitmasks is done by the compiler.
> 
> Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
> Cc: Jeremy Fitzhardinge <jeremy@goop.org>
> Cc: Muli Ben-Yehuda <muli@il.ibm.com>

Just a friendly note to whoever (Jeremy?) picks up these patches --
kindly fold all three into a single git commit. No point introducing
new compile warnings to the kernel build process for no good reason
(and some archs do set -Werror in their top level Makefiles, even).


> ---
>  23-rc6/include/linux/dma-mapping.h |   23 +++++++++++++----------
>  1 file changed, 13 insertions(+), 10 deletions(-)
> 
> Index: b/23-rc6/include/linux/dma-mapping.h
> ===================================================================
> --- a/23-rc6/include/linux/dma-mapping.h	2007-09-17 17:48:20.000000000 +0200
> +++ b/23-rc6/include/linux/dma-mapping.h	2007-09-18 08:11:19.000000000 +0200
      ^^^^^^^^^

And whoever picks these up is gonna have trouble applying them too.

Borislav, care to have another shot at this ?

Thanks,
Satyam


> @@ -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	~0ULL
> +#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)
>  {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-09-18  6:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-18  6:16 [PATCH 0/2] unify DMA_..BIT_MASK definitions: v2 Borislav Petkov
2007-09-18  6:38 ` Satyam Sharma

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®