diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2022-11-08 17:18:27 +0200 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2022-11-17 19:16:17 +0200 |
commit | 734d06d2b2b7b1825d17ba547e4b7a5f29c9d049 (patch) | |
tree | a46834e7aa359a3e4c837067047a34c58196801f | |
parent | d6c4f95039aa0c0168bb4f67bf4d320d4a54a4a4 (diff) | |
download | linux-734d06d2b2b7b1825d17ba547e4b7a5f29c9d049.tar.gz |
drm/i915/audio: Unify get_saved_enc()
Make the two branches of get_saved_enc() look alike. Currently
they look different even though they do exactly the same thing
apart from == vs. != for the MST comparison.
Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221108151839.31567-4-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/display/intel_audio.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c index c3176c9c89a6..06ab6f359c45 100644 --- a/drivers/gpu/drm/i915/display/intel_audio.c +++ b/drivers/gpu/drm/i915/display/intel_audio.c @@ -1129,10 +1129,10 @@ static int i915_audio_component_get_cdclk_freq(struct device *kdev) static struct intel_encoder *get_saved_enc(struct drm_i915_private *i915, int port, int pipe) { - struct intel_encoder *encoder; - /* MST */ if (pipe >= 0) { + struct intel_encoder *encoder; + if (drm_WARN_ON(&i915->drm, pipe >= ARRAY_SIZE(i915->display.audio.encoder_map))) return NULL; @@ -1143,7 +1143,7 @@ static struct intel_encoder *get_saved_enc(struct drm_i915_private *i915, * MST or not. So it will poll all the port & pipe * combinations */ - if (encoder != NULL && encoder->port == port && + if (encoder && encoder->port == port && encoder->type == INTEL_OUTPUT_DP_MST) return encoder; } @@ -1153,14 +1153,12 @@ static struct intel_encoder *get_saved_enc(struct drm_i915_private *i915, return NULL; for_each_pipe(i915, pipe) { - encoder = i915->display.audio.encoder_map[pipe]; - if (encoder == NULL) - continue; + struct intel_encoder *encoder; - if (encoder->type == INTEL_OUTPUT_DP_MST) - continue; + encoder = i915->display.audio.encoder_map[pipe]; - if (port == encoder->port) + if (encoder && encoder->port == port && + encoder->type != INTEL_OUTPUT_DP_MST) return encoder; } |