]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ptp: use the 64 bit gettime method for the SYS_OFFSET ioctl.
authorRichard Cochran <richardcochran@gmail.com>
Sun, 29 Mar 2015 21:11:52 +0000 (23:11 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 31 Mar 2015 16:01:16 +0000 (12:01 -0400)
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>
drivers/ptp/ptp_chardev.c

index f8a76090cbca1e8bbf694a4fbc16a54ef60490d5..95bcf1525a8434ce8083f947e0713f1946c17673 100644 (file)
@@ -124,7 +124,8 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
        struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
        struct ptp_clock_info *ops = ptp->info;
        struct ptp_clock_time *pct;
-       struct timespec ts;
+       struct timespec64 ts;
+       struct timespec t2;
        int enable, err = 0;
        unsigned int i, pin_index;
 
@@ -197,16 +198,21 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
                }
                pct = &sysoff->ts[0];
                for (i = 0; i < sysoff->n_samples; i++) {
-                       getnstimeofday(&ts);
+                       getnstimeofday64(&ts);
                        pct->sec = ts.tv_sec;
                        pct->nsec = ts.tv_nsec;
                        pct++;
-                       ptp->info->gettime(ptp->info, &ts);
+                       if (ptp->info->gettime64) {
+                               ptp->info->gettime64(ptp->info, &ts);
+                       } else {
+                               ptp->info->gettime(ptp->info, &t2);
+                               ts = timespec_to_timespec64(t2);
+                       }
                        pct->sec = ts.tv_sec;
                        pct->nsec = ts.tv_nsec;
                        pct++;
                }
-               getnstimeofday(&ts);
+               getnstimeofday64(&ts);
                pct->sec = ts.tv_sec;
                pct->nsec = ts.tv_nsec;
                if (copy_to_user((void __user *)arg, sysoff, sizeof(*sysoff)))