From patchwork Sat Mar 29 23:21:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Renner Berthing X-Patchwork-Id: 3909611 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7E6109F2B6 for ; Sat, 29 Mar 2014 23:22:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6CC7720386 for ; Sat, 29 Mar 2014 23:22:32 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 64C6D2037D for ; Sat, 29 Mar 2014 23:22:31 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WU2a2-0004i8-Uj; Sat, 29 Mar 2014 23:22:27 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WU2a0-0007FH-I3; Sat, 29 Mar 2014 23:22:24 +0000 Received: from mail-la0-x22a.google.com ([2a00:1450:4010:c03::22a]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WU2Zx-0007Ez-29 for linux-arm-kernel@lists.infradead.org; Sat, 29 Mar 2014 23:22:21 +0000 Received: by mail-la0-f42.google.com with SMTP id ec20so4759819lab.15 for ; Sat, 29 Mar 2014 16:21:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=rMlQBEZTN99ohXX5kHN6Avc2wueIFM38Dg4MSUyfXnQ=; b=k0Nzun3F2VyYiY0tyW+1vFio2K96PlHOPWoqrW/S8AolO/PYwcT+Hk8VlmYS5rJUOY gRQ/OJdDLvEOkRU83nUJ8jnmvGVF2DYb/rEdSGFWzx9eFz6UaqeX2vUuHoWdgNmH/uxJ WtXK1JfNFGtZNI5NDR7h1LZL3JW3xqjXK5ekOO7Aphex7ulTp0oQOBRjeR6hpeNMVldx XiUuhhtbyQGdm1yOcdJ9dzHK8Yj0hgnAAlZ1+UeMA0alRoF8m90Ynz6HhqMJOitiKGaq 93fDDPbIhPthx+JsHK/YPmsaNpbHj+x56ljNqNTgPrFPxvIb4IFNTewnaHcQzGbbixv3 NHTg== X-Received: by 10.112.143.99 with SMTP id sd3mr11162191lbb.11.1396135315953; Sat, 29 Mar 2014 16:21:55 -0700 (PDT) Received: from localhost.localdomain (0189600560.0.fullrate.dk. [95.166.155.242]) by mx.google.com with ESMTPSA id z2sm9357215laz.4.2014.03.29.16.21.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 29 Mar 2014 16:21:55 -0700 (PDT) From: Emil Renner Berthing To: Greg Kroah-Hartman , Sascha Hauer Subject: [PATCH v2] staging: imx-drm: imx-hdmi: clean up hdmi_phy_wait_i2c_done Date: Sun, 30 Mar 2014 00:21:21 +0100 Message-Id: <1396135281-3880-1-git-send-email-kernel@esmil.dk> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1396097891-12209-1-git-send-email-kernel@esmil.dk> References: <1396097891-12209-1-git-send-email-kernel@esmil.dk> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140329_192221_292079_0944028B X-CRM114-Status: UNSURE ( 9.79 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) Cc: Emil Renner Berthing , linux-arm-kernel@lists.infradead.org, Troy Kisky X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify hdmi_phy_wait_i2c_done so the call to hdmi_readb is only done in one place. Also check for timout before waiting as suggested by Troy Kisky. This also fixes a checkpatch warning. Signed-off-by: Emil Renner Berthing --- drivers/staging/imx-drm/imx-hdmi.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c index da71d8d..6178ffc 100644 --- a/drivers/staging/imx-drm/imx-hdmi.c +++ b/drivers/staging/imx-drm/imx-hdmi.c @@ -660,13 +660,10 @@ static inline void hdmi_phy_test_dout(struct imx_hdmi *hdmi, static bool hdmi_phy_wait_i2c_done(struct imx_hdmi *hdmi, int msec) { - unsigned char val = 0; - val = hdmi_readb(hdmi, HDMI_IH_I2CMPHY_STAT0) & 0x3; - while (!val) { - udelay(1000); + while ((hdmi_readb(hdmi, HDMI_IH_I2CMPHY_STAT0) & 0x3) == 0) { if (msec-- == 0) return false; - val = hdmi_readb(hdmi, HDMI_IH_I2CMPHY_STAT0) & 0x3; + udelay(1000); } return true; }