Skip to contentSkip to conversation

x86: trampoline.c cleanup

PATCH In review Jaswinder Singh Rajput 4 participants 7 messages Mar 14, 2009 – Mar 15, 2009 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: trampoline.c cleanup

Subject: [PATCH] x86: trampoline.c cleanup

Impact: cleanup

- fix style problems

---
 arch/x86/kernel/trampoline.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/kernel/trampoline.c +2 -1
index 808031a..e3b1f2e 100644
@@ -15,7 +15,7 @@ void __init reserve_trampoline_memory(void)
 	 * trampoline before removing it. (see the GDT stuff)
 	 */
 	reserve_early(PAGE_SIZE, PAGE_SIZE + PAGE_SIZE, "EX TRAMPOLINE");
-#endif
+#endif /* CONFIG_X86_32 */
 	/* Has to be in very low memory so we can execute real-mode AP code. */
 	reserve_early(TRAMPOLINE_BASE, TRAMPOLINE_BASE + TRAMPOLINE_SIZE,
 			"TRAMPOLINE");
@@ -29,5 +29,6 @@ void __init reserve_trampoline_memory(void)
 unsigned long setup_trampoline(void)
 {
 	memcpy(trampoline_base, trampoline_data, TRAMPOLINE_SIZE);
+
 	return virt_to_phys(trampoline_base);
 }
Signature · 1 line
1.6.0.6
#1 lore raw
Quoted 5 lines · Jaswinder Singh Rajput

Subject: [PATCH] x86: trampoline.c cleanup

Impact: cleanup

- fix style problems

Err. This patch is a style problem itself.

Quoted 10 lines
---
 arch/x86/kernel/trampoline.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/kernel/trampoline.c +0 -0
index 808031a..e3b1f2e 100644

arch/x86/kernel/trampoline.c void __init reserve_trampoline_memory(void) · line 18

Quoted 5 lines
arch/x86/kernel/trampoline.c +1 -1
@@ -15,7 +15,7 @@ void __init reserve_trampoline_memory(void)
 	 * trampoline before removing it. (see the GDT stuff)
 	 */
 	reserve_early(PAGE_SIZE, PAGE_SIZE + PAGE_SIZE, "EX TRAMPOLINE");
-#endif
+#endif /* CONFIG_X86_32 */

There is no need for this useless comment. The #ifdef is 5 lines above. Such comments are only helpful in large nested sections.

arch/x86/kernel/trampoline.c void __init reserve_trampoline_memory(void) · line 33

Quoted 9 lines
arch/x86/kernel/trampoline.c +1 -0
 	/* Has to be in very low memory so we can execute real-mode AP code. */
 	reserve_early(TRAMPOLINE_BASE, TRAMPOLINE_BASE + TRAMPOLINE_SIZE,
 			"TRAMPOLINE");
