From: Yury Norov Date: Mon, 29 Jan 2024 06:21:05 +0000 (-0800) Subject: cpumask: define cleanup function for cpumasks X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=dcee228078c34b63089c4b589d4bddf08019d0f6;p=linux.git cpumask: define cleanup function for cpumasks Now we can simplify code that allocates cpumasks for local needs. Signed-off-by: Yury Norov Signed-off-by: Paolo Abeni --- diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 228c23eb36d27..1c29947db8489 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -7,6 +7,7 @@ * set of CPUs in a system, one bit position per CPU number. In general, * only nr_cpu_ids (<= NR_CPUS) bits are valid. */ +#include #include #include #include @@ -990,6 +991,8 @@ static inline bool cpumask_available(cpumask_var_t mask) } #endif /* CONFIG_CPUMASK_OFFSTACK */ +DEFINE_FREE(free_cpumask_var, struct cpumask *, if (_T) free_cpumask_var(_T)); + /* It's common to want to use cpu_all_mask in struct member initializers, * so it has to refer to an address rather than a pointer. */ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS);