diff options
author | Kefeng Wang <wangkefeng.wang@huawei.com> | 2016-01-27 21:27:19 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-01-29 15:38:59 -0500 |
commit | b83ef507d9e2bc25cea40b1fb13ebd1ca7c4969a (patch) | |
tree | 1ba15767135207cb9f9e1f682e84b1b58619dec6 | |
parent | 21603fc45bdef3696f45d80a1c9d730e06b925c5 (diff) |
ptp: ixp46x: use helpers for converting ns to timespec
Convert the driver to use ns_to_timespec64() and timespec64_to_ns()
instead of open coding the same logic.
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/ptp/ptp_ixp46x.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/ptp/ptp_ixp46x.c b/drivers/ptp/ptp_ixp46x.c index 934c139916c6..ee4f183ef9ee 100644 --- a/drivers/ptp/ptp_ixp46x.c +++ b/drivers/ptp/ptp_ixp46x.c | |||
@@ -178,7 +178,6 @@ static int ptp_ixp_adjtime(struct ptp_clock_info *ptp, s64 delta) | |||
178 | static int ptp_ixp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) | 178 | static int ptp_ixp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) |
179 | { | 179 | { |
180 | u64 ns; | 180 | u64 ns; |
181 | u32 remainder; | ||
182 | unsigned long flags; | 181 | unsigned long flags; |
183 | struct ixp_clock *ixp_clock = container_of(ptp, struct ixp_clock, caps); | 182 | struct ixp_clock *ixp_clock = container_of(ptp, struct ixp_clock, caps); |
184 | struct ixp46x_ts_regs *regs = ixp_clock->regs; | 183 | struct ixp46x_ts_regs *regs = ixp_clock->regs; |
@@ -189,8 +188,7 @@ static int ptp_ixp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) | |||
189 | 188 | ||
190 | spin_unlock_irqrestore(®ister_lock, flags); | 189 | spin_unlock_irqrestore(®ister_lock, flags); |
191 | 190 | ||
192 | ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder); | 191 | *ts = ns_to_timespec64(ns); |
193 | ts->tv_nsec = remainder; | ||
194 | return 0; | 192 | return 0; |
195 | } | 193 | } |
196 | 194 | ||
@@ -202,8 +200,7 @@ static int ptp_ixp_settime(struct ptp_clock_info *ptp, | |||
202 | struct ixp_clock *ixp_clock = container_of(ptp, struct ixp_clock, caps); | 200 | struct ixp_clock *ixp_clock = container_of(ptp, struct ixp_clock, caps); |
203 | struct ixp46x_ts_regs *regs = ixp_clock->regs; | 201 | struct ixp46x_ts_regs *regs = ixp_clock->regs; |
204 | 202 | ||
205 | ns = ts->tv_sec * 1000000000ULL; | 203 | ns = timespec64_to_ns(ts); |
206 | ns += ts->tv_nsec; | ||
207 | 204 | ||
208 | spin_lock_irqsave(®ister_lock, flags); | 205 | spin_lock_irqsave(®ister_lock, flags); |
209 | 206 | ||