Re: [PATCH 07/10] drm/i915/audio: migrate away from kdev_to_i915()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Jani Nikula (2024-07-29 11:30:08-03:00)
>Use to_intel_display() instead of kdev_to_i915() in the audio component
>API hooks. Avoid further drive-by changes at this point, and just
>convert the display pointer to i915, and leave the struct intel_display
>conversion for later.
>
>Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>

Reviewed-by: Gustavo Sousa <gustavo.sousa@xxxxxxxxx>

>---
> drivers/gpu/drm/i915/display/intel_audio.c | 34 +++++++++++++---------
> 1 file changed, 21 insertions(+), 13 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c
>index b9bafec06fb8..df2879538738 100644
>--- a/drivers/gpu/drm/i915/display/intel_audio.c
>+++ b/drivers/gpu/drm/i915/display/intel_audio.c
>@@ -979,7 +979,8 @@ static void glk_force_audio_cdclk(struct drm_i915_private *i915,
> 
> static unsigned long i915_audio_component_get_power(struct device *kdev)
> {
>-        struct drm_i915_private *i915 = kdev_to_i915(kdev);
>+        struct intel_display *display = to_intel_display(kdev);
>+        struct drm_i915_private *i915 = to_i915(display->drm);
>         intel_wakeref_t ret;
> 
>         /* Catch potential impedance mismatches before they occur! */
>@@ -1011,7 +1012,8 @@ static unsigned long i915_audio_component_get_power(struct device *kdev)
> static void i915_audio_component_put_power(struct device *kdev,
>                                            unsigned long cookie)
> {
>-        struct drm_i915_private *i915 = kdev_to_i915(kdev);
>+        struct intel_display *display = to_intel_display(kdev);
>+        struct drm_i915_private *i915 = to_i915(display->drm);
> 
>         /* Stop forcing CDCLK to 2*BCLK if no need for audio to be powered. */
>         if (--i915->display.audio.power_refcount == 0)
>@@ -1024,7 +1026,8 @@ static void i915_audio_component_put_power(struct device *kdev,
> static void i915_audio_component_codec_wake_override(struct device *kdev,
>                                                      bool enable)
> {
>-        struct drm_i915_private *i915 = kdev_to_i915(kdev);
>+        struct intel_display *display = to_intel_display(kdev);
>+        struct drm_i915_private *i915 = to_i915(display->drm);
>         unsigned long cookie;
> 
>         if (DISPLAY_VER(i915) < 9)
>@@ -1052,7 +1055,8 @@ static void i915_audio_component_codec_wake_override(struct device *kdev,
> /* Get CDCLK in kHz  */
> static int i915_audio_component_get_cdclk_freq(struct device *kdev)
> {
>-        struct drm_i915_private *i915 = kdev_to_i915(kdev);
>+        struct intel_display *display = to_intel_display(kdev);
>+        struct drm_i915_private *i915 = to_i915(display->drm);
> 
>         if (drm_WARN_ON_ONCE(&i915->drm, !HAS_DDI(i915)))
>                 return -ENODEV;
>@@ -1111,7 +1115,8 @@ static struct intel_audio_state *find_audio_state(struct drm_i915_private *i915,
> static int i915_audio_component_sync_audio_rate(struct device *kdev, int port,
>                                                 int cpu_transcoder, int rate)
> {
>-        struct drm_i915_private *i915 = kdev_to_i915(kdev);
>+        struct intel_display *display = to_intel_display(kdev);
>+        struct drm_i915_private *i915 = to_i915(display->drm);
>         struct i915_audio_component *acomp = i915->display.audio.component;
>         const struct intel_audio_state *audio_state;
>         struct intel_encoder *encoder;
>@@ -1153,7 +1158,8 @@ static int i915_audio_component_get_eld(struct device *kdev, int port,
>                                         int cpu_transcoder, bool *enabled,
>                                         unsigned char *buf, int max_bytes)
> {
>-        struct drm_i915_private *i915 = kdev_to_i915(kdev);
>+        struct intel_display *display = to_intel_display(kdev);
>+        struct drm_i915_private *i915 = to_i915(display->drm);
>         const struct intel_audio_state *audio_state;
>         int ret = 0;
> 
>@@ -1188,24 +1194,25 @@ static const struct drm_audio_component_ops i915_audio_component_ops = {
>         .get_eld        = i915_audio_component_get_eld,
> };
> 
>-static int i915_audio_component_bind(struct device *i915_kdev,
>+static int i915_audio_component_bind(struct device *drv_kdev,
>                                      struct device *hda_kdev, void *data)
> {
>+        struct intel_display *display = to_intel_display(drv_kdev);
>+        struct drm_i915_private *i915 = to_i915(display->drm);
>         struct i915_audio_component *acomp = data;
>-        struct drm_i915_private *i915 = kdev_to_i915(i915_kdev);
>         int i;
> 
>         if (drm_WARN_ON(&i915->drm, acomp->base.ops || acomp->base.dev))
>                 return -EEXIST;
> 
>         if (drm_WARN_ON(&i915->drm,
>-                        !device_link_add(hda_kdev, i915_kdev,
>+                        !device_link_add(hda_kdev, drv_kdev,
>                                          DL_FLAG_STATELESS)))
>                 return -ENOMEM;
> 
>         drm_modeset_lock_all(&i915->drm);
>         acomp->base.ops = &i915_audio_component_ops;
>-        acomp->base.dev = i915_kdev;
>+        acomp->base.dev = drv_kdev;
>         BUILD_BUG_ON(MAX_PORTS != I915_MAX_PORTS);
>         for (i = 0; i < ARRAY_SIZE(acomp->aud_sample_rate); i++)
>                 acomp->aud_sample_rate[i] = 0;
>@@ -1215,11 +1222,12 @@ static int i915_audio_component_bind(struct device *i915_kdev,
>         return 0;
> }
> 
>-static void i915_audio_component_unbind(struct device *i915_kdev,
>+static void i915_audio_component_unbind(struct device *drv_kdev,
>                                         struct device *hda_kdev, void *data)
> {
>+        struct intel_display *display = to_intel_display(drv_kdev);
>+        struct drm_i915_private *i915 = to_i915(display->drm);
>         struct i915_audio_component *acomp = data;
>-        struct drm_i915_private *i915 = kdev_to_i915(i915_kdev);
> 
>         drm_modeset_lock_all(&i915->drm);
>         acomp->base.ops = NULL;
>@@ -1227,7 +1235,7 @@ static void i915_audio_component_unbind(struct device *i915_kdev,
>         i915->display.audio.component = NULL;
>         drm_modeset_unlock_all(&i915->drm);
> 
>-        device_link_remove(hda_kdev, i915_kdev);
>+        device_link_remove(hda_kdev, drv_kdev);
> 
>         if (i915->display.audio.power_refcount)
>                 drm_err(&i915->drm, "audio power refcount %d after unbind\n",
>-- 
>2.39.2
>




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux