Thread (40 messages) 40 messages, 6 authors, 2015-03-31
STALE4077d
Revisions (2)
  1. v2 current
  2. v3 [diff vs current]

[PATCH net-next V2 19/23] ptp: tilegx: convert to the 64 bit get/set time methods.

From: Richard Cochran <richardcochran@gmail.com>
Date: 2015-03-21 21:40:42
Also in: lkml
Subsystem: networking drivers, the rest · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

This driver calls code (via gxio_mpipe_get/set_timestamp) that makes
the assumption that the tv_sec field is 64 bits wide.  So apparently
this driver is 64 bit only.  So maybe this driver and device are ready
for 2038, but maybe not.

Not even compile tested.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/ethernet/tile/tilegx.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c
index bea8cd2..614ea83 100644
--- a/drivers/net/ethernet/tile/tilegx.c
+++ b/drivers/net/ethernet/tile/tilegx.c
@@ -838,24 +838,28 @@ static int ptp_mpipe_adjtime(struct ptp_clock_info *ptp, s64 delta)
 	return ret;
 }
 
-static int ptp_mpipe_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
+static int ptp_mpipe_gettime(struct ptp_clock_info *ptp,
+			     struct timespec64 *ts64)
 {
 	int ret = 0;
 	struct mpipe_data *md = container_of(ptp, struct mpipe_data, caps);
+	struct timespec ts;
 	mutex_lock(&md->ptp_lock);
-	if (gxio_mpipe_get_timestamp(&md->context, ts))
+	if (gxio_mpipe_get_timestamp(&md->context, &ts))
 		ret = -EBUSY;
 	mutex_unlock(&md->ptp_lock);
+	*ts64 = timespec_to_timespec64(ts);
 	return ret;
 }
 
 static int ptp_mpipe_settime(struct ptp_clock_info *ptp,
-			     const struct timespec *ts)
+			     const struct timespec64 *ts64)
 {
 	int ret = 0;
+	struct timespec ts = timespec64_to_timespec(*ts64);
 	struct mpipe_data *md = container_of(ptp, struct mpipe_data, caps);
 	mutex_lock(&md->ptp_lock);
-	if (gxio_mpipe_set_timestamp(&md->context, ts))
+	if (gxio_mpipe_set_timestamp(&md->context, &ts))
 		ret = -EBUSY;
 	mutex_unlock(&md->ptp_lock);
 	return ret;
@@ -876,8 +880,8 @@ static struct ptp_clock_info ptp_mpipe_caps = {
 	.pps		= 0,
 	.adjfreq	= ptp_mpipe_adjfreq,
 	.adjtime	= ptp_mpipe_adjtime,
-	.gettime	= ptp_mpipe_gettime,
-	.settime	= ptp_mpipe_settime,
+	.gettime64	= ptp_mpipe_gettime,
+	.settime64	= ptp_mpipe_settime,
 	.enable		= ptp_mpipe_enable,
 };
 
-- 
1.7.10.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help