x86: trampoline.c cleanup
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
@@ -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
Quoted 5 lines · Jaswinder Singh Rajput
Subject: [PATCH] x86:
trampoline.ccleanupImpact: cleanup
- fix style problems
Err. This patch is a style problem itself.
Quoted 10 lines
Signed-off-by Jaswinder Singh Rajput <[email protected]>--- arch/x86/kernel/trampoline.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)arch/x86/kernel/trampoline.c +0
-0
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
Hello Thomas,
Quoted 15 lines · Thomas Gleixner
Quoted 5 lines · Jaswinder Singh Rajput
Subject: [PATCH] x86:
trampoline.ccleanupImpact: cleanup
- fix style problems
Err. This patch is a style problem itself.
Quoted 5 lines
Signed-off-by Jaswinder Singh Rajput <[email protected]>--- 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@@ -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
Quoted 33 lines · Jaswinder Singh Rajput
Hello Thomas,
Quoted 15 lines · Thomas Gleixner
Quoted 5 lines · Jaswinder Singh Rajput
Subject: [PATCH] x86:
trampoline.ccleanupImpact: cleanup
- fix style problems
Err. This patch is a style problem itself.
Quoted 5 lines
Signed-off-by Jaswinder Singh Rajput <[email protected]>--- 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@@ -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
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.ccleanupImpact: cleanup
- fix style problems
Err. This patch is a style problem itself.
Quoted 5 lines
Signed-off-by Jaswinder Singh Rajput <[email protected]>--- 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@@ -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 #2Sigh. I asked for applying common sense not for creating another stupid rule.
Who made this stupid rule ?
--
JSR
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.ccleanupImpact: cleanup
- fix style problems
Err. This patch is a style problem itself.
Quoted 5 lines
Signed-off-by Jaswinder Singh Rajput <[email protected]>--- 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@@ -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
Quoted 18 lines · Thomas Gleixner
Quoted 6 lines · Jaswinder Singh Rajput
Subject: [PATCH] x86:
trampoline.ccleanupImpact: cleanup
- fix style problems
Err. This patch is a style problem itself.
Quoted 5 lines
Signed-off-by Jaswinder Singh Rajput <[email protected]>--- 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@@ -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