From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj2-f11.google.com (mail-pj2-f11.google.com [74.125.227.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8CBF24B0483 for ; Sat, 15 Aug 2026 08:40:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.139 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786783242; cv=none; b=h8rZBOWoaaN+kgkBUrriLYsDzuicbFm0R0dcj/qALOTpokZEAIN8b92xE9EtonE3M4/f6MXcMTrB83CKxdGcQNqg5zj69GA4L1OBm6G+a3gCm7RcLxXRYLg6z86iRxcLvnabt0c94ds5r4f6tPwwGT5M/qFcsVYGgOLSi1MDoWM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786783242; c=relaxed/simple; bh=vPWN6VblO8iXUVXELsJKK9JoVmaPLWKPAJCJ6+DX89c=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=I45omkJH7wJK3mmfceSDoqYvx3Ns+s617a7mPzUI/SDyeAT4O7qNjtq0zTue4P4C1GpfkQHHu9aZKI2e1/AqKNq13BG/5KeRpp13VoczEar93dLybECGGdekbTAkop+LiCrfnuxGVMp4DoElLXhegdsLcJ6Lp/cBlp968i+wqa8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=L8nPUhRn; arc=none smtp.client-ip=74.125.227.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L8nPUhRn" Received: by mail-pj2-f11.google.com with SMTP id d9443c01a7336-2cf02ecb572so25971745ad.1 for ; Sat, 15 Aug 2026 01:40:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786783241; x=1787388041; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=xcv8l5CiFtE29rX5E363F5csjK5+NcrGXED2GBfGaKQ=; b=L8nPUhRn3sM8TDDP5PpA49XqRgq/N2lAK5cM/v+6L1PrT6jNZJVWeJzNjlmF8gYRon Tnyeo1jhvqbBxRz657nNvwXB4Dv3xEjaGC3QHNXZKgvz/y3d8RI1eNENia3vFrsUGBzh pyJfHrrLUnCldB1s7xonPq6A2d2dJn0qpqtornBh5fo/GHtUwDvijPXmJjSqYauzxTvx mEZYdtmDWPAR7/S4KNLtDlcFYIzV8qSTFQxIKIr6AOcnLIufnuDCeis/R1avmpAZgn+R W0UgNLhLaGSlCeBP+9Z1i/PSreiBNTjVKV0lw/QRQbk6gbRCAgiX/1a6+YdVYFNSGw4h yncQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786783241; x=1787388041; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=xcv8l5CiFtE29rX5E363F5csjK5+NcrGXED2GBfGaKQ=; b=Jjd/x/+C1MkBEX6w5R+Hx5ZHiz0sgcyZbk1RpAalBs+HyfcJ3vOLPDJSthigJz7PiP ZlF9Oo/Mz9tj8XHiY1b3CSApcVCSyGWIPCWybpBBgsMMrn745k1Bq8UweO64aAj2yIXB iyrZBgeupSe2/Er71oE8gEOw6n2qHWrwuppvTfQtdltbQd7YUEFxXAAAbX5zIBh3GX6u 1gXBdwPqNsbi1uhwtQTo+t/F7V5eepUYF6fEwwVauG0MNJ1ypd76SxqPKJPl2iD+L75L +6GBBSGCVBUtqasHoP2DKv0vHdl+9Odp7HKYBoomdOjmym1usH0TGnYbgDeZPfJeCxW5 040g== X-Forwarded-Encrypted: i=1; AHgh+RptcaZcB4SGHzsZCVnh7a3ab2fBkEXNIzrmsHusFtc5PuvwaxmqJitqqPKL7H3R39J/KVRuH7h8HFGU8Og=@vger.kernel.org X-Gm-Message-State: AOJu0YxP/o5/ntTG9mAxgM5JXnVGUC1Va2UqCkoLBxpoxugVb1WWXzT0 82So/zv2K+qgdquOMPvSg5lHpGj4jH2+vopik5i6SzJX/BfPfCHQrzHqYFIGkRvVcOdu0g== X-Gm-Gg: AR+sD11zhtuVNQ3JSZK/eYg12G2JKvbX3Yad7i3SBz61AOn8F5W32kSotA3oHKgMv7o 3YU58EQtRQls8zDC4QMUxDIGuecD49sbuV29/X98qSxkk4BfOmUiOWd4x62xslePC8Pa2jvlwdO R6jgZh+cTANYnjrzj/Y26WDrRxGv6LKmwzrO5MJGBmS/StQll0QpFK4USEcQXRqtVw6XTdHdUUx FToWYZBqQI0IHo044VZkbWqiV5miwFIW9Upra1F3TKkJhc/6vdlJ10P4tHgiJsVrXb5ovUCfpTI nQk6fglpagbB5AXyEwg6XA0fCqsZx1RNCd/vXyGIpV4buS+9c6stszjv+K9+FIUqRSOnc5cFJe/ NNBSXH8LbU3sRvpbmkhlzHSa3XHRbFubZPK9i6jKHcC7/zMOBrHabu5VbUyLomepoTCqtAHeao1 dn5x7kexVtPmhuKaWg/j+iSX9aBFfxSbAntyVLbwDRqgvCCcBOFN3AnaVD5rIe8oJSzsrerwxO1 EjI13iIRchpMAc= X-Received: by 2002:a05:6a21:3a47:b0:3c3:9993:d5c3 with SMTP id adf61e73a8af0-3cc71aae5admr15595751637.9.1786783240710; Sat, 15 Aug 2026 01:40:40 -0700 (PDT) Received: from Ubuntu-172-24-64-1.localdomain ([157.37.185.197]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-141387c56aesm16591312c88.4.2026.08.15.01.40.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Aug 2026 01:40:40 -0700 (PDT) From: Eamon Sippy To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Eamon Sippy Subject: [PATCH] mm: cma: make mm/cma.h self-contained and conditionalize includes Date: Sat, 15 Aug 2026 08:40:26 +0000 Message-ID: <20260815084026.44078-1-eamon112009@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit mm/cma.h uses types from , , and without explicitly including them, violating the kernel header self-containment guidelines. and 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 inside the CONFIG_CMA_SYSFS block, and move inside CONFIG_CMA_DEBUGFS. Remove spurious trailing semicolons after the empty inline function bodies in the CONFIG_CMA_SYSFS #else branch. Add so that MAX_CMA_AREAS and CMA_MAX_NAME are always available when this header is included. Signed-off-by: Eamon Sippy --- mm/cma.h | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/mm/cma.h b/mm/cma.h index c70180c36559..0a1cb0141756 100644 --- a/mm/cma.h +++ b/mm/cma.h @@ -2,13 +2,24 @@ #ifndef __MM_CMA_H__ #define __MM_CMA_H__ +#include +#include +#include +#include +#include + +#ifdef CONFIG_CMA_DEBUGFS #include +#endif + +#ifdef CONFIG_CMA_SYSFS #include struct cma_kobject { struct kobject kobj; struct cma *cma; }; +#endif /* * Multi-range support. This can be useful if the size of the allocation @@ -37,10 +48,10 @@ struct cma_memrange { #define CMA_MAX_RANGES 8 struct cma { - unsigned long count; - unsigned long available_count; + unsigned long count; + unsigned long available_count; unsigned int order_per_bit; /* Order of pages represented by one bit */ - spinlock_t lock; + spinlock_t lock; /* protects allocation bitmap */ struct mutex alloc_mutex; #ifdef CONFIG_CMA_DEBUGFS struct hlist_head mem_head; @@ -86,10 +97,11 @@ void cma_sysfs_account_fail_pages(struct cma *cma, unsigned long nr_pages); void cma_sysfs_account_release_pages(struct cma *cma, unsigned long nr_pages); #else static inline void cma_sysfs_account_success_pages(struct cma *cma, - unsigned long nr_pages) {}; + unsigned long nr_pages) {} static inline void cma_sysfs_account_fail_pages(struct cma *cma, - unsigned long nr_pages) {}; + unsigned long nr_pages) {} static inline void cma_sysfs_account_release_pages(struct cma *cma, - unsigned long nr_pages) {}; + unsigned long nr_pages) {} #endif + #endif -- 2.43.0