All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/dp: return number of bytes written for short aux/i2c writes
Date: Tue, 17 Mar 2015 18:40:18 +0200	[thread overview]
Message-ID: <20150317164018.GK17419@intel.com> (raw)
In-Reply-To: <1426605534-5780-1-git-send-email-jani.nikula@intel.com>

On Tue, Mar 17, 2015 at 05:18:54PM +0200, Jani Nikula wrote:
> Allow for a larger receive data size, and check if the receiver returned
> the number of bytes written. Without this, we've basically skipped all
> the unwritten bytes for short writes.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Whoops :)

Looks correct to me.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/intel_dp.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 5256c064da05..3967af10f53c 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -951,7 +951,7 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
>  	case DP_AUX_NATIVE_WRITE:
>  	case DP_AUX_I2C_WRITE:
>  		txsize = msg->size ? HEADER_SIZE + msg->size : BARE_ADDRESS_SIZE;
> -		rxsize = 1;
> +		rxsize = 2; /* 0 or 1 data bytes */
>  
>  		if (WARN_ON(txsize > 20))
>  			return -E2BIG;
> @@ -962,8 +962,13 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
>  		if (ret > 0) {
>  			msg->reply = rxbuf[0] >> 4;
>  
> -			/* Return payload size. */
> -			ret = msg->size;
> +			if (ret > 1) {
> +				/* Number of bytes written in a short write. */
> +				ret = clamp_t(int, rxbuf[1], 0, msg->size);
> +			} else {
> +				/* Return payload size. */
> +				ret = msg->size;
> +			}
>  		}
>  		break;
>  
> -- 
> 2.1.4

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-03-17 16:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17 15:18 [PATCH] drm/i915/dp: return number of bytes written for short aux/i2c writes Jani Nikula
2015-03-17 16:40 ` Ville Syrjälä [this message]
2015-03-18  8:41   ` Daniel Vetter
2015-03-18 14:42 ` shuang.he

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=20150317164018.GK17419@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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 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.