Skip to content

Commit

Permalink
ptp: deprecate gettime64() in favor of gettimex64()
Browse files Browse the repository at this point in the history
When a driver provides gettimex64(), use it in the PTP_SYS_OFFSET ioctl
and POSIX clock's gettime() instead of gettime64(). Drivers should
provide only one of the functions.

Cc: Richard Cochran <[email protected]>
Cc: Jacob Keller <[email protected]>
Signed-off-by: Miroslav Lichvar <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
mlichvar authored and davem330 committed Nov 10, 2018
1 parent 3618008 commit 916444d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion drivers/ptp/ptp_chardev.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
pct->sec = ts.tv_sec;
pct->nsec = ts.tv_nsec;
pct++;
err = ptp->info->gettime64(ptp->info, &ts);
if (ops->gettimex64)
err = ops->gettimex64(ops, &ts, NULL);
else
err = ops->gettime64(ops, &ts);
if (err)
goto out;
pct->sec = ts.tv_sec;
Expand Down
5 changes: 4 additions & 1 deletion drivers/ptp/ptp_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ static int ptp_clock_gettime(struct posix_clock *pc, struct timespec64 *tp)
struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
int err;

err = ptp->info->gettime64(ptp->info, tp);
if (ptp->info->gettimex64)
err = ptp->info->gettimex64(ptp->info, tp, NULL);
else
err = ptp->info->gettime64(ptp->info, tp);
return err;
}

Expand Down
2 changes: 2 additions & 0 deletions include/linux/ptp_clock_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ struct ptp_system_timestamp {
* parameter delta: Desired change in nanoseconds.
*
* @gettime64: Reads the current time from the hardware clock.
* This method is deprecated. New drivers should implement
* the @gettimex64 method instead.
* parameter ts: Holds the result.
*
* @gettimex64: Reads the current time from the hardware clock and optionally
Expand Down

0 comments on commit 916444d

Please sign in to comment.