Skip to contentSkip to conversation

x86: Removed superfluous parentheses in macro defs

PATCH In review Alex Ben 3 participants 3 messages Oct 6, 2011 – Oct 7, 2011 x86

lore
Share & tools
lore

Alex Ben

author
#0 lore raw

PATCH 1/1 x86: Removed superfluous parentheses in macro defs

1) make it consistent with other constant macro deinitions, which don't have parentheses, as they are really superfluous.

2) the extra parentheses on the 5th line of #define GDT_ENTRY is superfluous, as there is no bit shifting on that line.

---
 arch/x86/include/asm/segment.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/segment.h +0 -0
index 5e64171..92621c1 100644
@@ -10,7 +10,7 @@
	 (((flags) & _AC(0x0000f0ff,ULL)) << 40) |	\
	 (((limit) & _AC(0x000f0000,ULL)) << (48-16)) |	\
	 (((base)  & _AC(0x00ffffff,ULL)) << 16) |	\

- (((limit) & _AC(0x0000ffff,ULL))))
+ ((limit) & _AC(0x0000ffff,ULL)))

/* Simple and small GDT entries for booting only */

@@ -75,7 +75,7 @@

#define GDT_ENTRY_DEFAULT_USER_DS 15

-#define GDT_ENTRY_KERNEL_BASE (12)
+#define GDT_ENTRY_KERNEL_BASE 12

#define GDT_ENTRY_KERNEL_CS (GDT_ENTRY_KERNEL_BASE+0)

--
1.7.4.1

maintainer
#1 lore raw
Quoted 23 lines · Alex Ben

1) make it consistent with other constant macro deinitions, which don't have parentheses, as they are really superfluous.

2) the extra parentheses on the 5th line of #define GDT_ENTRY is superfluous, as there is no bit shifting on that line.

---
 arch/x86/include/asm/segment.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/segment.h +1 -1
index 5e64171..92621c1 100644
@@ -10,7 +10,7 @@
 	 (((flags) & _AC(0x0000f0ff,ULL)) << 40) |	\
 	 (((limit) & _AC(0x000f0000,ULL)) << (48-16)) |	\
 	 (((base)  & _AC(0x00ffffff,ULL)) << 16) |	\
-	 (((limit) & _AC(0x0000ffff,ULL))))
+	 ((limit)  & _AC(0x0000ffff,ULL)))
 
 /* Simple and small GDT entries for booting only */
 

arch/x86/include/asm/segment.h line 78

Quoted 5 lines
arch/x86/include/asm/segment.h +1 -1
@@ -75,7 +75,7 @@
 
 #define GDT_ENTRY_DEFAULT_USER_DS	15
 
-#define GDT_ENTRY_KERNEL_BASE		(12)
+#define GDT_ENTRY_KERNEL_BASE		12

Please do a git annotate on the file you're patching and look at the commit id which is listed for the GDT_ENTRY_KERNEL_BASE line to find out why is the 12 parenthesized. Hint: 3234282f33b29

:-)

Signature · 2 lines
Regards/Gruss,
    Boris.
#2 lore raw
In reply to Alex Ben
Quoted 2 lines · Alex Ben

1) make it consistent with other constant macro deinitions, which don't have parentheses, as they are really superfluous.

Superfluous, yes, but it makes the expression read more regular.

arch/x86/include/asm/segment.h line 14

Quoted 11 lines
arch/x86/include/asm/segment.h +1 -1
index 5e64171..92621c1 100644
@@ -10,7 +10,7 @@
 	 (((flags) & _AC(0x0000f0ff,ULL)) << 40) |	\
 	 (((limit) & _AC(0x000f0000,ULL)) << (48-16)) |	\
 	 (((base)  & _AC(0x00ffffff,ULL)) << 16) |	\
-	 (((limit) & _AC(0x0000ffff,ULL))))
+	 ((limit)  & _AC(0x0000ffff,ULL)))
 

So NAK.

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.