• Matthias Kaehlcke's avatar
    cpumask: Add helper cpumask_available() · f7e30f01
    Matthias Kaehlcke authored
    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: default avatarMatthias Kaehlcke <mka@chromium.org>
    Cc: Grant Grundler <grundler@chromium.org>
    Cc: Rusty Russell <rusty@rustcorp.com.au>
    Cc: Greg Hackmann <ghackmann@google.com>
    Cc: Michael Davidson <md@google.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Link: http://lkml.kernel.org/r/20170412182030.83657-1-mka@chromium.orgSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    f7e30f01
cpumask.h 24.3 KB