[ewg] backport for kernel.h (upper_32_bits macro)

Glenn Streiff gstreiff at NetEffect.com
Sun Jan 20 15:22:40 PST 2008


Hi, Vlad.

I would like to add a backport for a kernel.h macro that 
showed up with 2.6.22:

	commit 218e180e7ea5334e1f94121940ba82cd1f0f4e58
	Author: Andrew Morton <akpm at linux-foundation.org>
	Date:   Thu May 10 03:15:18 2007 -0700

	add upper_32_bits macro

Roland has committed a fix in his neteffect branch that relies 
on this macro to avoid compile warnings for 32-bit targets and 
I would like to leverage that for pre-2.6.22 kernels in the 
OFED 1.3 builds.

The macro itself is:

#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))

I could use some guidance since this is my first time through 
the maze and kernel.h has wider scope beyond the iw_nes driver 
so I don't want to break anybody. (-;

Is see 20 instances of kernel.h under the ofed addons:

  % find kernel_addons/backport -name kernel.h
  kernel_addons/backport/2.6.11/include/linux/kernel.h
  kernel_addons/backport/2.6.11_FC4/include/linux/kernel.h
  ...
  kernel_addons/backport/2.6.9_U6/include/linux/kernel.h

with various 

  #ifndef BACKPORT_KERNEL_H_2_6_NN
  #endif

exclusion macros.

So it looks like I could just pre-prend the following into 
each of the files:

  #ifndef BACKPORT_KERNEL_H_2_6_22
  #define BACKPORT_KERNEL_H_2_6_22

  #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))

  #endif

Am I on the right track?  

Also do I need to add a couple new instances of kernel.h as 
well?

  kernel_addons/backport/2.6.[20,21]/kernel.h

Thanks,

Glenn

p.s.,  I'm picking up some of Glenn Grundstrom's responsibilities 
       since he found a gig closer to home.



More information about the ewg mailing list