From patchwork Mon May 30 01:08:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 68814 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1159604qge; Sun, 29 May 2016 18:09:56 -0700 (PDT) X-Received: by 10.98.27.216 with SMTP id b207mr41510427pfb.111.1464570596399; Sun, 29 May 2016 18:09:56 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h192si32779846pfc.70.2016.05.29.18.09.56; Sun, 29 May 2016 18:09:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753114AbcE3BJb (ORCPT + 1 other); Sun, 29 May 2016 21:09:31 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:36686 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753355AbcE3BJR (ORCPT ); Sun, 29 May 2016 21:09:17 -0400 Received: by mail-pa0-f68.google.com with SMTP id fg1so19653667pad.3; Sun, 29 May 2016 18:09:17 -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=3JsomVGYOmfcAH3W+wpVV8VnbZ+u3EXMeem0YR1xgtY=; b=hBj8sh9QbgAK+YUeiN/uA8VMd29rGhFWXudi4K/zICGXD4B17NghgRpC27C3wYx0bh 9bDAqhdnf1+Q893vNSXGtimhpIFrSjgZfeIoEAhF74nj1qNI039zCCUzimGTcPC8XdGf ZO7hzHu86zrqwu4fWImwnzUTjxR8TzFU9kRpatFDTCKNwQV/BA05uEt7hSNhkMsT1Bua PfR04Qdg/AgxSxq1HqoW+KRYJrRlrsAhM2K9dFCEtIgl0bWX81dC1085q45T/44Bh3+3 hb1mXFjP8Ut7L3ZI+3/PM3hUqCoobUaX5uZIfdpPTebagujVwO5CbUXGNXtoY+e8KuzB uhXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=3JsomVGYOmfcAH3W+wpVV8VnbZ+u3EXMeem0YR1xgtY=; b=j8DXs33gPoajU8EOt4DnbWUjkULDdkSGHVdhWGw49qU9H1m/9lYBREoQ5a7hlSJ2hw jQpEQGdTanwvZJINdsXalehjsS1B+W2+72rgU5tDFgor5dxnQ4vxEvQ4qPPffVKgcJSG 2AsePiocSG5OrVc9KzY05jc7VPkSPQvqhN9GUxMGdoeJEJRkNgx6nS+L6R56+armbSoS dh8u34VZMkgv6SYvtMabm5M/aDoqduTw3E/K6g5noLvLHMr4ynqcAjS4pmS7jiuJJ8K6 oMPSmrUkJlNlF8G8qBgjurFmNuGdMRajJzmrog8K6OZcUpod+EeQk7dNZTmU8PhlJ9+u qUtQ== X-Gm-Message-State: ALyK8tICCPHWiDyOY0m7pEgsfdgsNpmCVDD2N9pgifh1tGA8GI51zdrUxShfDuqvWOmUbQ== X-Received: by 10.66.121.197 with SMTP id lm5mr42641364pab.143.1464570556475; Sun, 29 May 2016 18:09:16 -0700 (PDT) Received: from serve.minyard.net ([108.19.215.157]) by smtp.gmail.com with ESMTPSA id a62sm28199727pfj.29.2016.05.29.18.09.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 May 2016 18:09:15 -0700 (PDT) Received: from t430.minyard.net (unknown [IPv6:2001:470:b8f6:1b:8881:3308:a7ea:195e]) by serve.minyard.net (Postfix) with ESMTPA id 7F7E79D6; Sun, 29 May 2016 20:09:12 -0500 (CDT) Received: by t430.minyard.net (Postfix, from userid 1000) id 23F17300521; Sun, 29 May 2016 20:09:08 -0500 (CDT) From: minyard@acm.org To: Jean Delvare , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, minyard@acm.org Cc: Corey Minyard Subject: [PATCH v2 04/10] i2c-i801: Consolidate calls to i801_check_pre() Date: Sun, 29 May 2016 20:08:58 -0500 Message-Id: <1464570544-975-5-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1464570544-975-1-git-send-email-minyard@acm.org> References: <1464570544-975-1-git-send-email-minyard@acm.org> Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org From: Corey Minyard It was always done before starting the transaction, so do it in common code before the transaction start. Signed-off-by: Corey Minyard --- drivers/i2c/busses/i2c-i801.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 222be9c..8794e70 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -402,10 +402,6 @@ static int i801_transaction(struct i801_priv *priv, int xact) int result; const struct i2c_adapter *adap = &priv->adapter; - result = i801_check_pre(priv); - if (result < 0) - return result; - if (priv->features & FEATURE_IRQ) { outb_p(xact | SMBHSTCNT_INTREN | SMBHSTCNT_START, SMBHSTCNT(priv)); @@ -562,10 +558,6 @@ static int i801_block_transaction_byte_by_byte(struct i801_priv *priv, int result; const struct i2c_adapter *adap = &priv->adapter; - result = i801_check_pre(priv); - if (result < 0) - return result; - len = data->block[0]; if (read_write == I2C_SMBUS_WRITE) { @@ -789,6 +781,10 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr, goto out; } + ret = i801_check_pre(priv); + if (ret < 0) + goto out; + if (block) ret = i801_block_transaction(priv, flags, data, read_write, size);