public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] unify DMA_..BIT_MASK definitions
@ 2007-09-17 17:51 Borislav Petkov
  2007-09-17 18:14 ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 4+ messages in thread
From: Borislav Petkov @ 2007-09-17 17:51 UTC (permalink / raw)
  To: linux-kernel

This patches remove redundant DMA_..BIT_MASK definitions across two drivers.
First off, consolidate dma bitmask definitions in the proper header file...

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>

--
Index: 23-rc6/include/linux/dma-mapping.h
===================================================================
--- 23-rc6/include/linux/dma-mapping.h.orig	2007-09-17 17:48:20.000000000 +0200
+++ 23-rc6/include/linux/dma-mapping.h	2007-09-17 19:34:21.000000000 +0200
@@ -17,6 +17,7 @@
 #define DMA_48BIT_MASK	0x0000ffffffffffffULL
 #define DMA_40BIT_MASK	0x000000ffffffffffULL
 #define DMA_39BIT_MASK	0x0000007fffffffffULL
+#define DMA_35BIT_MASK	0x00000007ffffffffULL
 #define DMA_32BIT_MASK	0x00000000ffffffffULL
 #define DMA_31BIT_MASK	0x000000007fffffffULL
 #define DMA_30BIT_MASK	0x000000003fffffffULL
-- 
Regards/Gruß,
    Boris.

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

* Re: [PATCH 0/2] unify DMA_..BIT_MASK definitions
  2007-09-17 17:51 [PATCH 0/2] unify DMA_..BIT_MASK definitions Borislav Petkov
@ 2007-09-17 18:14 ` Jeremy Fitzhardinge
  2007-09-17 18:33   ` Borislav Petkov
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Fitzhardinge @ 2007-09-17 18:14 UTC (permalink / raw)
  To: bbpetkov; +Cc: linux-kernel

Borislav Petkov wrote:
> This patches remove redundant DMA_..BIT_MASK definitions across two drivers.
> First off, consolidate dma bitmask definitions in the proper header file...
>
> Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
>
> --
> Index: 23-rc6/include/linux/dma-mapping.h
> ===================================================================
> --- 23-rc6/include/linux/dma-mapping.h.orig	2007-09-17 17:48:20.000000000 +0200
> +++ 23-rc6/include/linux/dma-mapping.h	2007-09-17 19:34:21.000000000 +0200
> @@ -17,6 +17,7 @@
>  #define DMA_48BIT_MASK	0x0000ffffffffffffULL
>  #define DMA_40BIT_MASK	0x000000ffffffffffULL
>  #define DMA_39BIT_MASK	0x0000007fffffffffULL
> +#define DMA_35BIT_MASK	0x00000007ffffffffULL
>  #define DMA_32BIT_MASK	0x00000000ffffffffULL
>  #define DMA_31BIT_MASK	0x000000007fffffffULL
>  #define DMA_30BIT_MASK	0x000000003fffffffULL
>   

Hm.  Wouldn't it be better to define something like

#define DMA_BIT_MASK(x)    ((1ull<<(x))-1)

and then define everything in terms of that (or just use it directly and
deprecate the DMA_XXBIT_MASK macros)?

    J

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

* Re: [PATCH 0/2] unify DMA_..BIT_MASK definitions
  2007-09-17 18:14 ` Jeremy Fitzhardinge
@ 2007-09-17 18:33   ` Borislav Petkov
  2007-09-17 18:48     ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 4+ messages in thread
From: Borislav Petkov @ 2007-09-17 18:33 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: linux-kernel

On Mon, Sep 17, 2007 at 11:14:48AM -0700, Jeremy Fitzhardinge wrote:
> Borislav Petkov wrote:
> > This patches remove redundant DMA_..BIT_MASK definitions across two drivers.
> > First off, consolidate dma bitmask definitions in the proper header file...
> >
> > Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
> >
> > --
> > Index: 23-rc6/include/linux/dma-mapping.h
> > ===================================================================
> > --- 23-rc6/include/linux/dma-mapping.h.orig	2007-09-17 17:48:20.000000000 +0200
> > +++ 23-rc6/include/linux/dma-mapping.h	2007-09-17 19:34:21.000000000 +0200
> > @@ -17,6 +17,7 @@
> >  #define DMA_48BIT_MASK	0x0000ffffffffffffULL
> >  #define DMA_40BIT_MASK	0x000000ffffffffffULL
> >  #define DMA_39BIT_MASK	0x0000007fffffffffULL
> > +#define DMA_35BIT_MASK	0x00000007ffffffffULL
> >  #define DMA_32BIT_MASK	0x00000000ffffffffULL
> >  #define DMA_31BIT_MASK	0x000000007fffffffULL
> >  #define DMA_30BIT_MASK	0x000000003fffffffULL
> >   
> 
> Hm.  Wouldn't it be better to define something like
> 
> #define DMA_BIT_MASK(x)    ((1ull<<(x))-1)
> 
> and then define everything in terms of that (or just use it directly and
> deprecate the DMA_XXBIT_MASK macros)?
> 
>     J
That is more compact, I agree. However, the XXBIT_MASK macros have the
better readability, imho. And also, doing 

$grep -Prin 'DMA_..BIT_MASK' * | wc -l

returns 383 on the 23-rc6 tree so removing them should be quite the logistical
challenge for the kernel janitors :). What do the others think?

-- 
Regards/Gruß,
    Boris.

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

* Re: [PATCH 0/2] unify DMA_..BIT_MASK definitions
  2007-09-17 18:33   ` Borislav Petkov
@ 2007-09-17 18:48     ` Jeremy Fitzhardinge
  0 siblings, 0 replies; 4+ messages in thread
From: Jeremy Fitzhardinge @ 2007-09-17 18:48 UTC (permalink / raw)
  To: bbpetkov; +Cc: linux-kernel

Borislav Petkov wrote:
> That is more compact, I agree. However, the XXBIT_MASK macros have the
> better readability, imho. And also, doing 
>
> $grep -Prin 'DMA_..BIT_MASK' * | wc -l
>
> returns 383 on the 23-rc6 tree so removing them should be quite the logistical
> challenge for the kernel janitors :). What do the others think?
>   

Well, even defining the existing macros in terms of DMA_BIT_MASK would
be an improvement.  It's certainly not obvious at first glance that
0x00000007ffffffffULL is a correct 35-bit mask - it's something that the
compiler is perfectly happy to compute for us.

    J

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-17 17:51 [PATCH 0/2] unify DMA_..BIT_MASK definitions Borislav Petkov
2007-09-17 18:14 ` Jeremy Fitzhardinge
2007-09-17 18:33   ` Borislav Petkov
2007-09-17 18:48     ` Jeremy Fitzhardinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox