Commit d7d38f5b authored by Richard Cochran's avatar Richard Cochran Committed by David S. Miller

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: default avatarRichard Cochran <richardcochran@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e13cfcb0
...@@ -107,13 +107,28 @@ static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp) ...@@ -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) static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp)
{ {
struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); 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) static int ptp_clock_gettime(struct posix_clock *pc, struct timespec *tp)
{ {
struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); 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) static int ptp_clock_adjtime(struct posix_clock *pc, struct timex *tx)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment