From: Jani Nikula Subject: [PATCH v2] drm/i915/dp: make intel_dp_aux_native_read() return bool Date: Thu, 30 Jan 2014 14:00:13 +0200 Message-ID: <1391083213-2292-1-git-send-email-jani.nikula@intel.com> References: <20140130100746.GA6258@nuc-i3427.alporthouse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id DF9CAFA008 for ; Thu, 30 Jan 2014 04:00:59 -0800 (PST) In-Reply-To: <20140130100746.GA6258@nuc-i3427.alporthouse.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com List-Id: intel-gfx@lists.freedesktop.org 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. v2: simplify intel_dp_aux_native_read_retry() while at it. (Chris) Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/intel_dp.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 0ef2690..8c61fce 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) @@ -1979,16 +1987,15 @@ static bool intel_dp_aux_native_read_retry(struct intel_dp *intel_dp, uint16_t address, uint8_t *recv, int recv_bytes) { - int ret, i; + int i; /* * Sinks are *supposed* to come up within 1ms from an off state, * 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); - if (ret == recv_bytes) + if (intel_dp_aux_native_read(intel_dp, address, recv, + recv_bytes)) return true; msleep(1); } -- 1.7.10.4