From: Jani Nikula Date: Mon, 10 Oct 2016 15:04:01 +0000 (+0300) Subject: drm/i915/audio: port is going to be just fine, simplify checks X-Git-Tag: v4.14-rc1~674^2~37^2~1198 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3af306d905b530bf076a983b14af23d133772eea;p=platform%2Fkernel%2Flinux-rpi3.git drm/i915/audio: port is going to be just fine, simplify checks If it was wrong, we'd be screwed already. Cc: Libin Yang Reviewed-by: Libin Yang Signed-off-by: Jani Nikula Link: http://patchwork.freedesktop.org/patch/msgid/8cf454ccefc05b234aa81c45a4ce9018e7c9324f.1476111629.git.jani.nikula@intel.com --- diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c index d452e7b..58a222f 100644 --- a/drivers/gpu/drm/i915/intel_audio.c +++ b/drivers/gpu/drm/i915/intel_audio.c @@ -251,8 +251,9 @@ static void hsw_audio_config_update(struct intel_crtc *intel_crtc, { struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev); struct i915_audio_component *acomp = dev_priv->audio_component; + int rate = acomp ? acomp->aud_sample_rate[port] : 0; enum pipe pipe = intel_crtc->pipe; - int n, rate; + int n; u32 tmp; tmp = I915_READ(HSW_AUD_CFG(pipe)); @@ -265,15 +266,6 @@ static void hsw_audio_config_update(struct intel_crtc *intel_crtc, tmp &= ~AUD_CONFIG_N_PROG_ENABLE; if (audio_rate_need_prog(intel_crtc, adjusted_mode)) { - if (!acomp) - rate = 0; - else if (port >= PORT_A && port <= PORT_E) - rate = acomp->aud_sample_rate[port]; - else { - DRM_ERROR("invalid port: %d\n", port); - rate = 0; - } - n = audio_config_get_n(adjusted_mode, rate); if (n != 0) tmp = audio_config_setup_n_reg(n, tmp);