]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/ethernet/broadcom/tg3.c
ptp: tg3: use helpers for converting ns to timespec.
[karo-tx-linux.git] / drivers / net / ethernet / broadcom / tg3.c
index 23a019cee279af1e502d05dc5f2363372d35b2ce..1270b189a9a2ffd7776985f8e0a96fada80f8de8 100644 (file)
@@ -6217,10 +6217,9 @@ static int tg3_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
        return 0;
 }
 
-static int tg3_ptp_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
+static int tg3_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
 {
        u64 ns;
-       u32 remainder;
        struct tg3 *tp = container_of(ptp, struct tg3, ptp_info);
 
        tg3_full_lock(tp, 0);
@@ -6228,19 +6227,18 @@ static int tg3_ptp_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
        ns += tp->ptp_adjust;
        tg3_full_unlock(tp);
 
-       ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder);
-       ts->tv_nsec = remainder;
+       *ts = ns_to_timespec64(ns);
 
        return 0;
 }
 
 static int tg3_ptp_settime(struct ptp_clock_info *ptp,
-                          const struct timespec *ts)
+                          const struct timespec64 *ts)
 {
        u64 ns;
        struct tg3 *tp = container_of(ptp, struct tg3, ptp_info);
 
-       ns = timespec_to_ns(ts);
+       ns = timespec64_to_ns(ts);
 
        tg3_full_lock(tp, 0);
        tg3_refclk_write(tp, ns);
@@ -6320,8 +6318,8 @@ static const struct ptp_clock_info tg3_ptp_caps = {
        .pps            = 0,
        .adjfreq        = tg3_ptp_adjfreq,
        .adjtime        = tg3_ptp_adjtime,
-       .gettime        = tg3_ptp_gettime,
-       .settime        = tg3_ptp_settime,
+       .gettime64      = tg3_ptp_gettime,
+       .settime64      = tg3_ptp_settime,
        .enable         = tg3_ptp_enable,
 };
 
@@ -7244,7 +7242,7 @@ static int tg3_poll_msix(struct napi_struct *napi, int budget)
                        if (tnapi == &tp->napi[1] && tp->rx_refill)
                                continue;
 
-                       napi_complete(napi);
+                       napi_complete_done(napi, work_done);
                        /* Reenable interrupts. */
                        tw32_mailbox(tnapi->int_mbox, tnapi->last_tag << 24);
 
@@ -7337,7 +7335,7 @@ static int tg3_poll(struct napi_struct *napi, int budget)
                        sblk->status &= ~SD_STATUS_UPDATED;
 
                if (likely(!tg3_has_work(tnapi))) {
-                       napi_complete(napi);
+                       napi_complete_done(napi, work_done);
                        tg3_int_reenable(tnapi);
                        break;
                }