From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wang Chen Subject: [PATCH 4/4] sky2: rtnl_lock out of loop will be faster Date: Wed, 12 Dec 2007 16:50:09 +0800 Message-ID: <475FA0C1.8000701@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: shemminger@linux-foundation.org, netdev@vger.kernel.org, Wang Chen To: "David S. Miller" , Jeff Garzik Return-path: Received: from [222.73.24.84] ([222.73.24.84]:49750 "EHLO song.cn.fujitsu.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1755763AbXLLIxH (ORCPT ); Wed, 12 Dec 2007 03:53:07 -0500 Sender: netdev-owner@vger.kernel.org List-ID: [PATCH 4/4] [NETDEV] sky2: rtnl_lock out of loop will be faster Before this patch, it gets and releases the lock at each iteration of the loop. Changing unregister_netdev to unregister_netdevice and locking outside of the loop will be faster for this approach. Signed-off-by: Wang Chen --- sky2.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) --- linux-2.6.24.rc5.org/drivers/net/sky2.c 2007-12-12 10:19:43.000000000 +0800 +++ linux-2.6.24.rc5/drivers/net/sky2.c 2007-12-12 15:23:37.000000000 +0800 @@ -4270,8 +4270,10 @@ static void __devexit sky2_remove(struct del_timer_sync(&hw->watchdog_timer); cancel_work_sync(&hw->restart_work); + rtnl_lock(); for (i = hw->ports-1; i >= 0; --i) - unregister_netdev(hw->dev[i]); + unregister_netdevice(hw->dev[i]); + rtnl_unlock(); sky2_write32(hw, B0_IMSK, 0);