Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752221AbaDQSAY (ORCPT ); Thu, 17 Apr 2014 14:00:24 -0400 Received: from mail-ie0-f201.google.com ([209.85.223.201]:44330 "EHLO mail-ie0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751001AbaDQSAS (ORCPT ); Thu, 17 Apr 2014 14:00:18 -0400 From: Doug Anderson To: Lee Jones , Stephen Warren , Wolfram Sang Cc: abrestic@chromium.org, dgreid@chromium.org, Olof Johansson , Simon Glass , linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, David Hendricks , Doug Anderson , Samuel Ortiz , linux-kernel@vger.kernel.org Subject: [PATCH 1/7] mfd: cros_ec: spi: calculate delay between transfers correctly Date: Thu, 17 Apr 2014 10:59:24 -0700 Message-Id: <1397757570-19750-2-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 1.9.1.423.g4596e3a In-Reply-To: <1397757570-19750-1-git-send-email-dianders@chromium.org> References: <1397757570-19750-1-git-send-email-dianders@chromium.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Hendricks To avoid spamming the EC we calculate the time between the previous transfer and the current transfer and force a delay if the time delta is too small. However, a small miscalculation causes the delay period to be far too short. Most noticably this impacts commands with a long turnaround time such as EC firmware reads and writes. Signed-off-by: David Hendricks Signed-off-by: Doug Anderson --- drivers/mfd/cros_ec_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/cros_ec_spi.c b/drivers/mfd/cros_ec_spi.c index 84af8d7..c185eb6 100644 --- a/drivers/mfd/cros_ec_spi.c +++ b/drivers/mfd/cros_ec_spi.c @@ -219,7 +219,7 @@ static int cros_ec_command_spi_xfer(struct cros_ec_device *ec_dev, ktime_get_ts(&ts); delay = timespec_to_ns(&ts) - ec_spi->last_transfer_ns; if (delay < EC_SPI_RECOVERY_TIME_NS) - ndelay(delay); + ndelay(EC_SPI_RECOVERY_TIME_NS - delay); } /* Transmit phase - send our message */ -- 1.9.1.423.g4596e3a -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/