From: Jani Nikula <jani.nikula@intel.com>
To: Imre Deak <imre.deak@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v3 5/8] drm/i915: Check error return when converting pipe to connector
Date: Thu, 27 Apr 2017 12:08:14 +0300 [thread overview]
Message-ID: <87efwerzep.fsf@intel.com> (raw)
In-Reply-To: <1493282214-11808-1-git-send-email-imre.deak@intel.com>
On Thu, 27 Apr 2017, Imre Deak <imre.deak@intel.com> wrote:
> An error from intel_get_pipe_from_connector() would mean a bug somewhere
> else, but we still should check for it to prevent some other more
> obscure bug later.
>
> v2:
> - Fall back to a reasonable default instead of bailing out in case of
> error. (Jani)
> v3:
> - Fix s/PIPE_INVALID/INVALID_PIPE/ typo. (Jani)
>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/intel_panel.c | 17 ++++++++++++++---
> 1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index cb50c52..d1abbf1 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -888,10 +888,14 @@ static void pch_enable_backlight(struct intel_connector *connector)
> struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
> struct intel_panel *panel = &connector->panel;
> enum pipe pipe = intel_get_pipe_from_connector(connector);
> - enum transcoder cpu_transcoder =
> - intel_pipe_to_cpu_transcoder(dev_priv, pipe);
> + enum transcoder cpu_transcoder;
> u32 cpu_ctl2, pch_ctl1, pch_ctl2;
>
> + if (!WARN_ON_ONCE(pipe == INVALID_PIPE))
> + cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, pipe);
> + else
> + cpu_transcoder = TRANSCODER_EDP;
> +
> cpu_ctl2 = I915_READ(BLC_PWM_CPU_CTL2);
> if (cpu_ctl2 & BLM_PWM_ENABLE) {
> DRM_DEBUG_KMS("cpu backlight already enabled\n");
> @@ -973,6 +977,9 @@ static void i965_enable_backlight(struct intel_connector *connector)
> enum pipe pipe = intel_get_pipe_from_connector(connector);
> u32 ctl, ctl2, freq;
>
> + if (WARN_ON_ONCE(pipe == INVALID_PIPE))
> + pipe = PIPE_A;
> +
> ctl2 = I915_READ(BLC_PWM_CTL2);
> if (ctl2 & BLM_PWM_ENABLE) {
> DRM_DEBUG_KMS("backlight already enabled\n");
> @@ -1037,6 +1044,9 @@ static void bxt_enable_backlight(struct intel_connector *connector)
> enum pipe pipe = intel_get_pipe_from_connector(connector);
> u32 pwm_ctl, val;
>
> + if (WARN_ON_ONCE(pipe) == INVALID_PIPE)
> + pipe = PIPE_A;
> +
> /* Controller 1 uses the utility pin. */
> if (panel->backlight.controller == 1) {
> val = I915_READ(UTIL_PIN_CTL);
> @@ -1093,7 +1103,8 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
> if (!panel->backlight.present)
> return;
>
> - DRM_DEBUG_KMS("pipe %c\n", pipe_name(pipe));
> + if (!WARN_ON_ONCE(pipe == INVALID_PIPE))
> + DRM_DEBUG_KMS("pipe %c\n", pipe_name(pipe));
>
> mutex_lock(&dev_priv->backlight_lock);
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-04-27 9:05 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-26 13:40 [PATCH 0/8] drm: Fix/remove a few static checker error Imre Deak
2017-04-26 13:40 ` [PATCH 1/8] drm/i915/vlv: Fix port B PLL opamp initialization Imre Deak
2017-04-26 14:54 ` Ville Syrjälä
2017-04-26 13:40 ` [PATCH 2/8] drm/i915/dp: Check error return during DPCD capability queries Imre Deak
2017-04-26 15:08 ` Ville Syrjälä
2017-04-26 15:23 ` Imre Deak
2017-04-26 15:30 ` Ville Syrjälä
2017-04-26 13:40 ` [PATCH 3/8] drm/i915/sdvo: Check error return from intel_sdvo_get_value() Imre Deak
2017-04-26 15:12 ` Ville Syrjälä
2017-04-26 15:24 ` Imre Deak
2017-04-26 17:18 ` [PATCH v2 " Imre Deak
2017-04-26 13:40 ` [PATCH 4/8] drm/i915: Check error return when setting DMA mask Imre Deak
2017-04-26 14:04 ` Jani Nikula
2017-04-26 17:18 ` [PATCH v2 " Imre Deak
2017-04-27 11:40 ` Jani Nikula
2017-04-26 13:40 ` [PATCH 5/8] drm/i915: Check error return when converting pipe to connector Imre Deak
2017-04-26 14:12 ` Jani Nikula
2017-04-26 14:20 ` Imre Deak
2017-04-26 14:53 ` Jani Nikula
2017-04-26 15:27 ` Imre Deak
2017-04-26 17:18 ` [PATCH v2 " Imre Deak
2017-04-27 7:09 ` Jani Nikula
2017-04-27 8:28 ` Imre Deak
2017-04-27 8:36 ` [PATCH v3 " Imre Deak
2017-04-27 9:08 ` Jani Nikula [this message]
2017-04-27 11:49 ` Ville Syrjälä
2017-04-27 11:56 ` Imre Deak
2017-04-27 12:03 ` Jani Nikula
2017-04-26 13:40 ` [PATCH 6/8] drm/i915: Sanitize stolen memory size calculation Imre Deak
2017-04-26 15:27 ` Ville Syrjälä
2017-04-27 9:34 ` Joonas Lahtinen
2017-04-26 13:40 ` [PATCH 7/8] drm/i915/lvds: Remove magic from PLL programming Imre Deak
2017-04-26 14:50 ` Ville Syrjälä
2017-04-26 15:04 ` Imre Deak
2017-04-26 17:18 ` [PATCH v2 " Imre Deak
2017-04-26 17:25 ` Ville Syrjälä
2017-04-26 13:40 ` [PATCH 8/8] drm: Remove redundant NULL check during atomic plane commit Imre Deak
2017-04-26 15:44 ` Ville Syrjälä
2017-05-09 10:05 ` [Intel-gfx] " Ville Syrjälä
2017-04-26 14:40 ` ✓ Fi.CI.BAT: success for drm: Fix/remove a few static checker error Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87efwerzep.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.