netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: consolidate lock/unlock into unlock_wait
@ 2016-03-18  9:32 Nicholas Mc Guire
  2016-03-18 21:37 ` David Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Nicholas Mc Guire @ 2016-03-18  9:32 UTC (permalink / raw)
  To: Joe Perches; +Cc: David S. Miller, netdev, linux-kernel, Nicholas Mc Guire

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 <hofrat@osadl.org>
---

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-03-19 15:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-18  9:32 [PATCH] net: consolidate lock/unlock into unlock_wait Nicholas Mc Guire
2016-03-18 21:37 ` David Miller
2016-03-18 22:35   ` Joe Perches
2016-03-19  0:33     ` [RFC net-next 0/2] Create ancient subdirectories for old hardware Joe Perches
2016-03-19  0:33       ` [RFC net-next 1/2] drivers/net: Create an ANCIENT_NETDEVICES symbol Joe Perches
2016-03-19  0:33       ` [RFC net-next 2/2] chelsio: Move original cxgb driver into ancient subdirectory Joe Perches
2016-03-19  2:11       ` [RFC net-next 0/2] Create ancient subdirectories for old hardware David Miller
2016-03-19  2:28         ` Joe Perches
2016-03-19  3:16           ` David Miller
2016-03-19 15:36             ` Joe Perches
2016-03-19  7:24     ` [PATCH] net: consolidate lock/unlock into unlock_wait Nicholas Mc Guire

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).