From patchwork Mon May 30 01:09:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 68817 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1159663qge; Sun, 29 May 2016 18:10:06 -0700 (PDT) X-Received: by 10.66.73.193 with SMTP id n1mr41710449pav.70.1464570598088; Sun, 29 May 2016 18:09:58 -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.57; Sun, 29 May 2016 18:09:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753475AbcE3BJk (ORCPT + 30 others); Sun, 29 May 2016 21:09:40 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:33035 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753334AbcE3BJR (ORCPT ); Sun, 29 May 2016 21:09:17 -0400 Received: by mail-pa0-f68.google.com with SMTP id f8so19849976pag.0; Sun, 29 May 2016 18:09:16 -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=07MNN3gHhji5cdsSfJtzoWFxwOf6KgA2M6DBdU8503U=; b=terJfW+wOcc1hOrSgMWSdUkRschnv4L+P8l2guni5zlPpQRXtCv6Z5K72rjKfdmkcy B3Lmogdtrv6/YaHtY6YIj/Db0sCtg+vxbKBEkZGhAnf3uF8YhkB6kiMRYcTUWFI2Nimy XBSEfstKgYn9jIzl/2RBYp47IWcpPRaGwoZF7fMMdHShYveLzhgfEq91UOL4GBq5iCfz oiHVYOlNtt4ZlSNwoPw8gXv5Oxg6KTbrpNr7y816WJPP4E3aMwrY2AGE8qpZCDtDA+ok Dt1o5vngpOfHXGCX3716vv8PHGVyF1+BPFHyCEes7x0De+hmq3dx1X9Dzu7sA1x8MdhG ABmw== 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=07MNN3gHhji5cdsSfJtzoWFxwOf6KgA2M6DBdU8503U=; b=lNXinki76heQFKbygeJrzt1lR57PpkTWQKkSfNP+festgYmBmcV12oUzUYJlQZyqQm UPwLuDkw0JZ+32T+xLiVAvm6wxRIQ8Ij6sbWQ7KTVJj4gqSEmiI3jIEdDPBH5ges8gMp f+KHCCfxMV624gFJJ4SKUfQtxDWZ3RLlXzfl5XRWXKgonFcYfpHkqLjBI4/GaD+dJ5w/ hzEmW1HwRoRRpH6gpsNt/n2iyzGXSwXbLGZVlIc/EzjbD7ILTB/O6G6Z4zs15Z5gPUiG dD0uQ6Ut9eDWV+Vk7v9YDNpoBbEbaPtx1cj3CaIVnmPPAkoDKHN4S5du5L2gNTyYB5O0 T1CQ== X-Gm-Message-State: ALyK8tKmlKEM0myDESbkVJ5mnob0J659HtKggV9WL0yT9Ng+cDz+jxP5s7ZzUMqKPR79Jg== X-Received: by 10.66.222.98 with SMTP id ql2mr42175135pac.137.1464570556183; 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 ap3sm4393551pad.33.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 9770F9D9; Sun, 29 May 2016 20:09:12 -0500 (CDT) Received: by t430.minyard.net (Postfix, from userid 1000) id 65B72300530; 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 10/10] i2c-i801: Only write the host control reg when necessary Date: Sun, 29 May 2016 20:09:04 -0500 Message-Id: <1464570544-975-11-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Corey Minyard When doing byte-by-byte mode, the code was writing the host control register on every byte. However, this is only necessary on the first byte and for read transactions the last byte. So only do it those times. Signed-off-by: Corey Minyard --- drivers/i2c/busses/i2c-i801.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index bb15356..4a96a95 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -606,11 +606,11 @@ static int i801_block_transaction_byte_by_byte(struct i801_priv *priv, for (i = 1; i <= len; i++) { if (i == len && is_read) smbcmd |= SMBHSTCNT_LAST_BYTE; - outb_p(smbcmd, SMBHSTCNT(priv)); if (i == 1) - outb_p(inb(SMBHSTCNT(priv)) | SMBHSTCNT_START, - SMBHSTCNT(priv)); + outb_p(smbcmd | SMBHSTCNT_START, SMBHSTCNT(priv)); + else if (i == len && is_read) + outb_p(smbcmd, SMBHSTCNT(priv)); status = i801_wait_byte_done(priv); if (status)