From patchwork Mon Jul 22 07:53:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Wu X-Patchwork-Id: 260592 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 9FC782C00E6 for ; Mon, 22 Jul 2013 17:53:41 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756657Ab3GVHxh (ORCPT ); Mon, 22 Jul 2013 03:53:37 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:48801 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756500Ab3GVHxg (ORCPT ); Mon, 22 Jul 2013 03:53:36 -0400 Received: by mail-wg0-f44.google.com with SMTP id l18so739837wgh.11 for ; Mon, 22 Jul 2013 00:53:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:user-agent:mime-version :content-transfer-encoding:content-type; bh=vSf/GniNIfBGbeyrJcg6+aJxwW2BAJw465BQU+Ad1U4=; b=0vi8z/JWLnKs9lE8KiCMkWLWSCwEbyuCnvdPkM8GbMHyl6eeZ8uLS0gAhroI+NFAWe BExweN0R/213EtMk/FI4oA17Cxp4y+yYYj4Mfzv04c6AX0M+NOhjuWx4rlnPHPAlf/KB SRV/pIJJZ4xpInv7V5v1yptrK1evqThk3SK1xfe8fKkLJmM1D15uw8uTac27K0oNa0EW L7lvXTQTQC+WmYdmZsIGbF2/rKnhuKbB5rGxhliCAHQ4RwZR0OKymAl3EjCt5OWgHF8V cQ1U/ndgOLxJM7w2SuOul0QaOVZRhtOJ191krnOJfLVazsYe2tu3ZIPiIXzhDuYstLb2 Xtug== X-Received: by 10.194.78.110 with SMTP id a14mr18652583wjx.84.1374479614508; Mon, 22 Jul 2013 00:53:34 -0700 (PDT) Received: from al.localnet (al.lekensteyn.nl. [2001:470:1f15:b83::c0d1:f1ed]) by mx.google.com with ESMTPSA id w4sm38724663wia.9.2013.07.22.00.53.32 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Jul 2013 00:53:33 -0700 (PDT) From: Peter Wu To: netdev@vger.kernel.org Cc: Francois Romieu , Realtek linux nic maintainers Subject: [PATCH net v2 1/1] r8169: fix lockdep warning when removing interface Date: Mon, 22 Jul 2013 09:53:30 +0200 Message-ID: <3190648.uJuPIZ6zlh@al> User-Agent: KMail/4.10.5 (Linux/3.10.0-1-custom; KDE/4.10.5; x86_64; ; ) MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The work queue is initialised in rtl_open (when the interface goes up), but canceled in rtl_remove_one (when the PCI device gets removed). If the network interface is not brought up, then the work queue struct is not initialised. When the device is removed, the attempt to cancel the uninitialised work queue causes a lockdep warning. This patch fixes the issue by moving cancel_work_sync to rtl_close (to match rtl_open). (Note that rtl_close is also called via unregister_netdev in rtl_remove_one.) Signed-off-by: Peter Wu Acked-by: Francois Romieu --- drivers/net/ethernet/realtek/r8169.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 4106a74..880015c 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c @@ -6468,6 +6468,8 @@ static int rtl8169_close(struct net_device *dev) rtl8169_down(dev); rtl_unlock_work(tp); + cancel_work_sync(&tp->wk.work); + free_irq(pdev->irq, dev); dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, @@ -6793,8 +6795,6 @@ static void rtl_remove_one(struct pci_dev *pdev) rtl8168_driver_stop(tp); } - cancel_work_sync(&tp->wk.work); - netif_napi_del(&tp->napi); unregister_netdev(dev);