diff options
author | Richard Cochran <richardcochran@gmail.com> | 2015-03-29 17:11:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-31 12:01:16 -0400 |
commit | d7d38f5bd7bece539a6cbb59fc8121f29f63fbdb (patch) | |
tree | d42c8e003979ad0e0ad80229efd9e36653b6a3a9 /drivers/ptp/ptp_clock.c | |
parent | e13cfcb03eeccb97d3f8deb393304c6190b61da9 (diff) |
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/ptp_clock.c')
-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) | |||
107 | static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp) | 107 | static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp) |
108 | { | 108 | { |
109 | struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); | 109 | struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); |
110 | return ptp->info->settime(ptp->info, tp); | 110 | struct timespec64 ts = timespec_to_timespec64(*tp); |
111 | |||
112 | return ptp->info->settime64 ? | ||
113 | ptp->info->settime64(ptp->info, &ts) : | ||
114 | ptp->info->settime(ptp->info, tp); | ||
111 | } | 115 | } |
112 | 116 | ||
113 | static int ptp_clock_gettime(struct posix_clock *pc, struct timespec *tp) | 117 | static int ptp_clock_gettime(struct posix_clock *pc, struct timespec *tp) |
114 | { | 118 | { |
115 | struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); | 119 | struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); |
116 | return ptp->info->gettime(ptp->info, tp); | 120 | struct timespec64 ts; |
121 | int err; | ||
122 | |||
123 | if (ptp->info->gettime64) { | ||
124 | err = ptp->info->gettime64(ptp->info, &ts); | ||
125 | if (!err) | ||
126 | *tp = timespec64_to_timespec(ts); | ||
127 | } else { | ||
128 | err = ptp->info->gettime(ptp->info, tp); | ||
129 | } | ||
130 | |||
131 | return err; | ||
117 | } | 132 | } |
118 | 133 | ||
119 | static int ptp_clock_adjtime(struct posix_clock *pc, struct timex *tx) | 134 | static int ptp_clock_adjtime(struct posix_clock *pc, struct timex *tx) |