intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH] drm/i915/rpm: add rpm_to_i915() helper around container_of()
@ 2023-12-05 12:15 Jani Nikula
  2023-12-05 13:30 ` Rodrigo Vivi
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jani Nikula @ 2023-12-05 12:15 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula

Reduce the duplication.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_runtime_pm.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
index 91491111dbd5..860b51b56a92 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.c
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
@@ -50,6 +50,11 @@
  * present for a given platform.
  */
 
+static struct drm_i915_private *rpm_to_i915(struct intel_runtime_pm *rpm)
+{
+	return container_of(rpm, struct drm_i915_private, runtime_pm);
+}
+
 #if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
 
 static void init_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm)
@@ -158,9 +163,7 @@ intel_runtime_pm_release(struct intel_runtime_pm *rpm, int wakelock)
 static intel_wakeref_t __intel_runtime_pm_get(struct intel_runtime_pm *rpm,
 					      bool wakelock)
 {
-	struct drm_i915_private *i915 = container_of(rpm,
-						     struct drm_i915_private,
-						     runtime_pm);
+	struct drm_i915_private *i915 = rpm_to_i915(rpm);
 	int ret;
 
 	ret = pm_runtime_get_sync(rpm->kdev);
@@ -365,9 +368,7 @@ void intel_runtime_pm_put(struct intel_runtime_pm *rpm, intel_wakeref_t wref)
  */
 void intel_runtime_pm_enable(struct intel_runtime_pm *rpm)
 {
-	struct drm_i915_private *i915 = container_of(rpm,
-						     struct drm_i915_private,
-						     runtime_pm);
+	struct drm_i915_private *i915 = rpm_to_i915(rpm);
 	struct device *kdev = rpm->kdev;
 
 	/*
@@ -420,9 +421,7 @@ void intel_runtime_pm_enable(struct intel_runtime_pm *rpm)
 
 void intel_runtime_pm_disable(struct intel_runtime_pm *rpm)
 {
-	struct drm_i915_private *i915 = container_of(rpm,
-						     struct drm_i915_private,
-						     runtime_pm);
+	struct drm_i915_private *i915 = rpm_to_i915(rpm);
 	struct device *kdev = rpm->kdev;
 
 	/* Transfer rpm ownership back to core */
@@ -437,9 +436,7 @@ void intel_runtime_pm_disable(struct intel_runtime_pm *rpm)
 
 void intel_runtime_pm_driver_release(struct intel_runtime_pm *rpm)
 {
-	struct drm_i915_private *i915 = container_of(rpm,
-						     struct drm_i915_private,
-						     runtime_pm);
+	struct drm_i915_private *i915 = rpm_to_i915(rpm);
 	int count = atomic_read(&rpm->wakeref_count);
 
 	intel_wakeref_auto_fini(&rpm->userfault_wakeref);
@@ -458,8 +455,7 @@ void intel_runtime_pm_driver_last_release(struct intel_runtime_pm *rpm)
 
 void intel_runtime_pm_init_early(struct intel_runtime_pm *rpm)
 {
-	struct drm_i915_private *i915 =
-			container_of(rpm, struct drm_i915_private, runtime_pm);
+	struct drm_i915_private *i915 = rpm_to_i915(rpm);
 	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
 	struct device *kdev = &pdev->dev;
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915/rpm: add rpm_to_i915() helper around container_of()
  2023-12-05 12:15 [Intel-gfx] [PATCH] drm/i915/rpm: add rpm_to_i915() helper around container_of() Jani Nikula
@ 2023-12-05 13:30 ` Rodrigo Vivi
  2023-12-07 10:53   ` Jani Nikula
  2023-12-05 14:24 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
  2023-12-06 13:03 ` [Intel-gfx] [PATCH] " Gustavo Sousa
  2 siblings, 1 reply; 6+ messages in thread
From: Rodrigo Vivi @ 2023-12-05 13:30 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

