Re: [PATCH v2] mm: cma: make mm/cma.h self-contained and conditionalize includes
From: Barry Song
Date: Sat Aug 15 2026 - 07:36:09 EST
On Sat, Aug 15, 2026 at 6:33 PM Eamon Sippy <eamon112009@xxxxxxxxx> wrote:
>
> mm/cma.h uses types from <linux/spinlock.h>, <linux/mutex.h>,
> <linux/atomic.h> and <linux/list.h> without explicitly including them,
> violating the kernel header self-containment guidelines.
>
> <linux/debugfs.h> and <linux/kobject.h> are also included unconditionally
> even though they are only needed under CONFIG_CMA_DEBUGFS and
> CONFIG_CMA_SYSFS respectively. Move the struct cma_kobject definition and
> <linux/kobject.h> inside the CONFIG_CMA_SYSFS block, and move
> <linux/debugfs.h> inside CONFIG_CMA_DEBUGFS.
>
> Remove spurious trailing semicolons after the empty inline function bodies
> in the CONFIG_CMA_SYSFS #else branch.
>
> Add <linux/cma.h> so that MAX_CMA_AREAS and CMA_MAX_NAME are always
> available when this header is included.
>
> Changes in v2:
> - Drop inaccurate spinlock comment; the lock also protects
> available_count and allocation checks (Barry)
>
> Signed-off-by: Eamon Sippy <eamon112009@xxxxxxxxx>
> ---
Reviewed-by: Barry Song <baohua@xxxxxxxxxx>