diff mbox series

[3/3] drm/i915/pmu: rearrange hrtimer pointer chasing

Message ID 20231023150256.438331-3-jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/3] drm/i915/pmu: add pmu_to_i915() helper | expand

Commit Message

Jani Nikula Oct. 23, 2023, 3:02 p.m. UTC
Do the logical step of first getting from struct hrtimer to struct
i915_pmu, and then from struct i915_pmu to struct drm_i915_private,
instead of hrtimer->i915->pmu.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/i915_pmu.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Andi Shyti Oct. 24, 2023, 12:30 p.m. UTC | #1
Hi Jani,

On Mon, Oct 23, 2023 at 06:02:56PM +0300, Jani Nikula wrote:
> Do the logical step of first getting from struct hrtimer to struct
> i915_pmu, and then from struct i915_pmu to struct drm_i915_private,
> instead of hrtimer->i915->pmu.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>

Andi
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index d45b40ec6d47..2a24eacd1b40 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -478,9 +478,8 @@  frequency_sample(struct intel_gt *gt, unsigned int period_ns)
 
 static enum hrtimer_restart i915_sample(struct hrtimer *hrtimer)
 {
-	struct drm_i915_private *i915 =
-		container_of(hrtimer, struct drm_i915_private, pmu.timer);
-	struct i915_pmu *pmu = &i915->pmu;
+	struct i915_pmu *pmu = container_of(hrtimer, struct i915_pmu, timer);
+	struct drm_i915_private *i915 = pmu_to_i915(pmu);
 	unsigned int period_ns;
 	struct intel_gt *gt;
 	unsigned int i;