drm/i915/rpm: add rpm_to_i915() helper around container_of()
Subsystems (2)
PATCH 1/1 drm/i915/rpm: add rpm_to_i915() helper around container_of()
Reduce the duplication.
--- drivers/gpu/drm/i915/intel_runtime_pm.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_runtime_pm.c +10 -14
@@ -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;
Signature · 1 line
2.39.2
Quoted 3 lines · Jani Nikula
Reduce the duplication.
Signed-off-by Jani Nikula <[email protected]>
Quoted 77 lines
--- drivers/gpu/drm/i915/intel_runtime_pm.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-)drivers/gpu/drm/i915/intel_runtime_pm.c +10
-14@@ -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;Signature · 1 line
2.39.2
Quoted 6 lines · Rodrigo Vivi
Quoted 3 lines · Jani Nikula
Reduce the duplication.
Signed-off-by Jani Nikula <[email protected]>Reviewed-by Rodrigo Vivi <[email protected]>
Thanks, pushed to din.
BR,
Jani.
Signature · 1 line
Jani Nikula, Intel
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/rpm: add rpm_to_i915() helper around container_of()
In reply to Jani Nikula== Series Details ==
== 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 ([email protected]) 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@[email protected]
#### 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@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-mtlp-6/igt@[email protected]
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@[email protected]
- bat-atsm-1: NOTRUN -> [ABORT][5] ([i915#8213])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-atsm-1/igt@[email protected]
* 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@[email protected]
* 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@[email protected]
* 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@[email protected]
* 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@[email protected]
* 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@[email protected]
* 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@[email protected]
* 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@[email protected]
* 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@[email protected]
* 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@[email protected]
* 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@[email protected]
* 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@[email protected]
* 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@[email protected]
* 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@[email protected]
* 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@[email protected]
* 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@[email protected]
* 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@[email protected]
* 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@[email protected]
#### 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@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/fi-kbl-guc/igt@[email protected]
* 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@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_127353v1/bat-rplp-1/igt@kms_pipe_crc_basic@[email protected]
[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
Quoting Jani Nikula (2023-12-05 09:15:45-03:00)
Quoted 1 line
Reduce the duplication.
By the way, is it too ambitious to dream of a to_i915() using generics?
--
Gustavo Sousa
Quoted 79 lines
Signed-off-by Jani Nikula <[email protected]>---
drivers/gpu/drm/i915/intel_runtime_pm.c| 24 ++++++++++--------------1 file changed, 10 insertions(+), 14 deletions(-)drivers/gpu/drm/i915/intel_runtime_pm.c +10
-14@@ -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;Signature · 1 line
2.39.2
Quoted 4 lines · Gustavo Sousa
Quoting Jani Nikula (2023-12-05 09:15:45-03:00)
Quoted 1 line
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/
Signature · 1 line
Jani Nikula, Intel