diff mbox

[1/4] drm/i915/dp: make intel_dp_aux_native_read() return bool

Message ID f889dc78c92e738131b67e348bb2b937702868bb.1391074436.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula Jan. 30, 2014, 9:37 a.m. UTC
In most cases we only care about success or fail, so make the function
easier to use, and consistent with intel_dp_aux_native_read_retry().

This fixes the intel_dp_aux_native_read() usage in intel_dp_sink_crc()
which has already assumed bool, and would only have caught very specific
failure modes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Comments

Chris Wilson Jan. 30, 2014, 10:07 a.m. UTC | #1
On Thu, Jan 30, 2014 at 11:37:01AM +0200, Jani Nikula wrote:
> +static inline bool
> +intel_dp_aux_native_read(struct intel_dp *intel_dp,
> +			 uint16_t address, uint8_t *recv, int recv_bytes)
> +{
> +	return _intel_dp_aux_native_read(intel_dp, address,
> +					 recv, recv_bytes) == recv_bytes;
> +}
> +
>  static int
>  intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
>  		    uint8_t write_byte, uint8_t *read_byte)
> @@ -1986,8 +1994,8 @@ intel_dp_aux_native_read_retry(struct intel_dp *intel_dp, uint16_t address,
>  	 * but we're also supposed to retry 3 times per the spec.
>  	 */
>  	for (i = 0; i < 3; i++) {
> -		ret = intel_dp_aux_native_read(intel_dp, address, recv,
> -					       recv_bytes);
> +		ret = _intel_dp_aux_native_read(intel_dp, address, recv,
> +						recv_bytes);
>  		if (ret == recv_bytes)
>  			return true;

ret is not being used other than to evaulate the boolean exactly like
the new intel_dp_aux_native_read().
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 0ef2690..7e3d56e 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -613,8 +613,8 @@  intel_dp_aux_native_write_1(struct intel_dp *intel_dp,
 
 /* read bytes from a native aux channel */
 static int
-intel_dp_aux_native_read(struct intel_dp *intel_dp,
-			 uint16_t address, uint8_t *recv, int recv_bytes)
+_intel_dp_aux_native_read(struct intel_dp *intel_dp,
+			  uint16_t address, uint8_t *recv, int recv_bytes)
 {
 	uint8_t msg[4];
 	int msg_bytes;
@@ -654,6 +654,14 @@  intel_dp_aux_native_read(struct intel_dp *intel_dp,
 	}
 }
 
+static inline bool
+intel_dp_aux_native_read(struct intel_dp *intel_dp,
+			 uint16_t address, uint8_t *recv, int recv_bytes)
+{
+	return _intel_dp_aux_native_read(intel_dp, address,
+					 recv, recv_bytes) == recv_bytes;
+}
+
 static int
 intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
 		    uint8_t write_byte, uint8_t *read_byte)
@@ -1986,8 +1994,8 @@  intel_dp_aux_native_read_retry(struct intel_dp *intel_dp, uint16_t address,
 	 * but we're also supposed to retry 3 times per the spec.
 	 */
 	for (i = 0; i < 3; i++) {
-		ret = intel_dp_aux_native_read(intel_dp, address, recv,
-					       recv_bytes);
+		ret = _intel_dp_aux_native_read(intel_dp, address, recv,
+						recv_bytes);
 		if (ret == recv_bytes)
 			return true;
 		msleep(1);