From patchwork Sun Oct 7 13:41:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 189829 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0EBF22C0314 for ; Mon, 8 Oct 2012 00:41:54 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753120Ab2JGNlw (ORCPT ); Sun, 7 Oct 2012 09:41:52 -0400 Received: from mail-qc0-f180.google.com ([209.85.216.180]:43723 "EHLO mail-qc0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753047Ab2JGNlv (ORCPT ); Sun, 7 Oct 2012 09:41:51 -0400 Received: by mail-qc0-f180.google.com with SMTP id v28so2205151qcm.11 for ; Sun, 07 Oct 2012 06:41:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=ftupu1vQWCyXw/S9Pbd7B/I3B3UI0nJPvk5CBp89J2w=; b=MgwoCGhIoxhqHvJA8Rlo0rQpoR/RwcQIv6bYkATYShlQGSzApWMQ4IwO0yxUasmmX/ HsBoDp2elhZ1i1S69oBAi2fw+zgYBi0TF1skdGJpot/CETjOBBh0SK5KyqYLUoB0/kGk ftCybUJIygVGkAAJpH8G79UPlgowfOzmCTHJcJhiNhBMvOuu9QqIVUqer/7l5j2/LCS6 UR0nUAPl+pMmPSpYNCV94vIajiQTyeX4JuHazFB6o+jFGbv8FIODmAAN80Biwg9qyilc v+J7rY8+E564/4OnloIFfqQq9NR2bC9hps3o2T8VOOC3wgxWUhCXZiXey/HX191aY/zl 221w== MIME-Version: 1.0 Received: by 10.229.136.131 with SMTP id r3mr5854495qct.145.1349617310314; Sun, 07 Oct 2012 06:41:50 -0700 (PDT) Received: by 10.229.146.194 with HTTP; Sun, 7 Oct 2012 06:41:50 -0700 (PDT) Date: Sun, 7 Oct 2012 21:41:50 +0800 Message-ID: Subject: [PATCH] ptp: use list_move instead of list_del/list_add From: Wei Yongjun To: linux-net-drivers@solarflare.com, bhutchings@solarflare.com Cc: yongjun_wei@trendmicro.com.cn, netdev@vger.kernel.org Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Wei Yongjun 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: Wei Yongjun --- drivers/net/ethernet/sfc/ptp.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c index 5b3dd02..0767043f 100644 --- a/drivers/net/ethernet/sfc/ptp.c +++ b/drivers/net/ethernet/sfc/ptp.c @@ -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, link); if (time_after(jiffies, evt->expiry)) { - list_del(&evt->link); - list_add(&evt->link, &ptp->evt_free_list); + list_move(&evt->link, &ptp->evt_free_list); netif_warn(efx, hw, efx->net_dev, "PTP rx event dropped\n"); } @@ -684,8 +683,7 @@ static enum ptp_packet_state efx_ptp_match_rx(struct efx_nic *efx, match->state = PTP_PACKET_STATE_MATCHED; rc = PTP_PACKET_STATE_MATCHED; - list_del(&evt->link); - list_add(&evt->link, &ptp->evt_free_list); + list_move(&evt->link, &ptp->evt_free_list); break; } } @@ -820,8 +818,7 @@ static int efx_ptp_stop(struct efx_nic *efx) /* Drop any pending receive events */ spin_lock_bh(&efx->ptp_data->evt_lock); list_for_each_safe(cursor, next, &efx->ptp_data->evt_list) { - list_del(cursor); - list_add(cursor, &efx->ptp_data->evt_free_list); + list_move(cursor, &efx->ptp_data->evt_free_list); } spin_unlock_bh(&efx->ptp_data->evt_lock);