s390/mm: use BIT macro to generate SET_MEMORY bit masks
authorHeiko Carstens <hca@linux.ibm.com>
Fri, 14 Apr 2023 12:30:43 +0000 (14:30 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Thu, 20 Apr 2023 09:36:29 +0000 (11:36 +0200)
Use BIT macro to generate SET_MEMORY bit masks, which is easier to
maintain if bits get added, or removed.

Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/include/asm/set_memory.h

index 25f2464dbb7e831534cf0569bf8c04bd10b864e4..ec3f44c602ebfad3cc74ad538bcce8fce726e830 100644 (file)
@@ -6,11 +6,19 @@
 
 extern struct mutex cpa_mutex;
 
-#define SET_MEMORY_RO  1UL
-#define SET_MEMORY_RW  2UL
-#define SET_MEMORY_NX  4UL
-#define SET_MEMORY_X   8UL
-#define SET_MEMORY_4K  16UL
+enum {
+       _SET_MEMORY_RO_BIT,
+       _SET_MEMORY_RW_BIT,
+       _SET_MEMORY_NX_BIT,
+       _SET_MEMORY_X_BIT,
+       _SET_MEMORY_4K_BIT,
+};
+
+#define SET_MEMORY_RO  BIT(_SET_MEMORY_RO_BIT)
+#define SET_MEMORY_RW  BIT(_SET_MEMORY_RW_BIT)
+#define SET_MEMORY_NX  BIT(_SET_MEMORY_NX_BIT)
+#define SET_MEMORY_X   BIT(_SET_MEMORY_X_BIT)
+#define SET_MEMORY_4K  BIT(_SET_MEMORY_4K_BIT)
 
 int __set_memory(unsigned long addr, int numpages, unsigned long flags);