From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: ville.syrjala@linux.intel.com, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/3] drm/i915: Flatten intel_dp_check_mst_status()
Date: Wed, 16 Sep 2015 15:07:16 +0200 [thread overview]
Message-ID: <55F96984.9050101@linux.intel.com> (raw)
In-Reply-To: <1440689810-29585-4-git-send-email-ville.syrjala@linux.intel.com>
Op 27-08-15 om 17:36 schreef ville.syrjala@linux.intel.com:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Restructure intel_dp_check_mst_status() to be more straightforward to
> read.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_dp.c | 92 +++++++++++++++++++++--------------------
> 1 file changed, 47 insertions(+), 45 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 6c34784..033ee20 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> <snip>
> + for (;;) {
> bool handled;
> - bret = intel_dp_get_sink_irq_esi(intel_dp, esi);
> -go_again:
> - if (bret == true) {
> + int retry;
> + int ret;
>
> - drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
> + drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
>
> - /* check link status - esi[10] = 0x200c */
> - if (intel_dp->active_mst_links &&
> - !drm_dp_channel_eq_ok(&esi[10], intel_dp->lane_count)) {
> - DRM_DEBUG_KMS("channel EQ not ok, retraining\n");
> - intel_dp_start_link_train(intel_dp);
> - intel_dp_complete_link_train(intel_dp);
> - intel_dp_stop_link_train(intel_dp);
> - }
> + /* check link status - esi[10] = 0x200c */
> + if (intel_dp->active_mst_links &&
> + !drm_dp_channel_eq_ok(&esi[10], intel_dp->lane_count)) {
> + DRM_DEBUG_KMS("channel EQ not ok, retraining\n");
> + intel_dp_start_link_train(intel_dp);
> + intel_dp_complete_link_train(intel_dp);
> + intel_dp_stop_link_train(intel_dp);
> + }
>
> - drm_modeset_unlock(&dev->mode_config.connection_mutex);
>
> - DRM_DEBUG_KMS("got esi %3ph\n", esi);
> - ret = drm_dp_mst_hpd_irq(&intel_dp->mst_mgr, esi, &handled);
> -
> - if (handled) {
> - for (retry = 0; retry < 3; retry++) {
> - int wret;
> - wret = drm_dp_dpcd_write(&intel_dp->aux,
> - DP_SINK_COUNT_ESI+1,
> - &esi[1], 3);
> - if (wret == 3) {
> - break;
> - }
> - }
> + drm_modeset_unlock(&dev->mode_config.connection_mutex);
>
> - bret = intel_dp_get_sink_irq_esi(intel_dp, esi);
> - if (bret == true) {
> - DRM_DEBUG_KMS("got esi2 %3ph\n", esi);
> - goto go_again;
> - }
> - } else
> - ret = 0;
> + DRM_DEBUG_KMS("got esi %3ph\n", esi);
> + ret = drm_dp_mst_hpd_irq(&intel_dp->mst_mgr, esi, &handled);
>
> - return ret;
> - } else {
> - struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
> - DRM_DEBUG_KMS("failed to get ESI - device may have failed\n");
> - intel_dp->is_mst = false;
> - drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst);
> - /* send a hotplug event */
> - drm_kms_helper_hotplug_event(intel_dig_port->base.base.dev);
> + if (!handled)
> + return 0;
> +
> + for (retry = 0; retry < 3; retry++) {
> + int wret = drm_dp_dpcd_write(&intel_dp->aux,
> + DP_SINK_COUNT_ESI+1,
> + &esi[1], 3);
> + if (wret == 3)
> + break;
> }
> +
> + bret = intel_dp_get_sink_irq_esi(intel_dp, esi);
> + if (!bret)
> + return ret;
^This seemed like a bug the first time I looked at it with the indent changes.
Original indent with if (handled) {.. } seems better here, but with a continue instead of a goto.
I think a single return ret; would make it more clear when the loop finishes.
The original code sets ret = 0 when handled = false, but looking a drm_dp_mst_hpd_irq
this is unneeded.
> +
> + DRM_DEBUG_KMS("got esi2 %3ph\n", esi);
> }
> +
> return -EINVAL;
Can this -EINVAL be removed? It cannot be reached any more.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2015-09-16 13:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-27 15:36 [PATCH 0/3] drm/i915: MST link training locking and cleanups ville.syrjala
2015-08-27 15:36 ` [PATCH 1/3] drm/i915: Protect MST retraining with connection_mutex ville.syrjala
2015-09-03 12:11 ` Ville Syrjälä
2015-09-16 11:48 ` Maarten Lankhorst
2015-09-23 8:01 ` Daniel Vetter
2015-08-27 15:36 ` [PATCH 2/3] drm/i915: Flatten the mst suspend/resume functions a bit ville.syrjala
2015-09-16 12:28 ` Maarten Lankhorst
2015-08-27 15:36 ` [PATCH 3/3] drm/i915: Flatten intel_dp_check_mst_status() ville.syrjala
2015-09-16 13:07 ` Maarten Lankhorst [this message]
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=55F96984.9050101@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox