Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sanjay Yadav <sanjay.kumar.yadav@intel.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org,
	"Christian König" <christian.koenig@amd.com>,
	"Arunpravin Paneer Selvam" <Arunpravin.PaneerSelvam@amd.com>,
	"Matthew Auld" <matthew.auld@intel.com>
Subject: [PATCH 1/2] drm/buddy: Move internal helpers to drm_buddy.c
Date: Wed,  4 Feb 2026 16:13:45 +0530	[thread overview]
Message-ID: <20260204104345.1980047-5-sanjay.kumar.yadav@intel.com> (raw)
In-Reply-To: <20260204104345.1980047-4-sanjay.kumar.yadav@intel.com>

Move drm_buddy_block_state(), drm_buddy_block_is_allocated(),
drm_buddy_block_is_free(), and drm_buddy_block_is_split() from
drm_buddy.h to drm_buddy.c as static functions since they have
no external callers.

Remove drm_get_buddy() as it was an unused exported wrapper
around the internal __get_buddy().

No functional changes.

Cc: Christian König <christian.koenig@amd.com>
Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Suggested-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Sanjay Yadav <sanjay.kumar.yadav@intel.com>
---
 drivers/gpu/drm/drm_buddy.c | 41 ++++++++++++++++++++++---------------
 include/drm/drm_buddy.h     | 27 ------------------------
 2 files changed, 24 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c
index fd34d3755f7c..05fe9d12e274 100644
--- a/drivers/gpu/drm/drm_buddy.c
+++ b/drivers/gpu/drm/drm_buddy.c
@@ -21,6 +21,30 @@ enum drm_buddy_free_tree {
 
 static struct kmem_cache *slab_blocks;
 
+static unsigned int
+drm_buddy_block_state(struct drm_buddy_block *block)
+{
+	return block->header & DRM_BUDDY_HEADER_STATE;
+}
+
+static bool
+drm_buddy_block_is_allocated(struct drm_buddy_block *block)
+{
+	return drm_buddy_block_state(block) == DRM_BUDDY_ALLOCATED;
+}
+
+static bool
+drm_buddy_block_is_free(struct drm_buddy_block *block)
+{
+	return drm_buddy_block_state(block) == DRM_BUDDY_FREE;
+}
+
+static bool
+drm_buddy_block_is_split(struct drm_buddy_block *block)
+{
+	return drm_buddy_block_state(block) == DRM_BUDDY_SPLIT;
+}
+
 #define for_each_free_tree(tree) \
 	for ((tree) = 0; (tree) < DRM_BUDDY_MAX_FREE_TREES; (tree)++)
 
@@ -459,23 +483,6 @@ static int split_block(struct drm_buddy *mm,
 	return 0;
 }
 
-/**
- * drm_get_buddy - get buddy address
- *
- * @block: DRM buddy block
- *
- * Returns the corresponding buddy block for @block, or NULL
- * if this is a root block and can't be merged further.
- * Requires some kind of locking to protect against
- * any concurrent allocate and free operations.
- */
-struct drm_buddy_block *
-drm_get_buddy(struct drm_buddy_block *block)
-{
-	return __get_buddy(block);
-}
-EXPORT_SYMBOL(drm_get_buddy);
-
 /**
  * drm_buddy_reset_clear - reset blocks clear state
  *
diff --git a/include/drm/drm_buddy.h b/include/drm/drm_buddy.h
index b909fa8f810a..eb8b4f5e15b3 100644
--- a/include/drm/drm_buddy.h
+++ b/include/drm/drm_buddy.h
@@ -101,36 +101,12 @@ drm_buddy_block_order(struct drm_buddy_block *block)
 	return block->header & DRM_BUDDY_HEADER_ORDER;
 }
 
-static inline unsigned int
-drm_buddy_block_state(struct drm_buddy_block *block)
-{
-	return block->header & DRM_BUDDY_HEADER_STATE;
-}
-
-static inline bool
-drm_buddy_block_is_allocated(struct drm_buddy_block *block)
-{
-	return drm_buddy_block_state(block) == DRM_BUDDY_ALLOCATED;
-}
-
 static inline bool
 drm_buddy_block_is_clear(struct drm_buddy_block *block)
 {
 	return block->header & DRM_BUDDY_HEADER_CLEAR;
 }
 
-static inline bool
-drm_buddy_block_is_free(struct drm_buddy_block *block)
-{
-	return drm_buddy_block_state(block) == DRM_BUDDY_FREE;
-}
-
-static inline bool
-drm_buddy_block_is_split(struct drm_buddy_block *block)
-{
-	return drm_buddy_block_state(block) == DRM_BUDDY_SPLIT;
-}
-
 static inline u64
 drm_buddy_block_size(struct drm_buddy *mm,
 		     struct drm_buddy_block *block)
@@ -142,9 +118,6 @@ int drm_buddy_init(struct drm_buddy *mm, u64 size, u64 chunk_size);
 
 void drm_buddy_fini(struct drm_buddy *mm);
 
-struct drm_buddy_block *
-drm_get_buddy(struct drm_buddy_block *block);
-
 int drm_buddy_alloc_blocks(struct drm_buddy *mm,
 			   u64 start, u64 end, u64 size,
 			   u64 min_page_size,
-- 
2.52.0


  reply	other threads:[~2026-02-04 10:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04 10:43 [PATCH 0/2] drm/buddy: Documentation and internal helper cleanup Sanjay Yadav
2026-02-04 10:43 ` Sanjay Yadav [this message]
2026-02-06  8:27   ` [PATCH 1/2] drm/buddy: Move internal helpers to drm_buddy.c Paneer Selvam, Arunpravin
2026-02-04 10:43 ` [PATCH 2/2] drm/buddy: Add kernel-doc for allocator structures and flags Sanjay Yadav
2026-02-06  8:39   ` Paneer Selvam, Arunpravin
2026-02-04 10:54 ` ✓ CI.KUnit: success for drm/buddy: Documentation and internal helper cleanup Patchwork
2026-02-04 11:53 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-02-04 22:03 ` ✗ Xe.CI.FULL: " Patchwork
2026-02-04 22:32 ` ✓ CI.KUnit: success for drm/buddy: Documentation and internal helper cleanup (rev2) Patchwork
2026-02-04 23:24 ` ✓ Xe.CI.BAT: " Patchwork
2026-02-05 13:53 ` ✗ Xe.CI.FULL: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260204104345.1980047-5-sanjay.kumar.yadav@intel.com \
    --to=sanjay.kumar.yadav@intel.com \
    --cc=Arunpravin.PaneerSelvam@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox