On Mon, Sep 08, 2025 at 09:36:35AM +0200, Daniel Wagner wrote:
> which resulted in a way cleaner code. Though the kernel test robot
> complained with
> 
>       >> block/blk-mq-cpumap.c:155:16: error: array initializer must be an 
> initializer list
>            155 |         cpumask_var_t active_hctx __free(free_cpumask_var) = 
> NULL;
> 
> I try to figure out if it's possible to get this somehow working with
> some witchcraft (aka pre compiler magic).

What about adding something like this here:


#ifdef CONFIG_CPUMASK_OFFSTACK

#define scoped_cpumask_var(_name)                       \
        cpumask_var_t _name __free(free_cpumask_var) = NULL;

#else /* ! CONFIG_CPUMASK_OFFSTACK */

#define scoped_cpumask_var(_name)                       \
        cpumask_var_t _name __free(free_cpumask_var);

#endif /* ! CONFIG_CPUMASK_OFFSTACK */


This would make the new code way cleaner.

Reply via email to