Commit 3b856748 authored by Jani Nikula's avatar Jani Nikula
Browse files

drm/i915: use INTEL_WAKEREF_DEF instead of magic -1 for intel_wakeref_t



A number of places rely on the magic -1 to denote
INTEL_WAKEREF_DEF. Switch to the macro. Define it for xe as well.

Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/57e5f1989113be4d63386478d9438cfc35a2a1f7.1726680898.git.jani.nikula@intel.com


Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 4c1bfe25
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -895,7 +895,7 @@ intel_display_power_put_mask_in_set(struct drm_i915_private *i915,
		    !bitmap_subset(mask->bits, power_domain_set->mask.bits, POWER_DOMAIN_NUM));

	for_each_power_domain(domain, mask) {
		intel_wakeref_t __maybe_unused wf = -1;
		intel_wakeref_t __maybe_unused wf = INTEL_WAKEREF_DEF;

#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
		wf = fetch_and_zero(&power_domain_set->wakerefs[domain]);
+2 −2
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ intel_display_power_put_async(struct drm_i915_private *i915,
			      enum intel_display_power_domain domain,
			      intel_wakeref_t wakeref)
{
	__intel_display_power_put_async(i915, domain, -1, -1);
	__intel_display_power_put_async(i915, domain, INTEL_WAKEREF_DEF, -1);
}

static inline void
@@ -241,7 +241,7 @@ intel_display_power_put_async_delay(struct drm_i915_private *i915,
				    intel_wakeref_t wakeref,
				    int delay_ms)
{
	__intel_display_power_put_async(i915, domain, -1, delay_ms);
	__intel_display_power_put_async(i915, domain, INTEL_WAKEREF_DEF, delay_ms);
}
#endif

+3 −3
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ static intel_wakeref_t
track_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm)
{
	if (!rpm->available || rpm->no_wakeref_tracking)
		return -1;
		return INTEL_WAKEREF_DEF;

	return intel_ref_tracker_alloc(&rpm->debug);
}
@@ -114,7 +114,7 @@ static void init_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm)
static intel_wakeref_t
track_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm)
{
	return -1;
	return INTEL_WAKEREF_DEF;
}

static void untrack_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm,
@@ -336,7 +336,7 @@ intel_runtime_pm_put_raw(struct intel_runtime_pm *rpm, intel_wakeref_t wref)
 */
void intel_runtime_pm_put_unchecked(struct intel_runtime_pm *rpm)
{
	__intel_runtime_pm_put(rpm, -1, true);
	__intel_runtime_pm_put(rpm, INTEL_WAKEREF_DEF, true);
}

#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
+1 −1
Original line number Diff line number Diff line
@@ -314,7 +314,7 @@ static inline void intel_wakeref_untrack(struct intel_wakeref *wf,

static inline intel_wakeref_t intel_wakeref_track(struct intel_wakeref *wf)
{
	return -1;
	return INTEL_WAKEREF_DEF;
}

static inline void intel_wakeref_untrack(struct intel_wakeref *wf,
+4 −3
Original line number Diff line number Diff line
@@ -24,14 +24,14 @@ static inline intel_wakeref_t intel_runtime_pm_get(struct xe_runtime_pm *pm)
{
	struct xe_device *xe = container_of(pm, struct xe_device, runtime_pm);

	return xe_pm_runtime_resume_and_get(xe);
	return xe_pm_runtime_resume_and_get(xe) ? INTEL_WAKEREF_DEF : 0;
}

static inline intel_wakeref_t intel_runtime_pm_get_if_in_use(struct xe_runtime_pm *pm)
{
	struct xe_device *xe = container_of(pm, struct xe_device, runtime_pm);

	return xe_pm_runtime_get_if_in_use(xe);
	return xe_pm_runtime_get_if_in_use(xe) ? INTEL_WAKEREF_DEF : 0;
}

static inline intel_wakeref_t intel_runtime_pm_get_noresume(struct xe_runtime_pm *pm)
@@ -39,7 +39,8 @@ static inline intel_wakeref_t intel_runtime_pm_get_noresume(struct xe_runtime_pm
	struct xe_device *xe = container_of(pm, struct xe_device, runtime_pm);

	xe_pm_runtime_get_noresume(xe);
	return true;

	return INTEL_WAKEREF_DEF;
}

static inline void intel_runtime_pm_put_unchecked(struct xe_runtime_pm *pm)
Loading