From patchwork Tue Aug 25 22:03:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iyappan Subramanian X-Patchwork-Id: 7073481 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EA49BC05AC for ; Tue, 25 Aug 2015 22:05:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A03E207EA for ; Tue, 25 Aug 2015 22:05:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 29A7320772 for ; Tue, 25 Aug 2015 22:05:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZUMJo-0003Bm-TH; Tue, 25 Aug 2015 22:03:48 +0000 Received: from mail-ig0-x22b.google.com ([2607:f8b0:4001:c05::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZUMJl-00037t-8p for linux-arm-kernel@lists.infradead.org; Tue, 25 Aug 2015 22:03:45 +0000 Received: by igfj19 with SMTP id j19so23264041igf.0 for ; Tue, 25 Aug 2015 15:03:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apm.com; s=apm; h=from:to:cc:subject:date:message-id; bh=Z03D57reO0Ui3RuApGL6aKMAt3Tkpn2gO+8lvHj1k74=; b=iTKGmTNjB+bcj9+beery4BsSYWPRdbYKnS5wilQqAH+MLZB2duMxhK0vAPV3SHjN9l BRZGI4zvpJ/3gdLAofrv+349K+Ax3o/Wz4H1vVNcTVcGLg5teJ8IfNygJ4S4BTFZLYHU 2c3rIIqIB7nbG6NjyvnXHfZVe/r4u2hUcoVZk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Z03D57reO0Ui3RuApGL6aKMAt3Tkpn2gO+8lvHj1k74=; b=fBu+lhB3TSZMJsL7EJCdd8HmcPLc5na9P+aSKFlqjK0OEq48iVCZ+7f35C1NPsLR7X 3mwphVyJXzOdc2JCiFgOvGAAZWPtyZnO/4RpTey2qaANwfZDx3lYMWC+WtdqizxPAAeg KmxH0e2kY8MlRBlhs2yxQ7EA2Wk26kTgD5xmUTmic9AVazf5Et982GXmxAtv030ZoWn6 3BrUAnPQYVKFjctIqVwhjSEG0hP9MrUTDTXGOp3A5nbqbNsDfcxJE7t3SLW2iP6z9REL KtAm5BFUyv+cTKDjXe0Il4Lxfjgf+Rbz4RRr/DsmnxtM3dD8JkIu+2QGvulRb52ags8k I1XA== X-Gm-Message-State: ALoCoQnccsaN7g8p0kXJfq4koLewW1U/3UkFb10NEiMfypE6WR1juJ1Wj95CLJSbYExFHue0ledL X-Received: by 10.50.108.37 with SMTP id hh5mr6875037igb.10.1440540202699; Tue, 25 Aug 2015 15:03:22 -0700 (PDT) Received: from isubrama-dev.amcc.com (70-35-53-82.static.wiline.com. [70.35.53.82]) by smtp.gmail.com with ESMTPSA id k64sm16484205iod.3.2015.08.25.15.03.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Aug 2015 15:03:21 -0700 (PDT) From: Iyappan Subramanian To: davem@davemloft.net, netdev@vger.kernel.org Subject: [PATCH] drivers: net: xgene: fix: Oops in linkwatch_fire_event Date: Tue, 25 Aug 2015 15:03:03 -0700 Message-Id: <1440540183-11006-1-git-send-email-isubramanian@apm.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150825_150345_372247_E08B792A X-CRM114-Status: GOOD ( 13.39 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dnelson@redhat.com, patches@apm.com, linux-arm-kernel@lists.infradead.org, Iyappan Subramanian MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP [ 1065.801569] Internal error: Oops: 96000006 [#1] SMP ... [ 1065.866655] Hardware name: AppliedMicro Mustang/Mustang, BIOS 1.1.0 Apr 22 2015 [ 1065.873937] Workqueue: events_power_efficient phy_state_machine [ 1065.879837] task: fffffe01de105e80 ti: fffffe00bcf18000 task.ti: fffffe00bcf18000 [ 1065.887288] PC is at linkwatch_fire_event+0xac/0xc0 [ 1065.892141] LR is at linkwatch_fire_event+0xa0/0xc0 [ 1065.896995] pc : [] lr : [] pstate: 200001c5 [ 1065.904356] sp : fffffe00bcf1bd00 ... [ 1066.196813] Call Trace: [ 1066.199248] [] linkwatch_fire_event+0xac/0xc0 [ 1066.205140] [] netif_carrier_off+0x54/0x64 [ 1066.210773] [] phy_state_machine+0x120/0x3bc [ 1066.216578] [] process_one_work+0x15c/0x3a8 [ 1066.222296] [] worker_thread+0x134/0x470 [ 1066.227757] [] kthread+0xe0/0xf8 [ 1066.232525] Code: 97f65ee9 f9420660 d538d082 8b000042 (885f7c40) The fix is to call phy_disconnect() from xgene_enet_mdio_remove, which in turn call cancel_delayed_work_sync(). Signed-off-by: Iyappan Subramanian --- drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 3 +++ drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c index a626c43..cfa3704 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c @@ -801,6 +801,9 @@ int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata) void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata) { + if (pdata->phy_dev) + phy_disconnect(pdata->phy_dev); + mdiobus_unregister(pdata->mdio_bus); mdiobus_free(pdata->mdio_bus); pdata->mdio_bus = NULL; diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index 299eb43..a02ea7f8 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c @@ -1277,9 +1277,10 @@ static int xgene_enet_remove(struct platform_device *pdev) mac_ops->tx_disable(pdata); xgene_enet_napi_del(pdata); - xgene_enet_mdio_remove(pdata); - xgene_enet_delete_desc_rings(pdata); + if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) + xgene_enet_mdio_remove(pdata); unregister_netdev(ndev); + xgene_enet_delete_desc_rings(pdata); pdata->port_ops->shutdown(pdata); free_netdev(ndev);