Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1639688

[PATCH] smp_call_function: use inline helpers instead of macros

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject [PATCH] smp_call_function: use inline helpers instead of macros
Date 2017-05-11 17:20 +0200
Message-ID <tFY2J-81A-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


A new caller of smp_call_function() passes a local variable as the 'wait'
argument, and that variable is otherwise unused, so we get a warning
in non-SMP configurations:

virt/kvm/kvm_main.c: In function 'kvm_make_all_cpus_request':
virt/kvm/kvm_main.c:195:7: error: unused variable 'wait' [-Werror=unused-variable]
  bool wait = req & KVM_REQUEST_WAIT;

This addresses the warning by changing the two macros into inline functions.

Fixes: 7a97cec26b94 ("KVM: mark requests that need synchronization")
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/smp.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/include/linux/smp.h b/include/linux/smp.h
index e978ec742103..acd401c0c77d 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -144,13 +144,20 @@ static inline int up_smp_call_function(smp_call_func_t func, void *info)
 {
 	return 0;
 }
-#define smp_call_function(func, info, wait) \
-			(up_smp_call_function(func, info))
+static inline int smp_call_function(smp_call_func_t func, void *info, int wait)
+{
+	return up_smp_call_function(func, info);
+}
 
 static inline void smp_send_reschedule(int cpu) { }
 #define smp_prepare_boot_cpu()			do {} while (0)
-#define smp_call_function_many(mask, func, info, wait) \
-			(up_smp_call_function(func, info))
+
+static inline void smp_call_function_many(const struct cpumask *mask,
+			    smp_call_func_t func, void *info, bool wait)
+{
+	up_smp_call_function(func, info);
+}
+
 static inline void call_function_init(void) { }
 
 static inline int
-- 
2.9.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] smp_call_function: use inline helpers instead of macros Arnd Bergmann <arnd@arndb.de> - 2017-05-11 17:20 +0200
  Re: [PATCH] smp_call_function: use inline helpers instead of macros Paolo Bonzini <pbonzini@redhat.com> - 2017-05-11 17:40 +0200
  Re: [PATCH] smp_call_function: use inline helpers instead of macros kbuild test robot <lkp@intel.com> - 2017-05-11 21:00 +0200

csiph-web