Skip to content

Commit 734d06d

Browse files
committed
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 <[email protected]> Cc: Kai Vehmanen <[email protected]> Cc: Takashi Iwai <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Jani Nikula <[email protected]>
1 parent d6c4f95 commit 734d06d

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

drivers/gpu/drm/i915/display/intel_audio.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,10 +1129,10 @@ static int i915_audio_component_get_cdclk_freq(struct device *kdev)
11291129
static struct intel_encoder *get_saved_enc(struct drm_i915_private *i915,
11301130
int port, int pipe)
11311131
{
1132-
struct intel_encoder *encoder;
1133-
11341132
/* MST */
11351133
if (pipe >= 0) {
1134+
struct intel_encoder *encoder;
1135+
11361136
if (drm_WARN_ON(&i915->drm,
11371137
pipe >= ARRAY_SIZE(i915->display.audio.encoder_map)))
11381138
return NULL;
@@ -1143,7 +1143,7 @@ static struct intel_encoder *get_saved_enc(struct drm_i915_private *i915,
11431143
* MST or not. So it will poll all the port & pipe
11441144
* combinations
11451145
*/
1146-
if (encoder != NULL && encoder->port == port &&
1146+
if (encoder && encoder->port == port &&
11471147
encoder->type == INTEL_OUTPUT_DP_MST)
11481148
return encoder;
11491149
}
@@ -1153,14 +1153,12 @@ static struct intel_encoder *get_saved_enc(struct drm_i915_private *i915,
11531153
return NULL;
11541154

11551155
for_each_pipe(i915, pipe) {
1156-
encoder = i915->display.audio.encoder_map[pipe];
1157-
if (encoder == NULL)
1158-
continue;
1156+
struct intel_encoder *encoder;
11591157

1160-
if (encoder->type == INTEL_OUTPUT_DP_MST)
1161-
continue;
1158+
encoder = i915->display.audio.encoder_map[pipe];
11621159

1163-
if (port == encoder->port)
1160+
if (encoder && encoder->port == port &&
1161+
encoder->type != INTEL_OUTPUT_DP_MST)
11641162
return encoder;
11651163
}
11661164

0 commit comments

Comments
 (0)