lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1398879850-9111-2-git-send-email-dianders@chromium.org>
Date:	Wed, 30 Apr 2014 10:44:04 -0700
From:	Doug Anderson <dianders@...omium.org>
To:	lee.jones@...aro.org, swarren@...dia.com, wsa@...-dreams.de
Cc:	abrestic@...omium.org, dgreid@...omium.org, olof@...om.net,
	sjg@...omium.org, linux-samsung-soc@...r.kernel.org,
	linux-tegra@...r.kernel.org,
	David Hendricks <dhendrix@...omium.org>,
	Doug Anderson <dianders@...omium.org>, sameo@...ux.intel.com,
	linux-kernel@...r.kernel.org
Subject: [PATCH v3 1/7] mfd: cros_ec: spi: calculate delay between transfers correctly

From: David Hendricks <dhendrix@...omium.org>

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 <dhendrix@...omium.org>
Signed-off-by: Doug Anderson <dianders@...omium.org>
Acked-by: Lee Jones <lee.jones@...aro.org>
Reviewed-by: Simon Glass <sjg@...omium.org>
Tested-by: Andrew Bresticker <abrestic@...omium.org>
Tested-by: Stephen Warren <swarren@...dia.com>
---
Changes in v3: None
Changes in v2: None

 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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