aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/cros_ec_spi.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-07-16 17:04:41 -0400
committerJohn Stultz <john.stultz@linaro.org>2014-07-23 18:01:38 -0400
commit154adc14b1ce941b642a3775f2423c20d55c026b (patch)
treecb2adb99819dee88056513943d7df9cadfbe9b91 /drivers/mfd/cros_ec_spi.c
parent9e93f21b4309572c646bd8141a4853be5c031523 (diff)
mfd: cros_ec_spi: Use ktime_get_ns()
Replace the ever recurring: ts = ktime_get_ts(); ns = timespec_to_ns(&ts); with ns = ktime_get_ns(); Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'drivers/mfd/cros_ec_spi.c')
-rw-r--r--drivers/mfd/cros_ec_spi.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/mfd/cros_ec_spi.c b/drivers/mfd/cros_ec_spi.c
index 0b8d32829166..8c1c7cc373f8 100644
--- a/drivers/mfd/cros_ec_spi.c
+++ b/drivers/mfd/cros_ec_spi.c
@@ -225,7 +225,6 @@ static int cros_ec_command_spi_xfer(struct cros_ec_device *ec_dev,
225 u8 *ptr; 225 u8 *ptr;
226 int sum; 226 int sum;
227 int ret = 0, final_ret; 227 int ret = 0, final_ret;
228 struct timespec ts;
229 228
230 /* 229 /*
231 * We have the shared ec_dev buffer plus we do lots of separate spi_sync 230 * We have the shared ec_dev buffer plus we do lots of separate spi_sync
@@ -239,11 +238,9 @@ static int cros_ec_command_spi_xfer(struct cros_ec_device *ec_dev,
239 238
240 /* If it's too soon to do another transaction, wait */ 239 /* If it's too soon to do another transaction, wait */
241 if (ec_spi->last_transfer_ns) { 240 if (ec_spi->last_transfer_ns) {
242 struct timespec ts;
243 unsigned long delay; /* The delay completed so far */ 241 unsigned long delay; /* The delay completed so far */
244 242
245 ktime_get_ts(&ts); 243 delay = ktime_get_ns() - ec_spi->last_transfer_ns;
246 delay = timespec_to_ns(&ts) - ec_spi->last_transfer_ns;
247 if (delay < EC_SPI_RECOVERY_TIME_NS) 244 if (delay < EC_SPI_RECOVERY_TIME_NS)
248 ndelay(EC_SPI_RECOVERY_TIME_NS - delay); 245 ndelay(EC_SPI_RECOVERY_TIME_NS - delay);
249 } 246 }
@@ -280,8 +277,7 @@ static int cros_ec_command_spi_xfer(struct cros_ec_device *ec_dev,
280 } 277 }
281 278
282 final_ret = spi_sync(ec_spi->spi, &msg); 279 final_ret = spi_sync(ec_spi->spi, &msg);
283 ktime_get_ts(&ts); 280 ec_spi->last_transfer_ns = ktime_get_ns();
284 ec_spi->last_transfer_ns = timespec_to_ns(&ts);
285 if (!ret) 281 if (!ret)
286 ret = final_ret; 282 ret = final_ret;
287 if (ret < 0) { 283 if (ret < 0) {