On Tue, Dec 05, 2023 at 02:15:45PM +0200, Jani Nikula wrote:
> Reduce the duplication.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_runtime_pm.c | 24 ++++++++++--------------
>  1 file changed, 10 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
> index 91491111dbd5..860b51b56a92 100644
> --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -50,6 +50,11 @@
>   * present for a given platform.
>   */
>  
> +static struct drm_i915_private *rpm_to_i915(struct intel_runtime_pm *rpm)
> +{
> +	return container_of(rpm, struct drm_i915_private, runtime_pm);
> +}
> +
>  #if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
>  
>  static void init_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm)
> @@ -158,9 +163,7 @@ intel_runtime_pm_release(struct intel_runtime_pm *rpm, int wakelock)
>  static intel_wakeref_t __intel_runtime_pm_get(struct intel_runtime_pm *rpm,
>  					      bool wakelock)
>  {
> -	struct drm_i915_private *i915 = container_of(rpm,
> -						     struct drm_i915_private,
> -						     runtime_pm);
> +	struct drm_i915_private *i915 = rpm_to_i915(rpm);
>  	int ret;
>  
>  	ret = pm_runtime_get_sync(rpm->kdev);
> @@ -365,9 +368,7 @@ void intel_runtime_pm_put(struct intel_runtime_pm *rpm, intel_wakeref_t wref)
>   */
>  void intel_runtime_pm_enable(struct intel_runtime_pm *rpm)
>  {
> -	struct drm_i915_private *i915 = container_of(rpm,
> -						     struct drm_i915_private,
> -						     runtime_pm);
> +	struct drm_i915_private *i915 = rpm_to_i915(rpm);
>  	struct device *kdev = rpm->kdev;
>  
>  	/*
> @@ -420,9 +421,7 @@ void intel_runtime_pm_enable(struct intel_runtime_pm *rpm)
>  
>  void intel_runtime_pm_disable(struct intel_runtime_pm *rpm)
>  {
> -	struct drm_i915_private *i915 = container_of(rpm,
> -						     struct drm_i915_private,
> -						     runtime_pm);
> +	struct drm_i915_private *i915 = rpm_to_i915(rpm);
>  	struct device *kdev = rpm->kdev;
>  
>  	/* Transfer rpm ownership back to core */
> @@ -437,9 +436,7 @@ void intel_runtime_pm_disable(struct intel_runtime_pm *rpm)
>  
>  void intel_runtime_pm_driver_release(struct intel_runtime_pm *rpm)
>  {
> -	struct drm_i915_private *i915 = container_of(rpm,
> -						     struct drm_i915_private,
> -						     runtime_pm);
> +	struct drm_i915_private *i915 = rpm_to_i915(rpm);
>  	int count = atomic_read(&rpm->wakeref_count);
>  
>  	intel_wakeref_auto_fini(&rpm->userfault_wakeref);
> @@ -458,8 +455,7 @@ void intel_runtime_pm_driver_last_release(struct intel_runtime_pm *rpm)
>  
>  void intel_runtime_pm_init_early(struct intel_runtime_pm *rpm)
>  {
> -	struct drm_i915_private *i915 =
> -			container_of(rpm, struct drm_i915_private, runtime_pm);
> +	struct drm_i915_private *i915 = rpm_to_i915(rpm);
>  	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
>  	struct device *kdev = &pdev->dev;
>  
> -- 
> 2.39.2
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/rpm: add rpm_to_i915() helper around container_of()
  2023-12-05 12:15 [Intel-gfx] [PATCH] drm/i915/rpm: add rpm_to_i915() helper around container_of() Jani Nikula
  2023-12-05 13:30 ` Rodrigo Vivi
@ 2023-12-05 14:24 ` Patchwork
  2023-12-06 13:03 ` [Intel-gfx] [PATCH] " Gustavo Sousa
  2 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2023-12-05 14:24 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

[-- Attachment #1: Type: text/plain, Size: 9569 bytes --]

== Series Details ==

Series: drm/i915/rpm: add rpm_to_i915() helper around container_of()
URL   : https://patchwork.freedesktop.org/series/127353/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_13981 -> Patchwork_127353v1
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_127353v1 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_127353v1, please notify your bug team (I915-ci-infra@lists.freedesktop.org) to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/index.html

Participating hosts (35 -> 35)
------------------------------

  Additional (2): bat-kbl-2 bat-atsm-1 
  Missing    (2): bat-adlp-11 fi-snb-2520m 

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_127353v1:

### IGT changes ###

#### Possible regressions ####

  * igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence:
    - bat-adlp-9:         NOTRUN -> [SKIP][1] +2 other tests skip
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-adlp-9/igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence.html

  
#### Warnings ####

  * igt@kms_pipe_crc_basic@nonblocking-crc:
    - bat-mtlp-6:         [SKIP][2] ([i915#4078]) -> [SKIP][3] +3 other tests skip
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13981/bat-mtlp-6/igt@kms_pipe_crc_basic@nonblocking-crc.html
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-mtlp-6/igt@kms_pipe_crc_basic@nonblocking-crc.html

  
Known issues
------------

  Here are the changes found in Patchwork_127353v1 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@core_hotunplug@unbind-rebind:
    - bat-kbl-2:          NOTRUN -> [ABORT][4] ([i915#9793])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-kbl-2/igt@core_hotunplug@unbind-rebind.html
    - bat-atsm-1:         NOTRUN -> [ABORT][5] ([i915#8213])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@core_hotunplug@unbind-rebind.html

  * igt@fbdev@info:
    - bat-kbl-2:          NOTRUN -> [SKIP][6] ([fdo#109271] / [i915#1849])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-kbl-2/igt@fbdev@info.html

  * igt@gem_mmap@basic:
    - bat-atsm-1:         NOTRUN -> [SKIP][7] ([i915#4083])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@gem_mmap@basic.html

  * igt@gem_tiled_fence_blits@basic:
    - bat-atsm-1:         NOTRUN -> [SKIP][8] ([i915#4077]) +2 other tests skip
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@gem_tiled_fence_blits@basic.html

  * igt@gem_tiled_pread_basic:
    - bat-atsm-1:         NOTRUN -> [SKIP][9] ([i915#4079]) +1 other test skip
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@gem_tiled_pread_basic.html

  * igt@i915_pm_rps@basic-api:
    - bat-atsm-1:         NOTRUN -> [SKIP][10] ([i915#6621])
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@i915_pm_rps@basic-api.html

  * igt@kms_addfb_basic@size-max:
    - bat-atsm-1:         NOTRUN -> [SKIP][11] ([i915#6077]) +36 other tests skip
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@kms_addfb_basic@size-max.html

  * igt@kms_addfb_basic@tile-pitch-mismatch:
    - bat-atsm-1:         NOTRUN -> [SKIP][12] ([i915#5608] / [i915#6077])
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@kms_addfb_basic@tile-pitch-mismatch.html

  * igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
    - bat-atsm-1:         NOTRUN -> [SKIP][13] ([i915#5608] / [i915#6078]) +1 other test skip
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy.html

  * igt@kms_cursor_legacy@basic-flip-after-cursor-atomic:
    - bat-atsm-1:         NOTRUN -> [SKIP][14] ([i915#6078]) +19 other tests skip
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@kms_cursor_legacy@basic-flip-after-cursor-atomic.html

  * igt@kms_force_connector_basic@prune-stale-modes:
    - bat-atsm-1:         NOTRUN -> [SKIP][15] ([i915#6093]) +4 other tests skip
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@kms_force_connector_basic@prune-stale-modes.html

  * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-xr24:
    - bat-atsm-1:         NOTRUN -> [SKIP][16] ([i915#1836]) +6 other tests skip
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@kms_pipe_crc_basic@compare-crc-sanitycheck-xr24.html

  * igt@kms_pipe_crc_basic@nonblocking-crc:
    - bat-dg2-11:         NOTRUN -> [SKIP][17] ([i915#9197])
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-dg2-11/igt@kms_pipe_crc_basic@nonblocking-crc.html

  * igt@kms_pm_backlight@basic-brightness@edp-1:
    - bat-rplp-1:         NOTRUN -> [ABORT][18] ([i915#8668])
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-rplp-1/igt@kms_pm_backlight@basic-brightness@edp-1.html

  * igt@kms_prop_blob@basic:
    - bat-atsm-1:         NOTRUN -> [SKIP][19] ([i915#7357])
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@kms_prop_blob@basic.html

  * igt@kms_psr@psr_primary_mmap_gtt:
    - bat-kbl-2:          NOTRUN -> [SKIP][20] ([fdo#109271]) +35 other tests skip
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-kbl-2/igt@kms_psr@psr_primary_mmap_gtt.html

  * igt@kms_setmode@basic-clone-single-crtc:
    - bat-atsm-1:         NOTRUN -> [SKIP][21] ([i915#6094])
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@kms_setmode@basic-clone-single-crtc.html

  * igt@prime_vgem@basic-fence-flip:
    - bat-atsm-1:         NOTRUN -> [SKIP][22] ([fdo#109295] / [i915#6078])
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@prime_vgem@basic-fence-flip.html

  * igt@prime_vgem@basic-fence-mmap:
    - bat-atsm-1:         NOTRUN -> [SKIP][23] ([fdo#109295] / [i915#4077]) +1 other test skip
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@prime_vgem@basic-fence-mmap.html

  * igt@prime_vgem@basic-write:
    - bat-atsm-1:         NOTRUN -> [SKIP][24] ([fdo#109295]) +2 other tests skip
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@prime_vgem@basic-write.html

  
#### Possible fixes ####

  * igt@kms_hdmi_inject@inject-audio:
    - fi-kbl-guc:         [FAIL][25] ([IGT#3]) -> [PASS][26]
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13981/fi-kbl-guc/igt@kms_hdmi_inject@inject-audio.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/fi-kbl-guc/igt@kms_hdmi_inject@inject-audio.html

  * igt@kms_pipe_crc_basic@read-crc-frame-sequence@pipe-d-edp-1:
    - bat-rplp-1:         [ABORT][27] ([i915#8668]) -> [PASS][28]
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13981/bat-rplp-1/igt@kms_pipe_crc_basic@read-crc-frame-sequence@pipe-d-edp-1.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-rplp-1/igt@kms_pipe_crc_basic@read-crc-frame-sequence@pipe-d-edp-1.html

  
  [IGT#3]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/3
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
  [i915#1836]: https://gitlab.freedesktop.org/drm/intel/issues/1836
  [i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
  [i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
  [i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
  [i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
  [i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
  [i915#5608]: https://gitlab.freedesktop.org/drm/intel/issues/5608
  [i915#6077]: https://gitlab.freedesktop.org/drm/intel/issues/6077
  [i915#6078]: https://gitlab.freedesktop.org/drm/intel/issues/6078
  [i915#6093]: https://gitlab.freedesktop.org/drm/intel/issues/6093
  [i915#6094]: https://gitlab.freedesktop.org/drm/intel/issues/6094
  [i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
  [i915#7357]: https://gitlab.freedesktop.org/drm/intel/issues/7357
  [i915#8213]: https://gitlab.freedesktop.org/drm/intel/issues/8213
  [i915#8668]: https://gitlab.freedesktop.org/drm/intel/issues/8668
  [i915#9197]: https://gitlab.freedesktop.org/drm/intel/issues/9197
  [i915#9793]: https://gitlab.freedesktop.org/drm/intel/issues/9793


Build changes
-------------

  * Linux: CI_DRM_13981 -> Patchwork_127353v1

  CI-20190529: 20190529
  CI_DRM_13981: aaf3a2f69283b9783afb92c0aa5463f7176d20dd @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_7620: 6714b814e7f82743abf45c33361fbe057a22880a @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  Patchwork_127353v1: aaf3a2f69283b9783afb92c0aa5463f7176d20dd @ git://anongit.freedesktop.org/gfx-ci/linux


### Linux commits

ed47c0223cf8 drm/i915/rpm: add rpm_to_i915() helper around container_of()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/index.html

[-- Attachment #2: Type: text/html, Size: 11420 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915/rpm: add rpm_to_i915() helper around container_of()
  2023-12-05 12:15 [Intel-gfx] [PATCH] drm/i915/rpm: add rpm_to_i915() helper around container_of() Jani Nikula
  2023-12-05 13:30 ` Rodrigo Vivi
  2023-12-05 14:24 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
@ 2023-12-06 13:03 ` Gustavo Sousa
  2023-12-07 11:16   ` Jani Nikula
  2 siblings, 1 reply; 6+ messages in thread
From: Gustavo Sousa @ 2023-12-06 13:03 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx; +Cc: jani.nikula

Quoting Jani Nikula (2023-12-05 09:15:45-03:00)
>Reduce the duplication.

By the way, is it too ambitious to dream of a to_i915() using generics?

--
Gustavo Sousa

>
>Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>---
> drivers/gpu/drm/i915/intel_runtime_pm.c | 24 ++++++++++--------------
> 1 file changed, 10 insertions(+), 14 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
>index 91491111dbd5..860b51b56a92 100644
>--- a/drivers/gpu/drm/i915/intel_runtime_pm.c
>+++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
>@@ -50,6 +50,11 @@
>  * present for a given platform.
>  */
> 
>+static struct drm_i915_private *rpm_to_i915(struct intel_runtime_pm *rpm)
>+{
>+        return container_of(rpm, struct drm_i915_private, runtime_pm);
>+}
>+
> #if IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
> 
> static void init_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm)
>@@ -158,9 +163,7 @@ intel_runtime_pm_release(struct intel_runtime_pm *rpm, int wakelock)
> static intel_wakeref_t __intel_runtime_pm_get(struct intel_runtime_pm *rpm,
>                                               bool wakelock)
> {
>-        struct drm_i915_private *i915 = container_of(rpm,
>-                                                     struct drm_i915_private,
>-                                                     runtime_pm);
>+        struct drm_i915_private *i915 = rpm_to_i915(rpm);
>         int ret;
> 
>         ret = pm_runtime_get_sync(rpm->kdev);
>@@ -365,9 +368,7 @@ void intel_runtime_pm_put(struct intel_runtime_pm *rpm, intel_wakeref_t wref)
>  */
> void intel_runtime_pm_enable(struct intel_runtime_pm *rpm)
> {
>-        struct drm_i915_private *i915 = container_of(rpm,
>-                                                     struct drm_i915_private,
>-                                                     runtime_pm);
>+        struct drm_i915_private *i915 = rpm_to_i915(rpm);
>         struct device *kdev = rpm->kdev;
> 
>         /*
>@@ -420,9 +421,7 @@ void intel_runtime_pm_enable(struct intel_runtime_pm *rpm)
> 
> void intel_runtime_pm_disable(struct intel_runtime_pm *rpm)
> {
>-        struct drm_i915_private *i915 = container_of(rpm,
>-                                                     struct drm_i915_private,
>-                                                     runtime_pm);
>+        struct drm_i915_private *i915 = rpm_to_i915(rpm);
>         struct device *kdev = rpm->kdev;
> 
>         /* Transfer rpm ownership back to core */
>@@ -437,9 +436,7 @@ void intel_runtime_pm_disable(struct intel_runtime_pm *rpm)
> 
> void intel_runtime_pm_driver_release(struct intel_runtime_pm *rpm)
> {
>-        struct drm_i915_private *i915 = container_of(rpm,
>-                                                     struct drm_i915_private,
>-                                                     runtime_pm);
>+        struct drm_i915_private *i915 = rpm_to_i915(rpm);
>         int count = atomic_read(&rpm->wakeref_count);
> 
>         intel_wakeref_auto_fini(&rpm->userfault_wakeref);
>@@ -458,8 +455,7 @@ void intel_runtime_pm_driver_last_release(struct intel_runtime_pm *rpm)
> 
> void intel_runtime_pm_init_early(struct intel_runtime_pm *rpm)
> {
>-        struct drm_i915_private *i915 =
>-                        container_of(rpm, struct drm_i915_private, runtime_pm);
>+        struct drm_i915_private *i915 = rpm_to_i915(rpm);
>         struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
>         struct device *kdev = &pdev->dev;
> 
>-- 
>2.39.2
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915/rpm: add rpm_to_i915() helper around container_of()
  2023-12-05 13:30 ` Rodrigo Vivi
@ 2023-12-07 10:53   ` Jani Nikula
  0 siblings, 0 replies; 6+ messages in thread
From: Jani Nikula @ 2023-12-07 10:53 UTC (permalink / raw)
  To: Rodrigo Vivi; +Cc: intel-gfx

On Tue, 05 Dec 2023, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> On Tue, Dec 05, 2023 at 02:15:45PM +0200, Jani Nikula wrote:
>> Reduce the duplication.
>> 
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

Thanks, pushed to din.

BR,
Jani.


-- 
Jani Nikula, Intel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915/rpm: add rpm_to_i915() helper around container_of()
  2023-12-06 13:03 ` [Intel-gfx] [PATCH] " Gustavo Sousa
@ 2023-12-07 11:16   ` Jani Nikula
  0 siblings, 0 replies; 6+ messages in thread
From: Jani Nikula @ 2023-12-07 11:16 UTC (permalink / raw)
  To: Gustavo Sousa, intel-gfx; +Cc: Daniel Vetter, Dave Airlie

On Wed, 06 Dec 2023, Gustavo Sousa <gustavo.sousa@intel.com> wrote:
> Quoting Jani Nikula (2023-12-05 09:15:45-03:00)
>>Reduce the duplication.
>
> By the way, is it too ambitious to dream of a to_i915() using generics?

I'm not fundamentally opposed, but there are a few open questions here.

_Generic() has been slowly cropping up since commit e8c07082a810
("Kbuild: move to -std=gnu11"). Well, maybe even before that in some
cases. But there are only 30 or so users. I'm kind of uneasy about going
"all in" with it in this fashion before there's more general approval
that it's fine. Dave, Sima, thoughts?

The other thing is that with i915 and xe display integration, we're not
sure yet where it'll go. It's possible the display code will cease to
use i915 and switch to some other device struct. See [1] for some draft
ideas. At least for display code, I'd prefer not embarking on this kind
of changes yet so we don't have to churn many times in a row.


BR,
Jani.


[1] https://patchwork.freedesktop.org/series/124286/


-- 
Jani Nikula, Intel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-12-07 11:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-05 12:15 [Intel-gfx] [PATCH] drm/i915/rpm: add rpm_to_i915() helper around container_of() Jani Nikula
2023-12-05 13:30 ` Rodrigo Vivi
2023-12-07 10:53   ` Jani Nikula
2023-12-05 14:24 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
2023-12-06 13:03 ` [Intel-gfx] [PATCH] " Gustavo Sousa
2023-12-07 11:16   ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).