Commit 2b3d9655 authored by Manuel Schölling's avatar Manuel Schölling Committed by David S. Miller

qlogic: Use time_before()

To be future-proof and for better readability the time comparisons are modified
to use time_before() instead of plain, error-prone math.
Signed-off-by: default avatarManuel Schölling <manuel.schoelling@gmx.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ff1f9747
...@@ -620,7 +620,7 @@ void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter) ...@@ -620,7 +620,7 @@ void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter)
struct hlist_node *n; struct hlist_node *n;
struct hlist_head *head; struct hlist_head *head;
int i; int i;
unsigned long time; unsigned long expires;
u8 cmd; u8 cmd;
for (i = 0; i < adapter->fhash.fbucket_size; i++) { for (i = 0; i < adapter->fhash.fbucket_size; i++) {
...@@ -628,8 +628,8 @@ void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter) ...@@ -628,8 +628,8 @@ void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter)
hlist_for_each_entry_safe(tmp_fil, n, head, fnode) { hlist_for_each_entry_safe(tmp_fil, n, head, fnode) {
cmd = tmp_fil->vlan_id ? QLCNIC_MAC_VLAN_DEL : cmd = tmp_fil->vlan_id ? QLCNIC_MAC_VLAN_DEL :
QLCNIC_MAC_DEL; QLCNIC_MAC_DEL;
time = tmp_fil->ftime; expires = tmp_fil->ftime + QLCNIC_FILTER_AGE * HZ;
if (jiffies > (QLCNIC_FILTER_AGE * HZ + time)) { if (time_before(expires, jiffies)) {
qlcnic_sre_macaddr_change(adapter, qlcnic_sre_macaddr_change(adapter,
tmp_fil->faddr, tmp_fil->faddr,
tmp_fil->vlan_id, tmp_fil->vlan_id,
...@@ -647,8 +647,8 @@ void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter) ...@@ -647,8 +647,8 @@ void qlcnic_prune_lb_filters(struct qlcnic_adapter *adapter)
hlist_for_each_entry_safe(tmp_fil, n, head, fnode) hlist_for_each_entry_safe(tmp_fil, n, head, fnode)
{ {
time = tmp_fil->ftime; expires = tmp_fil->ftime + QLCNIC_FILTER_AGE * HZ;
if (jiffies > (QLCNIC_FILTER_AGE * HZ + time)) { if (time_before(expires, jiffies)) {
spin_lock_bh(&adapter->rx_mac_learn_lock); spin_lock_bh(&adapter->rx_mac_learn_lock);
adapter->rx_fhash.fnum--; adapter->rx_fhash.fnum--;
hlist_del(&tmp_fil->fnode); hlist_del(&tmp_fil->fnode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment