public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -tip] x86: trampoline.c cleanup
@ 2009-03-14 15:44 Jaswinder Singh Rajput
  2009-03-14 16:20 ` Thomas Gleixner
  0 siblings, 1 reply; 7+ messages in thread
From: Jaswinder Singh Rajput @ 2009-03-14 15:44 UTC (permalink / raw)
  To: Ingo Molnar, x86 maintainers, LKML

Subject: [PATCH] x86: trampoline.c cleanup

Impact: cleanup

 - fix style problems

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
 arch/x86/kernel/trampoline.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/trampoline.c b/arch/x86/kernel/trampoline.c
index 808031a..e3b1f2e 100644
--- a/arch/x86/kernel/trampoline.c
+++ b/arch/x86/kernel/trampoline.c
@@ -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);
 }
-- 
1.6.0.6




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH -tip] x86: trampoline.c cleanup
  2009-03-14 15:44 [PATCH -tip] x86: trampoline.c cleanup Jaswinder Singh Rajput
@ 2009-03-14 16:20 ` Thomas Gleixner
  2009-03-14 16:35   ` Jaswinder Singh Rajput
  2009-03-15 16:32   ` Jeremy Fitzhardinge
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas Gleixner @ 2009-03-14 16:20 UTC (permalink / raw)
  To: Jaswinder Singh Rajput; +Cc: Ingo Molnar, x86 maintainers, LKML

On Sat, 14 Mar 2009, Jaswinder Singh Rajput wrote:

> Subject: [PATCH] x86: trampoline.c cleanup
> 
> Impact: cleanup
> 
>  - fix style problems

Err. This patch is a style problem itself.
 
> Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> ---
>  arch/x86/kernel/trampoline.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kernel/trampoline.c b/arch/x86/kernel/trampoline.c
> index 808031a..e3b1f2e 100644
> --- a/arch/x86/kernel/trampoline.c
> +++ b/arch/x86/kernel/trampoline.c
> @@ -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.

