cpumask: Add helper cpumask_available()
authorMatthias Kaehlcke <[email protected]>
Wed, 12 Apr 2017 18:20:29 +0000 (11:20 -0700)
committerThomas Gleixner <[email protected]>
Fri, 14 Apr 2017 17:50:47 +0000 (19:50 +0200)
commitf7e30f01a9e221067bb4b579e3cfc25cd2617467
tree69e8ad9e076a0ad4b010cd7708af02a3af63929a
parent45e5202213ae6541f7916bb3c64fbcd3019ec473
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 <[email protected]>
Cc: Grant Grundler <[email protected]>
Cc: Rusty Russell <[email protected]>
Cc: Greg Hackmann <[email protected]>
Cc: Michael Davidson <[email protected]>
Cc: Andrew Morton <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Thomas Gleixner <[email protected]>
include/linux/cpumask.h