diff options
author | Richard Cochran <richardcochran@gmail.com> | 2015-03-29 17:11:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-31 12:01:16 -0400 |
commit | e13cfcb03eeccb97d3f8deb393304c6190b61da9 (patch) | |
tree | 5d2270509d1297275040c55feb850a144dd31210 | |
parent | 92f1719407b90475b3be0b7b9c983dec2ff8351e (diff) |
ptp: use the 64 bit gettime method for the SYS_OFFSET ioctl.
This patch changes the code to use the new method whenever implemented by
the PHC driver.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/ptp/ptp_chardev.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c index f8a76090cbca..95bcf1525a84 100644 --- a/drivers/ptp/ptp_chardev.c +++ b/drivers/ptp/ptp_chardev.c | |||
@@ -124,7 +124,8 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) | |||
124 | struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); | 124 | struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); |
125 | struct ptp_clock_info *ops = ptp->info; | 125 | struct ptp_clock_info *ops = ptp->info; |
126 | struct ptp_clock_time *pct; | 126 | struct ptp_clock_time *pct; |
127 | struct timespec ts; | 127 | struct timespec64 ts; |
128 | struct timespec t2; | ||
128 | int enable, err = 0; | 129 | int enable, err = 0; |
129 | unsigned int i, pin_index; | 130 | unsigned int i, pin_index; |
130 | 131 | ||
@@ -197,16 +198,21 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) | |||
197 | } | 198 | } |
198 | pct = &sysoff->ts[0]; | 199 | pct = &sysoff->ts[0]; |
199 | for (i = 0; i < sysoff->n_samples; i++) { | 200 | for (i = 0; i < sysoff->n_samples; i++) { |
200 | getnstimeofday(&ts); | 201 | getnstimeofday64(&ts); |
201 | pct->sec = ts.tv_sec; | 202 | pct->sec = ts.tv_sec; |
202 | pct->nsec = ts.tv_nsec; | 203 | pct->nsec = ts.tv_nsec; |
203 | pct++; | 204 | pct++; |
204 | ptp->info->gettime(ptp->info, &ts); | 205 | if (ptp->info->gettime64) { |
206 | ptp->info->gettime64(ptp->info, &ts); | ||
207 | } else { | ||
208 | ptp->info->gettime(ptp->info, &t2); | ||
209 | ts = timespec_to_timespec64(t2); | ||
210 | } | ||
205 | pct->sec = ts.tv_sec; | 211 | pct->sec = ts.tv_sec; |
206 | pct->nsec = ts.tv_nsec; | 212 | pct->nsec = ts.tv_nsec; |
207 | pct++; | 213 | pct++; |
208 | } | 214 | } |
209 | getnstimeofday(&ts); | 215 | getnstimeofday64(&ts); |
210 | pct->sec = ts.tv_sec; | 216 | pct->sec = ts.tv_sec; |
211 | pct->nsec = ts.tv_nsec; | 217 | pct->nsec = ts.tv_nsec; |
212 | if (copy_to_user((void __user *)arg, sysoff, sizeof(*sysoff))) | 218 | if (copy_to_user((void __user *)arg, sysoff, sizeof(*sysoff))) |