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

drm/i915: Introduce to_gt() helper

To allow further refactoring and abstract away the fact that GT is
stored inside i915 private.
No functional changes.

Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211214193346.21231-3-andi.shyti@linux.intel.com

authored by

Michał Winiarski and committed by
Matt Roper
c0f0dab8 030def2c

+6 -6
+1 -6
drivers/gpu/drm/i915/gt/intel_gt_buffer_pool.c
··· 9 9 #include "intel_engine_pm.h" 10 10 #include "intel_gt_buffer_pool.h" 11 11 12 - static struct intel_gt *to_gt(struct intel_gt_buffer_pool *pool) 13 - { 14 - return container_of(pool, struct intel_gt, buffer_pool); 15 - } 16 - 17 12 static struct list_head * 18 13 bucket_for_size(struct intel_gt_buffer_pool *pool, size_t sz) 19 14 { ··· 136 141 node_create(struct intel_gt_buffer_pool *pool, size_t sz, 137 142 enum i915_map_type type) 138 143 { 139 - struct intel_gt *gt = to_gt(pool); 144 + struct intel_gt *gt = container_of(pool, struct intel_gt, buffer_pool); 140 145 struct intel_gt_buffer_pool_node *node; 141 146 struct drm_i915_gem_object *obj; 142 147
+5
drivers/gpu/drm/i915/i915_drv.h
··· 1268 1268 return pci_get_drvdata(pdev); 1269 1269 } 1270 1270 1271 + static inline struct intel_gt *to_gt(struct drm_i915_private *i915) 1272 + { 1273 + return &i915->gt; 1274 + } 1275 + 1271 1276 /* Simple iterator over all initialised engines */ 1272 1277 #define for_each_engine(engine__, dev_priv__, id__) \ 1273 1278 for ((id__) = 0; \