Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755283AbcCRJ1b (ORCPT ); Fri, 18 Mar 2016 05:27:31 -0400 Received: from www.osadl.org ([62.245.132.105]:50620 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753094AbcCRJ10 (ORCPT ); Fri, 18 Mar 2016 05:27:26 -0400 From: Nicholas Mc Guire To: Joe Perches Cc: "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] net: consolidate lock/unlock into unlock_wait Date: Fri, 18 Mar 2016 10:32:05 +0100 Message-Id: <1458293525-16842-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1154 Lines: 33 The spin_lock()/spin_unlock() is synchronizing on the adapter->work_lock as the comment also suggests, which is equivalent to spin_unlock_wait() but the later should be more efficient. Signed-off-by: Nicholas Mc Guire --- Problem located by coccinelle spatch Patch was compile tested with: x86_64_defconfig + CONFIG_CHELSIO_T1=m Patch is against linux-next (localversion-next is next-20160318) drivers/net/ethernet/chelsio/cxgb/cxgb2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c index f5f1b0b..c5a38dc 100644 --- a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c +++ b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c @@ -282,8 +282,8 @@ static int cxgb_close(struct net_device *dev) !(adapter->open_device_map & PORT_MASK)) { /* Stop statistics accumulation. */ smp_mb__after_atomic(); - spin_lock(&adapter->work_lock); /* sync with update task */ - spin_unlock(&adapter->work_lock); + /* sync with update task */ + spin_unlock_wait(&adapter->work_lock); cancel_mac_stats_update(adapter); } -- 2.1.4