@@ -29,5 +29,6 @@ void __init reserve_trampoline_memory(void)
 unsigned long setup_trampoline(void)
 {
 	memcpy(trampoline_base, trampoline_data, TRAMPOLINE_SIZE);
+
 	return virt_to_phys(trampoline_base);

What's the purpose of this ?

Can we please apply some common sense and not just run down a checklist and modify files for no value.

Thanks,

tglx

#2 lore raw

Hello Thomas,

Quoted 15 lines · Thomas Gleixner
Quoted 5 lines · Jaswinder Singh Rajput

Subject: [PATCH] x86: trampoline.c cleanup

Impact: cleanup

- fix style problems

Err. This patch is a style problem itself.

Quoted 5 lines
---
 arch/x86/kernel/trampoline.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Quoted 14 lines

arch/x86/kernel/trampoline.c void __init reserve_trampoline_memory(void) · line 18

Quoted 10 lines
arch/x86/kernel/trampoline.c +1 -1
index 808031a..e3b1f2e 100644
@@ -15,7 +15,7 @@ void __init reserve_trampoline_memory(void)
 	 * trampoline before removing it. (see the GDT stuff)
 	 */
 	reserve_early(PAGE_SIZE, PAGE_SIZE + PAGE_SIZE, "EX TRAMPOLINE");
-#endif
+#endif /* CONFIG_X86_32 */

There is no need for this useless comment. The #ifdef is 5 lines above. Such comments are only helpful in large nested sections.

Ahh, So

	if (ifdef < 5)
		Rule #1
	else
		Rule #2

Thanks,
--
JSR

#3 lore raw
Quoted 33 lines · Jaswinder Singh Rajput

Hello Thomas,

Quoted 15 lines · Thomas Gleixner
Quoted 5 lines · Jaswinder Singh Rajput

Subject: [PATCH] x86: trampoline.c cleanup

Impact: cleanup

- fix style problems

Err. This patch is a style problem itself.

Quoted 5 lines
---
 arch/x86/kernel/trampoline.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Quoted 14 lines

arch/x86/kernel/trampoline.c void __init reserve_trampoline_memory(void) · line 18

Quoted 10 lines
arch/x86/kernel/trampoline.c +1 -1
index 808031a..e3b1f2e 100644
@@ -15,7 +15,7 @@ void __init reserve_trampoline_memory(void)
 	 * trampoline before removing it. (see the GDT stuff)
 	 */
 	reserve_early(PAGE_SIZE, PAGE_SIZE + PAGE_SIZE, "EX TRAMPOLINE");
-#endif
+#endif /* CONFIG_X86_32 */

There is no need for this useless comment. The #ifdef is 5 lines above. Such comments are only helpful in large nested sections.

Quoted 6 lines

Ahh, So

	if (ifdef < 5)
		Rule #1
	else
		Rule #2

Sigh. I asked for applying common sense not for creating another stupid rule.

Thanks,

tglx

#4 lore raw
Quoted 36 lines · Thomas Gleixner
Quoted 35 lines · Jaswinder Singh Rajput

Hello Thomas,

Quoted 15 lines · Thomas Gleixner
Quoted 5 lines · Jaswinder Singh Rajput

Subject: [PATCH] x86: trampoline.c cleanup

Impact: cleanup

- fix style problems

Err. This patch is a style problem itself.

Quoted 5 lines
---
 arch/x86/kernel/trampoline.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Quoted 14 lines

arch/x86/kernel/trampoline.c void __init reserve_trampoline_memory(void) · line 18

Quoted 10 lines
arch/x86/kernel/trampoline.c +1 -1
index 808031a..e3b1f2e 100644
@@ -15,7 +15,7 @@ void __init reserve_trampoline_memory(void)
 	 * trampoline before removing it. (see the GDT stuff)
 	 */
 	reserve_early(PAGE_SIZE, PAGE_SIZE + PAGE_SIZE, "EX TRAMPOLINE");
-#endif
+#endif /* CONFIG_X86_32 */

There is no need for this useless comment. The #ifdef is 5 lines above. Such comments are only helpful in large nested sections.

Ahh, So

Quoted 7 lines
Quoted 4 lines
	if (ifdef < 5)
		Rule #1
	else
		Rule #2

Sigh. I asked for applying common sense not for creating another stupid rule.

Who made this stupid rule ?

--
JSR

#5 lore raw
Quoted 42 lines · Jaswinder Singh Rajput
Quoted 41 lines · Thomas Gleixner
Quoted 39 lines · Jaswinder Singh Rajput

Hello Thomas,

Quoted 15 lines · Thomas Gleixner
Quoted 5 lines · Jaswinder Singh Rajput

Subject: [PATCH] x86: trampoline.c cleanup

Impact: cleanup

- fix style problems

Err. This patch is a style problem itself.

Quoted 5 lines
---
 arch/x86/kernel/trampoline.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Quoted 14 lines

arch/x86/kernel/trampoline.c void __init reserve_trampoline_memory(void) · line 18

Quoted 10 lines
arch/x86/kernel/trampoline.c +1 -1
index 808031a..e3b1f2e 100644
@@ -15,7 +15,7 @@ void __init reserve_trampoline_memory(void)
 	 * trampoline before removing it. (see the GDT stuff)
 	 */
 	reserve_early(PAGE_SIZE, PAGE_SIZE + PAGE_SIZE, "EX TRAMPOLINE");
-#endif
+#endif /* CONFIG_X86_32 */

There is no need for this useless comment. The #ifdef is 5 lines above. Such comments are only helpful in large nested sections.

Ahh, So

	if (ifdef < 5)
		Rule #1
	else
		Rule #2
Quoted 4 lines
Quoted 2 lines

Sigh. I asked for applying common sense not for creating another stupid rule.

Who made this stupid rule ?

What Thomas is saying is that instead of you trying to create some sort of rigid rule, you should apply common sense instead.

Ingo

#6 lore raw
In reply to Thomas Gleixner
Quoted 18 lines · Thomas Gleixner
Quoted 6 lines · Jaswinder Singh Rajput

Subject: [PATCH] x86: trampoline.c cleanup

Impact: cleanup

- fix style problems

Err. This patch is a style problem itself.

Quoted 5 lines
---
 arch/x86/kernel/trampoline.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Quoted 15 lines

arch/x86/kernel/trampoline.c void __init reserve_trampoline_memory(void) · line 19

Quoted 11 lines
arch/x86/kernel/trampoline.c +1 -1
index 808031a..e3b1f2e 100644
@@ -15,7 +15,7 @@ void __init reserve_trampoline_memory(void)
 	 * trampoline before removing it. (see the GDT stuff)
 	 */
 	reserve_early(PAGE_SIZE, PAGE_SIZE + PAGE_SIZE, "EX TRAMPOLINE");
-#endif
+#endif /* CONFIG_X86_32 */
 

There is no need for this useless comment. The #ifdef is 5 lines above. Such comments are only helpful in large nested sections.

Not wanting to prolong this sort of boring thread, but I think there's definitely wiggle room here. I tend to put closing comments on #endifs even if they're quite close to their #if(def) because the syntax is so awful, with no inherent indication of nesting. And once you have to deal with a merge collision, or even just gradual drifting apart of the #if/endif, the closing comment becomes very helpful.

Sure, the closing comment adds some noise too, but the fix is to reduce the number of #ifdefs.

But in this case, I agree with tglx - the closing comment is pointless, because its unlikely that we're going to get #ifdef nesting or any more code between the #ifdef/endif pair.

J