diff options
| author | Richard Cochran <richardcochran@gmail.com> | 2015-03-29 23:11:53 +0200 | 
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-03-31 12:01:16 -0400 | 
| commit | d7d38f5bd7bece539a6cbb59fc8121f29f63fbdb (patch) | |
| tree | d42c8e003979ad0e0ad80229efd9e36653b6a3a9 /drivers/ptp | |
| parent | e13cfcb03eeccb97d3f8deb393304c6190b61da9 (diff) | |
| download | linux-d7d38f5bd7bece539a6cbb59fc8121f29f63fbdb.tar.bz2 | |
ptp: use the 64 bit get/set time methods for the posix clock.
This patch changes the posix clock code to prefer the new methods
whenever they are implemented by the PHC drivers.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ptp')
| -rw-r--r-- | drivers/ptp/ptp_clock.c | 19 | 
1 files changed, 17 insertions, 2 deletions
| diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c index 296b0ec8744d..df50d5eeae6f 100644 --- a/drivers/ptp/ptp_clock.c +++ b/drivers/ptp/ptp_clock.c @@ -107,13 +107,28 @@ static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp)  static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp)  {  	struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); -	return ptp->info->settime(ptp->info, tp); +	struct timespec64 ts = timespec_to_timespec64(*tp); + +	return  ptp->info->settime64 ? +		ptp->info->settime64(ptp->info, &ts) : +		ptp->info->settime(ptp->info, tp);  }  static int ptp_clock_gettime(struct posix_clock *pc, struct timespec *tp)  {  	struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); -	return ptp->info->gettime(ptp->info, tp); +	struct timespec64 ts; +	int err; + +	if (ptp->info->gettime64) { +		err = ptp->info->gettime64(ptp->info, &ts); +		if (!err) +			*tp = timespec64_to_timespec(ts); +	} else { +		err = ptp->info->gettime(ptp->info, tp); +	} + +	return err;  }  static int ptp_clock_adjtime(struct posix_clock *pc, struct timex *tx) |