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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 lib/asm-generic/page.h |  8 +++-----
 lib/const.h            | 11 +++++++++++
 2 files changed, 14 insertions(+), 5 deletions(-)
 create mode 100644 lib/const.h

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
-- 
1.9.3

_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm




[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux