]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe/stolen: convert compat stolen macros to inline functions
authorJani Nikula <jani.nikula@intel.com>
Wed, 24 Sep 2025 16:43:32 +0000 (19:43 +0300)
committerJani Nikula <jani.nikula@intel.com>
Mon, 29 Sep 2025 09:41:30 +0000 (12:41 +0300)
Improve type safety. Allows getting rid of a __maybe_unused annotation
too.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/1ec1fa59e0e54da49a1ec4fd1d535288066db502.1758732183.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_fbc.c
drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_stolen.h

index 6a7357fa89dbc7be9cbf09d14d3c3638ef795a4d..cc67de6c06cff62f3342c49aad294de9f0c8910f 100644 (file)
@@ -797,7 +797,7 @@ static u64 intel_fbc_cfb_base_max(struct intel_display *display)
 
 static u64 intel_fbc_stolen_end(struct intel_display *display)
 {
-       struct drm_i915_private __maybe_unused *i915 = to_i915(display->drm);
+       struct drm_i915_private *i915 = to_i915(display->drm);
        u64 end;
 
        /* The FBC hardware for BDW/SKL doesn't have access to the stolen
index b45575b1532276cef5cc4ebbad8ff07577aa5c69..2c77457837e49a96ecbca1361cf739e31fac61f0 100644 (file)
@@ -62,8 +62,15 @@ static inline void i915_gem_stolen_remove_node(struct xe_device *xe,
        node->bo = NULL;
 }
 
-#define i915_gem_stolen_initialized(xe) (!!ttm_manager_type(&(xe)->ttm, XE_PL_STOLEN))
-#define i915_gem_stolen_node_allocated(node) (!!((node)->bo))
+static inline bool i915_gem_stolen_initialized(struct xe_device *xe)
+{
+       return ttm_manager_type(&xe->ttm, XE_PL_STOLEN);
+}
+
+static inline bool i915_gem_stolen_node_allocated(const struct intel_stolen_node *node)
+{
+       return node->bo;
+}
 
 static inline u32 i915_gem_stolen_node_offset(struct intel_stolen_node *node)
 {
@@ -74,12 +81,30 @@ static inline u32 i915_gem_stolen_node_offset(struct intel_stolen_node *node)
 }
 
 /* Used for < gen4. These are not supported by Xe */
-#define i915_gem_stolen_area_address(xe) (!WARN_ON(1))
+static inline u64 i915_gem_stolen_area_address(const struct xe_device *xe)
+{
+       WARN_ON(1);
+
+       return 0;
+}
+
 /* Used for gen9 specific WA. Gen9 is not supported by Xe */
-#define i915_gem_stolen_area_size(xe) (!WARN_ON(1))
+static inline u64 i915_gem_stolen_area_size(const struct xe_device *xe)
+{
+       WARN_ON(1);
+
+       return 0;
+}
 
-#define i915_gem_stolen_node_address(xe, node) (xe_ttm_stolen_gpu_offset(xe) + \
-                                        i915_gem_stolen_node_offset(node))
-#define i915_gem_stolen_node_size(node) ((u64)((node)->bo->ttm.base.size))
+static inline u64 i915_gem_stolen_node_address(struct xe_device *xe,
+                                              struct intel_stolen_node *node)
+{
+       return xe_ttm_stolen_gpu_offset(xe) + i915_gem_stolen_node_offset(node);
+}
+
+static inline u64 i915_gem_stolen_node_size(const struct intel_stolen_node *node)
+{
+       return node->bo->ttm.base.size;
+}
 
 #endif