diff options
author | Veaceslav Falico <vfalico@redhat.com> | 2013-08-03 03:50:36 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-05 12:19:45 -0700 |
commit | e7f63f1dc4bd643d9249c653e60c530d4a438147 (patch) | |
tree | 7a8d9bcb5951e88100f2e466c7f19d2719871d82 /drivers/staging | |
parent | def4460cdb171d64309c927907c18c4efcb0204b (diff) |
bonding: add bond_time_in_interval() and use it for time comparison
Currently we use a lot of time comparison math for arp_interval
comparisons, which are sometimes quite hard to read and understand.
All the time comparisons have one pattern:
(time - arp_interval_jiffies) <= jiffies <= (time + mod *
arp_interval_jiffies + arp_interval_jiffies/2)
Introduce a new helper - bond_time_in_interval(), which will do the math in
one place and, thus, will clean up the logical code. This helper introduces
a bit of overhead (by always calculating the jiffies from arp_interval),
however it's really not visible, considering that functions using it
usually run once in arp_interval milliseconds.
There are several lines slightly over 80 chars, however breaking them would
result in more hard-to-read code than several character after the 80 mark.
CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/staging')
0 files changed, 0 insertions, 0 deletions