>  	/* 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH -tip] x86: trampoline.c cleanup
  2009-03-14 16:20 ` Thomas Gleixner
@ 2009-03-14 16:35   ` Jaswinder Singh Rajput
  2009-03-14 16:58     ` Thomas Gleixner
  2009-03-15 16:32   ` Jeremy Fitzhardinge
  1 sibling, 1 reply; 7+ messages in thread
From: Jaswinder Singh Rajput @ 2009-03-14 16:35 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Ingo Molnar, x86 maintainers, LKML

Hello Thomas,

On Sat, 2009-03-14 at 17:20 +0100, Thomas Gleixner wrote:
> On Sat, 14 Mar 2009, Jaswinder Singh Rajput wrote:
> 
> > Subject: [PATCH] x86: trampoline.c cleanup
> > 
> > Impact: cleanup
> > 
> >  - fix style problems
> 
> Err. This patch is a style problem itself.
>  
> > Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> > ---
> >  arch/x86/kernel/trampoline.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> > 
> > diff --git a/arch/x86/kernel/trampoline.c b/arch/x86/kernel/trampoline.c
> > index 808031a..e3b1f2e 100644
> > --- a/arch/x86/kernel/trampoline.c
> > +++ b/arch/x86/kernel/trampoline.c
> > @@ -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



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH -tip] x86: trampoline.c cleanup
  2009-03-14 16:35   ` Jaswinder Singh Rajput
@ 2009-03-14 16:58     ` Thomas Gleixner
  2009-03-14 18:11       ` Jaswinder Singh Rajput
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2009-03-14 16:58 UTC (permalink / raw)
  To: Jaswinder Singh Rajput; +Cc: Ingo Molnar, x86 maintainers, LKML

On Sat, 14 Mar 2009, Jaswinder Singh Rajput wrote:
> Hello Thomas,
> 
> On Sat, 2009-03-14 at 17:20 +0100, Thomas Gleixner wrote:
> > On Sat, 14 Mar 2009, Jaswinder Singh Rajput wrote:
> > 
> > > Subject: [PATCH] x86: trampoline.c cleanup
> > > 
> > > Impact: cleanup
> > > 
> > >  - fix style problems
> > 
> > Err. This patch is a style problem itself.
> >  
> > > Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> > > ---
> > >  arch/x86/kernel/trampoline.c |    3 ++-
> > >  1 files changed, 2 insertions(+), 1 deletions(-)
> > > 
> > > diff --git a/arch/x86/kernel/trampoline.c b/arch/x86/kernel/trampoline.c
> > > index 808031a..e3b1f2e 100644
> > > --- a/arch/x86/kernel/trampoline.c
> > > +++ b/arch/x86/kernel/trampoline.c
> > > @@ -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

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

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH -tip] x86: trampoline.c cleanup
  2009-03-14 16:58     ` Thomas Gleixner
@ 2009-03-14 18:11       ` Jaswinder Singh Rajput
  2009-03-15  4:35         ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: Jaswinder Singh Rajput @ 2009-03-14 18:11 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Ingo Molnar, x86 maintainers, LKML

On Sat, 2009-03-14 at 17:58 +0100, Thomas Gleixner wrote:
> On Sat, 14 Mar 2009, Jaswinder Singh Rajput wrote:
> > Hello Thomas,
> > 
> > On Sat, 2009-03-14 at 17:20 +0100, Thomas Gleixner wrote:
> > > On Sat, 14 Mar 2009, Jaswinder Singh Rajput wrote:
> > > 
> > > > Subject: [PATCH] x86: trampoline.c cleanup
> > > > 
> > > > Impact: cleanup
> > > > 
> > > >  - fix style problems
> > > 
> > > Err. This patch is a style problem itself.
> > >  
> > > > Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> > > > ---
> > > >  arch/x86/kernel/trampoline.c |    3 ++-
> > > >  1 files changed, 2 insertions(+), 1 deletions(-)
> > > > 
> > > > diff --git a/arch/x86/kernel/trampoline.c b/arch/x86/kernel/trampoline.c
> > > > index 808031a..e3b1f2e 100644
> > > > --- a/arch/x86/kernel/trampoline.c
> > > > +++ b/arch/x86/kernel/trampoline.c
> > > > @@ -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
> 
> Sigh. I asked for applying common sense not for creating another
> stupid rule.

Who made this stupid rule ?

--
JSR


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH -tip] x86: trampoline.c cleanup
  2009-03-14 18:11       ` Jaswinder Singh Rajput
@ 2009-03-15  4:35         ` Ingo Molnar
  0 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2009-03-15  4:35 UTC (permalink / raw)
  To: Jaswinder Singh Rajput; +Cc: Thomas Gleixner, x86 maintainers, LKML


* Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:

> On Sat, 2009-03-14 at 17:58 +0100, Thomas Gleixner wrote:
> > On Sat, 14 Mar 2009, Jaswinder Singh Rajput wrote:
> > > Hello Thomas,
> > > 
> > > On Sat, 2009-03-14 at 17:20 +0100, Thomas Gleixner wrote:
> > > > On Sat, 14 Mar 2009, Jaswinder Singh Rajput wrote:
> > > > 
> > > > > Subject: [PATCH] x86: trampoline.c cleanup
> > > > > 
> > > > > Impact: cleanup
> > > > > 
> > > > >  - fix style problems
> > > > 
> > > > Err. This patch is a style problem itself.
> > > >  
> > > > > Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
> > > > > ---
> > > > >  arch/x86/kernel/trampoline.c |    3 ++-
> > > > >  1 files changed, 2 insertions(+), 1 deletions(-)
> > > > > 
> > > > > diff --git a/arch/x86/kernel/trampoline.c b/arch/x86/kernel/trampoline.c
> > > > > index 808031a..e3b1f2e 100644
> > > > > --- a/arch/x86/kernel/trampoline.c
> > > > > +++ b/arch/x86/kernel/trampoline.c
> > > > > @@ -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
> > 
> > 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH -tip] x86: trampoline.c cleanup
  2009-03-14 16:20 ` Thomas Gleixner
  2009-03-14 16:35   ` Jaswinder Singh Rajput
@ 2009-03-15 16:32   ` Jeremy Fitzhardinge
  1 sibling, 0 replies; 7+ messages in thread
From: Jeremy Fitzhardinge @ 2009-03-15 16:32 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Jaswinder Singh Rajput, Ingo Molnar, x86 maintainers, LKML

Thomas Gleixner wrote:
> On Sat, 14 Mar 2009, Jaswinder Singh Rajput wrote:
>
>   
>> Subject: [PATCH] x86: trampoline.c cleanup
>>
>> Impact: cleanup
>>
>>  - fix style problems
>>     
>
> Err. This patch is a style problem itself.
>  
>   
>> Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
>> ---
>>  arch/x86/kernel/trampoline.c |    3 ++-
>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/x86/kernel/trampoline.c b/arch/x86/kernel/trampoline.c
>> index 808031a..e3b1f2e 100644
>> --- a/arch/x86/kernel/trampoline.c
>> +++ b/arch/x86/kernel/trampoline.c
>> @@ -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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-03-15 16:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-14 15:44 [PATCH -tip] x86: trampoline.c cleanup Jaswinder Singh Rajput
2009-03-14 16:20 ` Thomas Gleixner
2009-03-14 16:35   ` Jaswinder Singh Rajput
2009-03-14 16:58     ` Thomas Gleixner
2009-03-14 18:11       ` Jaswinder Singh Rajput
2009-03-15  4:35         ` Ingo Molnar
2009-03-15 16:32   ` Jeremy Fitzhardinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox