Commit 9545f4e2 authored by Wei Yongjun's avatar Wei Yongjun Committed by David S. Miller

ptp: use list_move instead of list_del/list_add

Using list_move() instead of list_del() + list_add().

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d717f14e
...@@ -640,8 +640,7 @@ static void efx_ptp_drop_time_expired_events(struct efx_nic *efx) ...@@ -640,8 +640,7 @@ static void efx_ptp_drop_time_expired_events(struct efx_nic *efx)
evt = list_entry(cursor, struct efx_ptp_event_rx, evt = list_entry(cursor, struct efx_ptp_event_rx,
link); link);
if (time_after(jiffies, evt->expiry)) { if (time_after(jiffies, evt->expiry)) {
list_del(&evt->link); list_move(&evt->link, &ptp->evt_free_list);
list_add(&evt->link, &ptp->evt_free_list);
netif_warn(efx, hw, efx->net_dev, netif_warn(efx, hw, efx->net_dev,
"PTP rx event dropped\n"); "PTP rx event dropped\n");
} }
...@@ -684,8 +683,7 @@ static enum ptp_packet_state efx_ptp_match_rx(struct efx_nic *efx, ...@@ -684,8 +683,7 @@ static enum ptp_packet_state efx_ptp_match_rx(struct efx_nic *efx,
match->state = PTP_PACKET_STATE_MATCHED; match->state = PTP_PACKET_STATE_MATCHED;
rc = PTP_PACKET_STATE_MATCHED; rc = PTP_PACKET_STATE_MATCHED;
list_del(&evt->link); list_move(&evt->link, &ptp->evt_free_list);
list_add(&evt->link, &ptp->evt_free_list);
break; break;
} }
} }
...@@ -820,8 +818,7 @@ static int efx_ptp_stop(struct efx_nic *efx) ...@@ -820,8 +818,7 @@ static int efx_ptp_stop(struct efx_nic *efx)
/* Drop any pending receive events */ /* Drop any pending receive events */
spin_lock_bh(&efx->ptp_data->evt_lock); spin_lock_bh(&efx->ptp_data->evt_lock);
list_for_each_safe(cursor, next, &efx->ptp_data->evt_list) { list_for_each_safe(cursor, next, &efx->ptp_data->evt_list) {
list_del(cursor); list_move(cursor, &efx->ptp_data->evt_free_list);
list_add(cursor, &efx->ptp_data->evt_free_list);
} }
spin_unlock_bh(&efx->ptp_data->evt_lock); spin_unlock_bh(&efx->ptp_data->evt_lock);
......
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