From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752587AbdDNR7Q (ORCPT ); Fri, 14 Apr 2017 13:59:16 -0400 Received: from terminus.zytor.com ([65.50.211.136]:39453 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751445AbdDNR7O (ORCPT ); Fri, 14 Apr 2017 13:59:14 -0400 Date: Fri, 14 Apr 2017 10:54:58 -0700 From: tip-bot for Matthias Kaehlcke Message-ID: Cc: rusty@rustcorp.com.au, hpa@zytor.com, ghackmann@google.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, mingo@kernel.org, grundler@chromium.org, mka@chromium.org, md@google.com Reply-To: md@google.com, mka@chromium.org, mingo@kernel.org, grundler@chromium.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, tglx@linutronix.de, rusty@rustcorp.com.au, ghackmann@google.com, hpa@zytor.com In-Reply-To: <20170412182030.83657-1-mka@chromium.org> References: <20170412182030.83657-1-mka@chromium.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:irq/core] cpumask: Add helper cpumask_available() Git-Commit-ID: f7e30f01a9e221067bb4b579e3cfc25cd2617467 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: f7e30f01a9e221067bb4b579e3cfc25cd2617467 Gitweb: http://git.kernel.org/tip/f7e30f01a9e221067bb4b579e3cfc25cd2617467 Author: Matthias Kaehlcke AuthorDate: Wed, 12 Apr 2017 11:20:29 -0700 Committer: Thomas Gleixner CommitDate: Fri, 14 Apr 2017 19:50:47 +0200 cpumask: Add helper cpumask_available() With CONFIG_CPUMASK_OFFSTACK=y cpumask_var_t is a struct cpumask pointer, otherwise a struct cpumask array with a single element. Some code dealing with cpumasks needs to validate that a cpumask_var_t is not a NULL pointer when CONFIG_CPUMASK_OFFSTACK=y. This is typically done by performing the check always, regardless of the underlying type of cpumask_var_t. This works in both cases, however clang raises a warning like this when CONFIG_CPUMASK_OFFSTACK=n: kernel/irq/manage.c:839:28: error: address of array 'desc->irq_common_data.affinity' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] Add the inline helper cpumask_available() which only performs the pointer check if CONFIG_CPUMASK_OFFSTACK=y. Signed-off-by: Matthias Kaehlcke Cc: Grant Grundler Cc: Rusty Russell Cc: Greg Hackmann Cc: Michael Davidson Cc: Andrew Morton Link: http://lkml.kernel.org/r/20170412182030.83657-1-mka@chromium.org Signed-off-by: Thomas Gleixner --- include/linux/cpumask.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 96f1e88..1a67560 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -667,6 +667,11 @@ void alloc_bootmem_cpumask_var(cpumask_var_t *mask); void free_cpumask_var(cpumask_var_t mask); void free_bootmem_cpumask_var(cpumask_var_t mask); +static inline bool cpumask_available(cpumask_var_t mask) +{ + return mask != NULL; +} + #else typedef struct cpumask cpumask_var_t[1]; @@ -708,6 +713,11 @@ static inline void free_cpumask_var(cpumask_var_t mask) static inline void free_bootmem_cpumask_var(cpumask_var_t mask) { } + +static inline bool cpumask_available(cpumask_var_t mask) +{ + return true; +} #endif /* CONFIG_CPUMASK_OFFSTACK */ /* It's common to want to use cpu_all_mask in struct member initializers,