Skip to content

Commit

Permalink
ptp: use the 64 bit gettime method for the SYS_OFFSET ioctl.
Browse files Browse the repository at this point in the history
This patch changes the code to use the new method whenever implemented by
the PHC driver.

Signed-off-by: Richard Cochran <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
richardcochran authored and davem330 committed Mar 31, 2015
1 parent 92f1719 commit e13cfcb
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions drivers/ptp/ptp_chardev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)))
Expand Down

0 comments on commit e13cfcb

Please sign in to comment.