Commit 734d06d2 authored by Ville Syrjälä's avatar Ville Syrjälä

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: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221108151839.31567-4-ville.syrjala@linux.intel.comReviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
parent d6c4f950
...@@ -1129,10 +1129,10 @@ static int i915_audio_component_get_cdclk_freq(struct device *kdev) ...@@ -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, static struct intel_encoder *get_saved_enc(struct drm_i915_private *i915,
int port, int pipe) int port, int pipe)
{ {
struct intel_encoder *encoder;
/* MST */ /* MST */
if (pipe >= 0) { if (pipe >= 0) {
struct intel_encoder *encoder;
if (drm_WARN_ON(&i915->drm, if (drm_WARN_ON(&i915->drm,
pipe >= ARRAY_SIZE(i915->display.audio.encoder_map))) pipe >= ARRAY_SIZE(i915->display.audio.encoder_map)))
return NULL; return NULL;
...@@ -1143,7 +1143,7 @@ static struct intel_encoder *get_saved_enc(struct drm_i915_private *i915, ...@@ -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 * MST or not. So it will poll all the port & pipe
* combinations * combinations
*/ */
if (encoder != NULL && encoder->port == port && if (encoder && encoder->port == port &&
encoder->type == INTEL_OUTPUT_DP_MST) encoder->type == INTEL_OUTPUT_DP_MST)
return encoder; return encoder;
} }
...@@ -1153,14 +1153,12 @@ static struct intel_encoder *get_saved_enc(struct drm_i915_private *i915, ...@@ -1153,14 +1153,12 @@ static struct intel_encoder *get_saved_enc(struct drm_i915_private *i915,
return NULL; return NULL;
for_each_pipe(i915, pipe) { for_each_pipe(i915, pipe) {
encoder = i915->display.audio.encoder_map[pipe]; struct intel_encoder *encoder;
if (encoder == NULL)
continue;
if (encoder->type == INTEL_OUTPUT_DP_MST) encoder = i915->display.audio.encoder_map[pipe];
continue;
if (port == encoder->port) if (encoder && encoder->port == port &&
encoder->type != INTEL_OUTPUT_DP_MST)
return encoder; return encoder;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment