Skip to content

Commit

Permalink
mfd: cros_ec_spi: Use ktime_get_ns()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Gleixner authored and John Stultz committed Jul 23, 2014
1 parent 9e93f21 commit 154adc1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/mfd/cros_ec_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ static int cros_ec_command_spi_xfer(struct cros_ec_device *ec_dev,
u8 *ptr;
int sum;
int ret = 0, final_ret;
struct timespec ts;

/*
* We have the shared ec_dev buffer plus we do lots of separate spi_sync
Expand All @@ -239,11 +238,9 @@ static int cros_ec_command_spi_xfer(struct cros_ec_device *ec_dev,

/* If it's too soon to do another transaction, wait */
if (ec_spi->last_transfer_ns) {
struct timespec ts;
unsigned long delay; /* The delay completed so far */

ktime_get_ts(&ts);
delay = timespec_to_ns(&ts) - ec_spi->last_transfer_ns;
delay = ktime_get_ns() - ec_spi->last_transfer_ns;
if (delay < EC_SPI_RECOVERY_TIME_NS)
ndelay(EC_SPI_RECOVERY_TIME_NS - delay);
}
Expand Down Expand Up @@ -280,8 +277,7 @@ static int cros_ec_command_spi_xfer(struct cros_ec_device *ec_dev,
}

final_ret = spi_sync(ec_spi->spi, &msg);
ktime_get_ts(&ts);
ec_spi->last_transfer_ns = timespec_to_ns(&ts);
ec_spi->last_transfer_ns = ktime_get_ns();
if (!ret)
ret = final_ret;
if (ret < 0) {
Expand Down

0 comments on commit 154adc1

Please sign in to comment.