diff options
author | Jani Nikula <jani.nikula@intel.com> | 2015-09-29 10:24:26 +0300 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-09-30 10:20:40 +0200 |
commit | 8cd21b7f28ed1f12059935512edaaadf1deaeb67 (patch) | |
tree | 745da10bb6cc5b601d14a58895c3696a2c78c2fa /drivers/gpu/drm/i915/intel_ddi.c | |
parent | 85b98a4c30c60272b2830d9acc43121eb2988bd2 (diff) | |
download | op-kernel-dev-8cd21b7f28ed1f12059935512edaaadf1deaeb67.zip op-kernel-dev-8cd21b7f28ed1f12059935512edaaadf1deaeb67.tar.gz |
drm/i915/ddi: use switch case instead of if ladder for ddi_get_encoder_port
Make the alternatives stand out better.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ddi.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_ddi.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index fdcb456..2b5a298 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -309,20 +309,26 @@ static void ddi_get_encoder_port(struct intel_encoder *intel_encoder, enum port *port) { struct drm_encoder *encoder = &intel_encoder->base; - int type = intel_encoder->type; - if (type == INTEL_OUTPUT_DP_MST) { + switch (intel_encoder->type) { + case INTEL_OUTPUT_DP_MST: *dig_port = enc_to_mst(encoder)->primary; *port = (*dig_port)->port; - } else if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP || - type == INTEL_OUTPUT_HDMI || type == INTEL_OUTPUT_UNKNOWN) { + break; + case INTEL_OUTPUT_DISPLAYPORT: + case INTEL_OUTPUT_EDP: + case INTEL_OUTPUT_HDMI: + case INTEL_OUTPUT_UNKNOWN: *dig_port = enc_to_dig_port(encoder); *port = (*dig_port)->port; - } else if (type == INTEL_OUTPUT_ANALOG) { + break; + case INTEL_OUTPUT_ANALOG: *dig_port = NULL; *port = PORT_E; - } else { - WARN(1, "Invalid DDI encoder type %d\n", type); + break; + default: + WARN(1, "Invalid DDI encoder type %d\n", intel_encoder->type); + break; } } |