netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miroslav Lichvar <mlichvar@redhat.com>
To: netdev@vger.kernel.org
Cc: Richard Cochran <richardcochran@gmail.com>,
	Jacob Keller <jacob.e.keller@intel.com>,
	Miroslav Lichvar <mlichvar@redhat.com>
Subject: [PATCH net-next 4/8] ptp: deprecate gettime64() in favor of gettimex64()
Date: Fri,  9 Nov 2018 11:14:45 +0100	[thread overview]
Message-ID: <20181109101449.15398-5-mlichvar@redhat.com> (raw)
In-Reply-To: <20181109101449.15398-1-mlichvar@redhat.com>

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>
---
 drivers/ptp/ptp_chardev.c        | 5 ++++-
 drivers/ptp/ptp_clock.c          | 5 ++++-
 include/linux/ptp_clock_kernel.h | 2 ++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index aad0d36cf5c0..797fab33bb98 100644
--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -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;
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index 5419a89d300e..40fda23e4b05 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -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;
 }
 
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index a1ec0448e341..7121bbe76979 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -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
-- 
2.17.2

  parent reply	other threads:[~2018-11-09 19:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09 10:14 [PATCH net-next 0/8] More accurate PHC<->system clock synchronization Miroslav Lichvar
2018-11-09 10:14 ` [PATCH net-next 1/8] ptp: reorder declarations in ptp_ioctl() Miroslav Lichvar
2018-11-09 10:14 ` [PATCH net-next 2/8] ptp: check gettime64 return code in PTP_SYS_OFFSET ioctl Miroslav Lichvar
2018-11-09 10:14 ` [PATCH net-next 3/8] ptp: add PTP_SYS_OFFSET_EXTENDED ioctl Miroslav Lichvar
2019-01-07 15:22   ` [PATCH net 1/2] ptp: check that rsv field is zero in struct ptp_sys_offset_extended Eugene Syromiatnikov
2019-01-07 16:29     ` David Miller
2019-01-07 16:57       ` Miroslav Lichvar
2019-01-07 17:13         ` David Miller
2019-01-08  5:19       ` Richard Cochran
2019-01-08 14:38         ` Eugene Syromiatnikov
2019-01-08 20:45           ` Keller, Jacob E
2019-01-07 15:22   ` [PATCH net 2/2] ptp: uapi: change _IOW to IOWR in PTP_SYS_OFFSET_EXTENDED definition Eugene Syromiatnikov
2019-01-07 16:29     ` David Miller
2018-11-09 10:14 ` Miroslav Lichvar [this message]
2018-11-09 10:14 ` [PATCH net-next 5/8] e1000e: extend PTP gettime function to read system clock Miroslav Lichvar
2018-11-10  1:53   ` Jeff Kirsher
2018-11-09 10:14 ` [PATCH net-next 6/8] igb: " Miroslav Lichvar
2018-11-10  1:53   ` Jeff Kirsher
2018-11-09 10:14 ` [PATCH net-next 7/8] ixgbe: " Miroslav Lichvar
2018-11-09 18:14   ` Keller, Jacob E
2018-11-10  1:52   ` Jeff Kirsher
2018-11-09 10:14 ` [PATCH net-next 8/8] tg3: " Miroslav Lichvar
2018-11-09 18:12 ` [PATCH net-next 0/8] More accurate PHC<->system clock synchronization Keller, Jacob E
2018-11-09 23:28 ` David Miller
2018-11-09 23:33   ` Jeff Kirsher
2018-11-10  0:55     ` David Miller
2018-11-10  1:44   ` Richard Cochran
2018-11-10  3:44     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181109101449.15398-5-mlichvar@redhat.com \
    --to=mlichvar@redhat.com \
    --cc=jacob.e.keller@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).