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

Glenn Streiff gstreiff at NetEffect.com
Sun Jan 20 18:57:43 PST 2008


> From: ewg-bounces at lists.openfabrics.org
> [mailto:ewg-bounces at lists.openfabrics.org]On Behalf Of Glenn Streiff
> Sent: Sunday, January 20, 2008 5:23 PM
> To: Vladimir Sokolovsky
> Cc: ewg at lists.openfabrics.org
> Subject: [ewg] backport for kernel.h (upper_32_bits macro)
> 
> 
> 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
> 
> 

So for a typical kernel.h backport file, I'm proposing:

diff --git a/kernel_addons/backport/2.6.9_U6/include/linux/kernel.h b/kernel_addons/backport/2.6.9_U6/include/linux/kernel.h
index 110ecdf..7fcf93c 100644
--- a/kernel_addons/backport/2.6.9_U6/include/linux/kernel.h
+++ b/kernel_addons/backport/2.6.9_U6/include/linux/kernel.h
@@ -1,7 +1,13 @@
+#ifndef BACKPORT_KERNEL_H_2_6_22
+
+#include_next <linux/kernel.h>
+
+#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
+
+#endif
 #ifndef BACKPORT_KERNEL_H_2_6_18
 #define BACKPORT_KERNEL_H_2_6_18

-#include_next <linux/kernel.h>
 #include <linux/log2.h>

 #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))


Will that fly with everybody?

Glenn



More information about the ewg mailing list