diff mbox

[3/6] lib: steal const.h from kernel

Message ID 1414684625-9445-4-git-send-email-drjones@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Jones Oct. 30, 2014, 3:57 p.m. UTC
And apply it to /lib files. This prepares for the import of
kernel headers that make use of the const.h macros.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 lib/asm-generic/page.h |  8 +++-----
 lib/const.h            | 11 +++++++++++
 2 files changed, 14 insertions(+), 5 deletions(-)
 create mode 100644 lib/const.h
diff mbox

Patch

diff --git a/lib/asm-generic/page.h b/lib/asm-generic/page.h
index 8602752002f71..66c72a62bb0f7 100644
--- a/lib/asm-generic/page.h
+++ b/lib/asm-generic/page.h
@@ -9,12 +9,10 @@ 
  * This work is licensed under the terms of the GNU LGPL, version 2.
  */
 
+#include "const.h"
+
 #define PAGE_SHIFT		12
-#ifndef __ASSEMBLY__
-#define PAGE_SIZE		(1UL << PAGE_SHIFT)
-#else
-#define PAGE_SIZE		(1 << PAGE_SHIFT)
-#endif
+#define PAGE_SIZE		(_AC(1,UL) << PAGE_SHIFT)
 #define PAGE_MASK		(~(PAGE_SIZE-1))
 
 #ifndef __ASSEMBLY__
diff --git a/lib/const.h b/lib/const.h
new file mode 100644
index 0000000000000..5cd94d7067541
--- /dev/null
+++ b/lib/const.h
@@ -0,0 +1,11 @@ 
+#ifndef _CONST_H_
+#define _CONST_H_
+#ifdef __ASSEMBLY__
+#define _AC(X,Y)	X
+#define _AT(T,X)	X
+#else
+#define __AC(X,Y)	(X##Y)
+#define _AC(X,Y)	__AC(X,Y)
+#define _AT(T,X)	((T)(X))
+#endif
+#endif