Skip to contentSkip to conversation

drm/ttm: two small ttm_bo.c cleanups

PATCH In review Sean Chang 2 participants 4 messages Aug 18 – Aug 24

Subsystems (3)
lore
Share & tools
lore

Sean Chang

author
#0 lore raw

v2 cover drm/ttm: two small ttm_bo.c cleanups

This series contains two independent, minor cleanups to drivers/gpu/drm/ttm/ttm_bo.c found while auditing the file. They do not depend on each other and could be applied in either order or separately.

Patch 1 removes a stale @ctx kernel-doc entry left over from an earlier struct change, fixing a kernel-doc / W=1 mismatch warning.

Patch 2 gives ttm_swap_ops static linkage since it is not used outside this file and is not exported, fixing a sparse "was not declared, should it be static?" warning.

Both patches were build-tested with make W=1 C=2.

---
v2:
- Correct target function name in patch 1 commit message to ttm_bo_alloc_at_place.

Sean Chang (2):
drm/ttm: drop stale @ctx kernel-doc entry
drm/ttm: make ttm_swap_ops static

 drivers/gpu/drm/ttm/ttm_bo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH v2 1/2 drm/ttm: drop stale @ctx kernel-doc entry

ttm_bo_alloc_at_place no longer has a ctx member, but its kernel-doc comment still documents @ctx. Remove the stale entry so the documentation matches the struct.

---
 drivers/gpu/drm/ttm/ttm_bo.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/ttm/ttm_bo.c +0 -1
index ef56c18ded1b..943297b49dc5 100644
@@ -506,7 +506,6 @@ struct ttm_bo_alloc_state {
  *
  * @bo: The buffer to allocate the backing store of
  * @place: The place to attempt allocation in
- * @ctx: ttm_operation_ctx associated with this allocation
  * @force_space: If we should evict buffers to force space
  * @res: On allocation success, the resulting struct ttm_resource.
  * @alloc_state: Object holding allocation state such as charged cgroups.
Signature · 1 line
2.43.0
author
#2 lore raw

PATCH v2 2/2 drm/ttm: make ttm_swap_ops static

In reply to Sean Chang

ttm_swap_ops is not used outside ttm_bo.c and is not exported via EXPORT_SYMBOL(), so give it static linkage to keep it file-local and avoid polluting the global symbol namespace.

---
 drivers/gpu/drm/ttm/ttm_bo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_bo.c +1 -1
index 943297b49dc5..1b9477381a1d 100644
@@ -1449,7 +1449,7 @@ ttm_bo_swapout_cb(struct ttm_lru_walk *walk, struct ttm_buffer_object *bo)
 	return ret;
 }
 
-const struct ttm_lru_walk_ops ttm_swap_ops = {
+static const struct ttm_lru_walk_ops ttm_swap_ops = {
 	.process_bo = ttm_bo_swapout_cb,
 };
 
Signature · 1 line
2.43.0
#3 lore raw
In reply to Sean Chang
Quoted 12 lines · Sean Chang

This series contains two independent, minor cleanups to drivers/gpu/drm/ttm/ttm_bo.c found while auditing the file. They do not depend on each other and could be applied in either order or separately.

Patch 1 removes a stale @ctx kernel-doc entry left over from an earlier struct change, fixing a kernel-doc / W=1 mismatch warning.

Patch 2 gives ttm_swap_ops static linkage since it is not used outside this file and is not exported, fixing a sparse "was not declared, should it be static?" warning.

Quoted 6 lines

Both patches were build-tested with make W=1 C=2.

---
v2:
- Correct target function name in patch 1 commit message to ttm_bo_alloc_at_place.

I haven't seen v2 in my inbox for some reason before pushing v1.

So the name is wrong in the commit message, but that shouldn't really hurt.

Anyway patches have been pushed to drm-misc-next.

Thanks,
Christian.

Quoted 11 lines

Sean Chang (2):
drm/ttm: drop stale @ctx kernel-doc entry
drm/ttm: make ttm_swap_ops static

 drivers/gpu/drm/ttm/ttm_bo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--
2.43.0