This patch changes the 32-bit time type (timespec) to the 64-bit one
(ktime_t), since 32-bit time types will break in the year 2038.

This patch implements the getktime/setktime interfaces with
"ktime_t" type, and removes the gettime/settime interfaces with
"timespec" type in ptp_ixp46x.c file.

Signed-off-by: Baolin Wang <[email protected]>
---
 drivers/ptp/ptp_ixp46x.c |   21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/ptp/ptp_ixp46x.c b/drivers/ptp/ptp_ixp46x.c
index 604d340..102b673 100644
--- a/drivers/ptp/ptp_ixp46x.c
+++ b/drivers/ptp/ptp_ixp46x.c
@@ -175,39 +175,30 @@ static int ptp_ixp_adjtime(struct ptp_clock_info *ptp, 
s64 delta)
        return 0;
 }
 
-static int ptp_ixp_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
+static int ptp_ixp_getktime(struct ptp_clock_info *ptp, ktime_t *kt)
 {
-       u64 ns;
-       u32 remainder;
        unsigned long flags;
        struct ixp_clock *ixp_clock = container_of(ptp, struct ixp_clock, caps);
        struct ixp46x_ts_regs *regs = ixp_clock->regs;
 
        spin_lock_irqsave(&register_lock, flags);
 
-       ns = ixp_systime_read(regs);
+       *kt = ns_to_ktime(ixp_systime_read(regs));
 
        spin_unlock_irqrestore(&register_lock, flags);
 
-       ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder);
-       ts->tv_nsec = remainder;
        return 0;
 }
 
-static int ptp_ixp_settime(struct ptp_clock_info *ptp,
-                          const struct timespec *ts)
+static int ptp_ixp_setktime(struct ptp_clock_info *ptp, ktime_t kt)
 {
-       u64 ns;
        unsigned long flags;
        struct ixp_clock *ixp_clock = container_of(ptp, struct ixp_clock, caps);
        struct ixp46x_ts_regs *regs = ixp_clock->regs;
 
-       ns = ts->tv_sec * 1000000000ULL;
-       ns += ts->tv_nsec;
-
        spin_lock_irqsave(&register_lock, flags);
 
-       ixp_systime_write(regs, ns);
+       ixp_systime_write(regs, ktime_to_ns(kt));
 
        spin_unlock_irqrestore(&register_lock, flags);
 
@@ -248,8 +239,8 @@ static struct ptp_clock_info ptp_ixp_caps = {
        .pps            = 0,
        .adjfreq        = ptp_ixp_adjfreq,
        .adjtime        = ptp_ixp_adjtime,
-       .gettime        = ptp_ixp_gettime,
-       .settime        = ptp_ixp_settime,
+       .getktime       = ptp_ixp_getktime,
+       .setktime       = ptp_ixp_setktime,
        .enable         = ptp_ixp_enable,
 };
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to