All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Silence warning if CONFIG_LOCKDEP isn't set
@ 2013-01-24 20:53 Paul Bolle
  2013-01-25 10:40 ` [tip:core/locking] lockdep: Silence warning if CONFIG_LOCKDEP isn 't set tip-bot for Paul Bolle
  2013-02-22 12:24 ` tip-bot for Paul Bolle
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Bolle @ 2013-01-24 20:53 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Stanislav Kinsbursky, J. Bruce Fields
  Cc: linux-kernel

Since commit c9a4962881929df7f1ef6e63e1b9da304faca4dd ("nfsd: make
client_lock per net") compiling nfs4state.o without CONFIG_LOCKDEP set,
triggers this GCC warning:
    fs/nfsd/nfs4state.c: In function ‘free_client’:
    fs/nfsd/nfs4state.c:1051:19: warning: unused variable ‘nn’ [-Wunused-variable]

The cause of that warning is that lockdep_assert_held() compiles away if
CONFIG_LOCKDEP is not set. Silence this warning by using the argument to
lockdep_assert_held() as a nop if CONFIG_LOCKDEP is not set.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
---
0) Compile tested only.

1) This patch triggers a checkpatch false positive:
    WARNING: Single statement macros should not use a do {} while (0) loop

2) Review is rather needed here, since I'm not sure what, if any, the
downsides are of this patch for all other "calls" of
lockdep_assert_held(). Besides, a cleaner solution might be to simply
drop lockdep_assert_held() in free_client(). There are only three
callers of that function and it seems obvious that all three do hold
'client_lock'.

 include/linux/lockdep.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 2bca44b..f05631e 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -410,7 +410,7 @@ struct lock_class_key { };
 
 #define lockdep_depth(tsk)	(0)
 
-#define lockdep_assert_held(l)			do { } while (0)
+#define lockdep_assert_held(l)			do { (void)(l); } while (0)
 
 #define lockdep_recursing(tsk)			(0)
 
-- 
1.7.11.7


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

* [tip:core/locking] lockdep: Silence warning if CONFIG_LOCKDEP isn 't set
  2013-01-24 20:53 [PATCH] Silence warning if CONFIG_LOCKDEP isn't set Paul Bolle
@ 2013-01-25 10:40 ` tip-bot for Paul Bolle
  2013-02-22 12:24 ` tip-bot for Paul Bolle
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Paul Bolle @ 2013-01-25 10:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, peterz, bfields, pebolle, skinsbursky, tglx

Commit-ID:  61b48fd031db92de6fe74ebba4bc3799bd55c3fa
Gitweb:     http://git.kernel.org/tip/61b48fd031db92de6fe74ebba4bc3799bd55c3fa
Author:     Paul Bolle <pebolle@tiscali.nl>
AuthorDate: Thu, 24 Jan 2013 21:53:17 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 25 Jan 2013 08:43:57 +0100

lockdep: Silence warning if CONFIG_LOCKDEP isn't set

Since commit c9a4962881929df7f1ef6e63e1b9da304faca4dd ("nfsd:
make client_lock per net") compiling nfs4state.o without
CONFIG_LOCKDEP set, triggers this GCC warning:

    fs/nfsd/nfs4state.c: In function ‘free_client’:
    fs/nfsd/nfs4state.c:1051:19: warning: unused variable ‘nn’ [-Wunused-variable]

The cause of that warning is that lockdep_assert_held() compiles
away if CONFIG_LOCKDEP is not set. Silence this warning by using
the argument to lockdep_assert_held() as a nop if CONFIG_LOCKDEP
is not set.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>
Cc: J. Bruce Fields <bfields@redhat.com>
Link: http://lkml.kernel.org/r/1359060797.1325.33.camel@x61.thuisdomein
Signed-off-by: Ingo Molnar <mingo@kernel.org>
--
 include/linux/lockdep.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
 include/linux/lockdep.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 2bca44b..f05631e 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -410,7 +410,7 @@ struct lock_class_key { };
 
 #define lockdep_depth(tsk)	(0)
 
-#define lockdep_assert_held(l)			do { } while (0)
+#define lockdep_assert_held(l)			do { (void)(l); } while (0)
 
 #define lockdep_recursing(tsk)			(0)
 

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

* [tip:core/locking] lockdep: Silence warning if CONFIG_LOCKDEP isn 't set
  2013-01-24 20:53 [PATCH] Silence warning if CONFIG_LOCKDEP isn't set Paul Bolle
  2013-01-25 10:40 ` [tip:core/locking] lockdep: Silence warning if CONFIG_LOCKDEP isn 't set tip-bot for Paul Bolle
@ 2013-02-22 12:24 ` tip-bot for Paul Bolle
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Paul Bolle @ 2013-02-22 12:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, peterz, bfields, pebolle, skinsbursky, tglx

Commit-ID:  5cd3f5affad2109fd1458aab3f6216f2181e26ea
Gitweb:     http://git.kernel.org/tip/5cd3f5affad2109fd1458aab3f6216f2181e26ea
Author:     Paul Bolle <pebolle@tiscali.nl>
AuthorDate: Thu, 24 Jan 2013 21:53:17 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 19 Feb 2013 08:42:41 +0100

lockdep: Silence warning if CONFIG_LOCKDEP isn't set

Since commit c9a4962881929df7f1ef6e63e1b9da304faca4dd ("nfsd:
make client_lock per net") compiling nfs4state.o without
CONFIG_LOCKDEP set, triggers this GCC warning:

    fs/nfsd/nfs4state.c: In function ‘free_client’:
    fs/nfsd/nfs4state.c:1051:19: warning: unused variable ‘nn’ [-Wunused-variable]

The cause of that warning is that lockdep_assert_held() compiles
away if CONFIG_LOCKDEP is not set. Silence this warning by using
the argument to lockdep_assert_held() as a nop if CONFIG_LOCKDEP
is not set.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>
Cc: J. Bruce Fields <bfields@redhat.com>
Link: http://lkml.kernel.org/r/1359060797.1325.33.camel@x61.thuisdomein
Signed-off-by: Ingo Molnar <mingo@kernel.org>
--
 include/linux/lockdep.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
 include/linux/lockdep.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 2bca44b..f05631e 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -410,7 +410,7 @@ struct lock_class_key { };
 
 #define lockdep_depth(tsk)	(0)
 
-#define lockdep_assert_held(l)			do { } while (0)
+#define lockdep_assert_held(l)			do { (void)(l); } while (0)
 
 #define lockdep_recursing(tsk)			(0)
 

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

end of thread, other threads:[~2013-02-22 12:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-24 20:53 [PATCH] Silence warning if CONFIG_LOCKDEP isn't set Paul Bolle
2013-01-25 10:40 ` [tip:core/locking] lockdep: Silence warning if CONFIG_LOCKDEP isn 't set tip-bot for Paul Bolle
2013-02-22 12:24 ` tip-bot for Paul Bolle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.