mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Arnd Bergmann <arnd@arndb.de>, Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] smp_call_function: use inline helpers instead of macros
Date: Thu, 11 May 2017 17:34:19 +0200	[thread overview]
Message-ID: <70b92304-becb-9f0a-2cf6-dc90a1173dd4@redhat.com> (raw)
In-Reply-To: <20170511151418.2700143-1-arnd@arndb.de>



On 11/05/2017 17:13, Arnd Bergmann wrote:
> 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);
> +}

You can just delete up_smp_call_function and return 0.  The purpose of
up_smp_call_function was only to eat warnings about those two arguments,
as far as I could see.

(I sent almost exactly the same patch to Paul this morning).

Paolo

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

  reply	other threads:[~2017-05-11 15:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-11 15:13 Arnd Bergmann
2017-05-11 15:34 ` Paolo Bonzini [this message]
2017-05-11 18:53 ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=70b92304-becb-9f0a-2cf6-dc90a1173dd4@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®