public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH ] x86 : Fix compilation warning on paravirt-spinlocks.c
@ 2008-12-08 14:56 Rakib Mullick
  2008-12-08 15:09 ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Rakib Mullick @ 2008-12-08 14:56 UTC (permalink / raw)
  To: Linux-kernel Mailing List; +Cc: Andrew Morton, Ingo Molnar

Impact: Fix compilation warning.

 CC      arch/x86/kernel/paravirt-spinlocks.o
arch/x86/kernel/paravirt-spinlocks.c: In function `default_spin_lock_flags':
arch/x86/kernel/paravirt-spinlocks.c:12: warning: passing arg 1 of
`__raw_spin_lock' from incompatible pointer type

This patch fixes the above warning.  __raw_spin_lock(lock) is declared
when CONFIG_SMP is defined. Thus, a call to __raw_spin_lock requires
checking CONFIG_SMP is defined or not.

Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>

--- linux-2.6-orig/arch/x86/kernel/paravirt-spinlocks.c	2008-12-05
19:53:15.000000000 +0600
+++ linux-2.6/arch/x86/kernel/paravirt-spinlocks.c	2008-12-07
23:52:59.000000000 +0600
@@ -9,7 +9,9 @@

 static void default_spin_lock_flags(struct raw_spinlock *lock,
unsigned long flags)
 {
+#ifdef	CONFIG_SMP
 	__raw_spin_lock(lock);
+#endif
 }

 struct pv_lock_ops pv_lock_ops = {

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

* Re: [PATCH ] x86 : Fix compilation warning on paravirt-spinlocks.c
  2008-12-08 14:56 [PATCH ] x86 : Fix compilation warning on paravirt-spinlocks.c Rakib Mullick
@ 2008-12-08 15:09 ` Ingo Molnar
  2008-12-10  6:28   ` Rakib Mullick
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2008-12-08 15:09 UTC (permalink / raw)
  To: Rakib Mullick; +Cc: Linux-kernel Mailing List, Andrew Morton


* Rakib Mullick <rakib.mullick@gmail.com> wrote:

> Impact: Fix compilation warning.
> 
>  CC      arch/x86/kernel/paravirt-spinlocks.o
> arch/x86/kernel/paravirt-spinlocks.c: In function `default_spin_lock_flags':
> arch/x86/kernel/paravirt-spinlocks.c:12: warning: passing arg 1 of
> `__raw_spin_lock' from incompatible pointer type
> 
> This patch fixes the above warning.  __raw_spin_lock(lock) is declared
> when CONFIG_SMP is defined. Thus, a call to __raw_spin_lock requires
> checking CONFIG_SMP is defined or not.
> 
> Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
> 
> --- linux-2.6-orig/arch/x86/kernel/paravirt-spinlocks.c	2008-12-05
> 19:53:15.000000000 +0600
> +++ linux-2.6/arch/x86/kernel/paravirt-spinlocks.c	2008-12-07
> 23:52:59.000000000 +0600
> @@ -9,7 +9,9 @@
> 
>  static void default_spin_lock_flags(struct raw_spinlock *lock,
> unsigned long flags)
>  {
> +#ifdef	CONFIG_SMP
>  	__raw_spin_lock(lock);
> +#endif

no - this just works around the compiler warning.

Look at the real fix below i did some time ago. If you are into fixing 
warnings you should try tip/master, that has a ton of warning fixes 
already:

  http://people.redhat.com/mingo/tip.git/README

	Ingo

------------------------>
>From ecd05381e26b9a61e49fa485baea1595bd3d1b40 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@elte.hu>
Date: Fri, 17 Oct 2008 16:09:57 +0200
Subject: [PATCH] x86: fix default_spin_lock_flags() prototype
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

these warnings:

  arch/x86/kernel/paravirt-spinlocks.c: In function ‘default_spin_lock_flags’:
  arch/x86/kernel/paravirt-spinlocks.c:12: warning: passing argument 1 of ‘__raw_spin_lock’ from incompatible pointer type
  arch/x86/kernel/paravirt-spinlocks.c: At top level:
  arch/x86/kernel/paravirt-spinlocks.c:11: warning: ‘default_spin_lock_flags’ defined but not used

showed that the prototype of default_spin_lock_flags() was confused about
what type spinlocks have.

the proper type on UP is raw_spinlock_t.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/paravirt-spinlocks.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/paravirt-spinlocks.c b/arch/x86/kernel/paravirt-spinlocks.c
index 0e9f198..95777b0 100644
--- a/arch/x86/kernel/paravirt-spinlocks.c
+++ b/arch/x86/kernel/paravirt-spinlocks.c
@@ -7,7 +7,8 @@
 
 #include <asm/paravirt.h>
 
-static void default_spin_lock_flags(struct raw_spinlock *lock, unsigned long flags)
+static inline void
+default_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags)
 {
 	__raw_spin_lock(lock);
 }

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

* Re: [PATCH ] x86 : Fix compilation warning on paravirt-spinlocks.c
  2008-12-08 15:09 ` Ingo Molnar
@ 2008-12-10  6:28   ` Rakib Mullick
  2008-12-12 11:11     ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Rakib Mullick @ 2008-12-10  6:28 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Linux-kernel Mailing List, Andrew Morton

On 12/8/08, Ingo Molnar <mingo@elte.hu> wrote:
>
>  * Rakib Mullick <rakib.mullick@gmail.com> wrote:
>
> no - this just works around the compiler warning.
>
>  Look at the real fix below i did some time ago. If you are into fixing
>  warnings you should try tip/master, that has a ton of warning fixes
>  already:
>
>   http://people.redhat.com/mingo/tip.git/README
>
>         Ingo
Thanks, Ingo for explanation. In 'default_spin_lock_flags' function ,
the 2nd argument unsigned long flags isn't used in the function. Is it
necessary to keep it ?

Thanks,
Rakib.

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

* Re: [PATCH ] x86 : Fix compilation warning on paravirt-spinlocks.c
  2008-12-10  6:28   ` Rakib Mullick
@ 2008-12-12 11:11     ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2008-12-12 11:11 UTC (permalink / raw)
  To: Rakib Mullick; +Cc: Linux-kernel Mailing List, Andrew Morton


* Rakib Mullick <rakib.mullick@gmail.com> wrote:

> On 12/8/08, Ingo Molnar <mingo@elte.hu> wrote:
> >
> >  * Rakib Mullick <rakib.mullick@gmail.com> wrote:
> >
> > no - this just works around the compiler warning.
> >
> >  Look at the real fix below i did some time ago. If you are into fixing
> >  warnings you should try tip/master, that has a ton of warning fixes
> >  already:
> >
> >   http://people.redhat.com/mingo/tip.git/README
> >
> >         Ingo
> Thanks, Ingo for explanation. In 'default_spin_lock_flags' function ,
> the 2nd argument unsigned long flags isn't used in the function. Is it
> necessary to keep it ?

yes, it's a function pointer used in a generic template:

        .spin_lock_flags = default_spin_lock_flags,

.spin_lock_flags() expects that parameter signature - even if in specific 
implementations the parameter might be unused.

	Ingo

	Ingo

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

end of thread, other threads:[~2008-12-12 11:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-08 14:56 [PATCH ] x86 : Fix compilation warning on paravirt-spinlocks.c Rakib Mullick
2008-12-08 15:09 ` Ingo Molnar
2008-12-10  6:28   ` Rakib Mullick
2008-12-12 11:11     ` Ingo Molnar

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