Skip to content

Commit 916444d

Browse files
mlichvardavem330
authored andcommitted
ptp: deprecate gettime64() in favor of gettimex64()
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 <richardcochran@gmail.com> Cc: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 3618008 commit 916444d

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

drivers/ptp/ptp_chardev.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,10 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
260260
pct->sec = ts.tv_sec;
261261
pct->nsec = ts.tv_nsec;
262262
pct++;
263-
err = ptp->info->gettime64(ptp->info, &ts);
263+
if (ops->gettimex64)
264+
err = ops->gettimex64(ops, &ts, NULL);
265+
else
266+
err = ops->gettime64(ops, &ts);
264267
if (err)
265268
goto out;
266269
pct->sec = ts.tv_sec;

drivers/ptp/ptp_clock.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ static int ptp_clock_gettime(struct posix_clock *pc, struct timespec64 *tp)
117117
struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
118118
int err;
119119

120-
err = ptp->info->gettime64(ptp->info, tp);
120+
if (ptp->info->gettimex64)
121+
err = ptp->info->gettimex64(ptp->info, tp, NULL);
122+
else
123+
err = ptp->info->gettime64(ptp->info, tp);
121124
return err;
122125
}
123126

include/linux/ptp_clock_kernel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ struct ptp_system_timestamp {
8282
* parameter delta: Desired change in nanoseconds.
8383
*
8484
* @gettime64: Reads the current time from the hardware clock.
85+
* This method is deprecated. New drivers should implement
86+
* the @gettimex64 method instead.
8587
* parameter ts: Holds the result.
8688
*
8789
* @gettimex64: Reads the current time from the hardware clock and optionally

0 commit comments

Comments
 (0)