5050 * present for a given platform.
5151 */
5252
53+ static struct drm_i915_private * rpm_to_i915 (struct intel_runtime_pm * rpm )
54+ {
55+ return container_of (rpm , struct drm_i915_private , runtime_pm );
56+ }
57+
5358#if IS_ENABLED (CONFIG_DRM_I915_DEBUG_RUNTIME_PM )
5459
5560#include <linux/sort.h>
@@ -349,9 +354,7 @@ intel_runtime_pm_release(struct intel_runtime_pm *rpm, int wakelock)
349354static intel_wakeref_t __intel_runtime_pm_get (struct intel_runtime_pm * rpm ,
350355 bool wakelock )
351356{
352- struct drm_i915_private * i915 = container_of (rpm ,
353- struct drm_i915_private ,
354- runtime_pm );
357+ struct drm_i915_private * i915 = rpm_to_i915 (rpm );
355358 int ret ;
356359
357360 ret = pm_runtime_get_sync (rpm -> kdev );
@@ -556,9 +559,7 @@ void intel_runtime_pm_put(struct intel_runtime_pm *rpm, intel_wakeref_t wref)
556559 */
557560void intel_runtime_pm_enable (struct intel_runtime_pm * rpm )
558561{
559- struct drm_i915_private * i915 = container_of (rpm ,
560- struct drm_i915_private ,
561- runtime_pm );
562+ struct drm_i915_private * i915 = rpm_to_i915 (rpm );
562563 struct device * kdev = rpm -> kdev ;
563564
564565 /*
@@ -611,9 +612,7 @@ void intel_runtime_pm_enable(struct intel_runtime_pm *rpm)
611612
612613void intel_runtime_pm_disable (struct intel_runtime_pm * rpm )
613614{
614- struct drm_i915_private * i915 = container_of (rpm ,
615- struct drm_i915_private ,
616- runtime_pm );
615+ struct drm_i915_private * i915 = rpm_to_i915 (rpm );
617616 struct device * kdev = rpm -> kdev ;
618617
619618 /* Transfer rpm ownership back to core */
@@ -628,9 +627,7 @@ void intel_runtime_pm_disable(struct intel_runtime_pm *rpm)
628627
629628void intel_runtime_pm_driver_release (struct intel_runtime_pm * rpm )
630629{
631- struct drm_i915_private * i915 = container_of (rpm ,
632- struct drm_i915_private ,
633- runtime_pm );
630+ struct drm_i915_private * i915 = rpm_to_i915 (rpm );
634631 int count = atomic_read (& rpm -> wakeref_count );
635632
636633 intel_wakeref_auto_fini (& rpm -> userfault_wakeref );
@@ -645,8 +642,7 @@ void intel_runtime_pm_driver_release(struct intel_runtime_pm *rpm)
645642
646643void intel_runtime_pm_init_early (struct intel_runtime_pm * rpm )
647644{
648- struct drm_i915_private * i915 =
649- container_of (rpm , struct drm_i915_private , runtime_pm );
645+ struct drm_i915_private * i915 = rpm_to_i915 (rpm );
650646 struct pci_dev * pdev = to_pci_dev (i915 -> drm .dev );
651647 struct device * kdev = & pdev -> dev ;
652648
0 commit comments