Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/nouveau: Make fence container helper usable driver-wide

In order to implement a new DRM GPU scheduler callback in Nouveau, a
helper for obtaining a nouveau_fence from a dma_fence is necessary. Such
a helper exists already inside nouveau_fence.c, called from_fence().

Make that helper available to other C files with a more precise name.

Acked-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Philipp Stanner <phasta@kernel.org>
Link: https://lore.kernel.org/r/20250710125412.128476-8-phasta@kernel.org

+13 -13
+7 -13
drivers/gpu/drm/nouveau/nouveau_fence.c
··· 38 38 static const struct dma_fence_ops nouveau_fence_ops_uevent; 39 39 static const struct dma_fence_ops nouveau_fence_ops_legacy; 40 40 41 - static inline struct nouveau_fence * 42 - from_fence(struct dma_fence *fence) 43 - { 44 - return container_of(fence, struct nouveau_fence, base); 45 - } 46 - 47 41 static inline struct nouveau_fence_chan * 48 42 nouveau_fctx(struct nouveau_fence *fence) 49 43 { ··· 71 77 fence->ops != &nouveau_fence_ops_uevent) 72 78 return NULL; 73 79 74 - return from_fence(fence); 80 + return to_nouveau_fence(fence); 75 81 } 76 82 77 83 void ··· 262 268 static long 263 269 nouveau_fence_wait_legacy(struct dma_fence *f, bool intr, long wait) 264 270 { 265 - struct nouveau_fence *fence = from_fence(f); 271 + struct nouveau_fence *fence = to_nouveau_fence(f); 266 272 unsigned long sleep_time = NSEC_PER_MSEC / 1000; 267 273 unsigned long t = jiffies, timeout = t + wait; 268 274 ··· 442 448 443 449 static const char *nouveau_fence_get_timeline_name(struct dma_fence *f) 444 450 { 445 - struct nouveau_fence *fence = from_fence(f); 451 + struct nouveau_fence *fence = to_nouveau_fence(f); 446 452 struct nouveau_fence_chan *fctx = nouveau_fctx(fence); 447 453 448 454 return !fctx->dead ? fctx->name : "dead channel"; ··· 456 462 */ 457 463 static bool nouveau_fence_is_signaled(struct dma_fence *f) 458 464 { 459 - struct nouveau_fence *fence = from_fence(f); 465 + struct nouveau_fence *fence = to_nouveau_fence(f); 460 466 struct nouveau_fence_chan *fctx = nouveau_fctx(fence); 461 467 struct nouveau_channel *chan; 462 468 bool ret = false; ··· 472 478 473 479 static bool nouveau_fence_no_signaling(struct dma_fence *f) 474 480 { 475 - struct nouveau_fence *fence = from_fence(f); 481 + struct nouveau_fence *fence = to_nouveau_fence(f); 476 482 477 483 /* 478 484 * caller should have a reference on the fence, ··· 497 503 498 504 static void nouveau_fence_release(struct dma_fence *f) 499 505 { 500 - struct nouveau_fence *fence = from_fence(f); 506 + struct nouveau_fence *fence = to_nouveau_fence(f); 501 507 struct nouveau_fence_chan *fctx = nouveau_fctx(fence); 502 508 503 509 kref_put(&fctx->fence_ref, nouveau_fence_context_put); ··· 515 521 516 522 static bool nouveau_fence_enable_signaling(struct dma_fence *f) 517 523 { 518 - struct nouveau_fence *fence = from_fence(f); 524 + struct nouveau_fence *fence = to_nouveau_fence(f); 519 525 struct nouveau_fence_chan *fctx = nouveau_fctx(fence); 520 526 bool ret; 521 527
+6
drivers/gpu/drm/nouveau/nouveau_fence.h
··· 17 17 unsigned long timeout; 18 18 }; 19 19 20 + static inline struct nouveau_fence * 21 + to_nouveau_fence(struct dma_fence *fence) 22 + { 23 + return container_of(fence, struct nouveau_fence, base); 24 + } 25 + 20 26 int nouveau_fence_create(struct nouveau_fence **, struct nouveau_channel *); 21 27 int nouveau_fence_new(struct nouveau_fence **, struct nouveau_channel *); 22 28 void nouveau_fence_unref(struct nouveau_fence **);