diff options
author | Frank Li <Frank.Li@freescale.com> | 2012-11-06 20:14:49 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-07 18:52:12 -0500 |
commit | 7da716aee2532399e213a14f656d304098f67a11 (patch) | |
tree | 7d294e94fc51a1b7e7ab1d9f7822d50e74670f6d /drivers/net/ethernet | |
parent | 0f2f7a40f9ae91b9e837c3cd2cacd7f46c168eb1 (diff) | |
download | linux-7da716aee2532399e213a14f656d304098f67a11.tar.bz2 |
net: fec: reduce spin lock time in fec_ptp_adjfreq
move below calculate out of spin lock section
diff = fep->cc.mult;
diff *= ppb;
diff = div_u64(diff, 1000000000ULL);
diff is local variable and not neccesary in spin lock
Signed-off-by: Frank Li <Frank.Li@freescale.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/freescale/fec_ptp.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index 5352140468ce..c40526c78c20 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -145,6 +145,7 @@ static int fec_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) u64 diff; unsigned long flags; int neg_adj = 0; + u32 mult = FEC_CC_MULT; struct fec_enet_private *fep = container_of(ptp, struct fec_enet_private, ptp_caps); @@ -154,6 +155,10 @@ static int fec_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) neg_adj = 1; } + diff = mult; + diff *= ppb; + diff = div_u64(diff, 1000000000ULL); + spin_lock_irqsave(&fep->tmreg_lock, flags); /* * dummy read to set cycle_last in tc to now. @@ -161,15 +166,8 @@ static int fec_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) * timercounter_read. */ timecounter_read(&fep->tc); - fep->cc.mult = FEC_CC_MULT; - diff = fep->cc.mult; - diff *= ppb; - diff = div_u64(diff, 1000000000ULL); - if (neg_adj) - fep->cc.mult -= diff; - else - fep->cc.mult += diff; + fep->cc.mult = neg_adj ? mult - diff : mult + diff; spin_unlock_irqrestore(&fep->tmreg_lock, flags); |