Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5457067imm; Tue, 16 Oct 2018 10:30:33 -0700 (PDT) X-Google-Smtp-Source: ACcGV61yC/UooMglab//nxIadTnIHD2qHbGrc3DxXG0MNDfgqwKkzcCbRyRi39xg5ETKgRmOFqkw X-Received: by 2002:a17:902:8ec2:: with SMTP id x2-v6mr22563449plo.157.1539711033351; Tue, 16 Oct 2018 10:30:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539711033; cv=none; d=google.com; s=arc-20160816; b=W/rmd6+zbOKsnPAaGGQDmWzaM3PR0Xs1WToq+oqr1XIi3O+HIAXvPuCvaLi2+Drdr3 x36MwQXc8+2ehgcJpxBK5POauNZoblYmOKfhrW9F3rG2PS9PVBvHSEgFgNQw/SE7c1Wu mW6/wyeM6jF80FNzrfyKXPGlNobOtMKcu0M0k/W/EWfV+cWJPCXlX35I4Cp7YDvzwwcX 2SI3x+vxj7GsYr5qMTRoh+/BsjUoC0FbJ9ikV5L7qBe/MYy9ClefPHNAnn5kT8Z8oHsf jMqLJxGdPmZWyZii9BFt+uOdtUz9LHQdYl+cl86R0TwF5iuXISfGjTYgzboFveoEYZUz /3Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FyVYSZ5mkxdhrYyILBX8KerDDbyrf75SEiCWy6EMJAU=; b=wi6OACQN3bmHJRUMi53AldzrVjSXI4sVfFF/ti5Ovq5eEQL4lbgnrPXjUgLdWt8YDr jrI5Pi+l7OJp+pGeqBYQFwZsmXxD+dXtjwA8hhRjIR9VvLI27iLG7j7NkmZLspDEUV/s 0suV1g01nx01pWlOUIyv5lvqy0CUry7hmYWKB2FpX32KWZe/3gLa4o3WogArDyAfYdpN /9uVUvu18dEb4r1/Tx0JFHWuoi0H0RN/OaQ3i9yts1jjmFQEbynEv52mz2NmNzNIHTVz /6mSkiUn6nZ6Wx0Z+FnlnVdZwPIuGE7r7BaaMRxAUXJ9JO+IGCUHKG05JuR1twsZ/u2a 7BGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0dtJL5al; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12-v6si14245359plt.4.2018.10.16.10.30.16; Tue, 16 Oct 2018 10:30:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0dtJL5al; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731570AbeJQBPa (ORCPT + 99 others); Tue, 16 Oct 2018 21:15:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:34088 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730396AbeJQBP3 (ORCPT ); Tue, 16 Oct 2018 21:15:29 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 218A220866; Tue, 16 Oct 2018 17:24:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539710643; bh=yzdc69Shm4AitKVUJ20JNEfVL45MhXPUcAU5P6RjXW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0dtJL5alrvIoVqTAMrStCy3/tue+Hj1xV4T4JkLQFY7+BauekEkeTKCdNNyRtkXF6 WolqY/To7rPo+AtQ0JQ5bh9V4a+wJjM53KwLDq66Er6JJEMPPQ9TyP5ndIcneCRIZT v0L1w3y385nLgLwSlrie7ugpuJZ9lOIJPA6OJBZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , "David S. Miller" Subject: [PATCH 4.9 37/71] net: dsa: bcm_sf2: Fix unbind ordering Date: Tue, 16 Oct 2018 19:09:34 +0200 Message-Id: <20181016170541.248439294@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170539.315587743@linuxfoundation.org> References: <20181016170539.315587743@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Fainelli [ Upstream commit bf3b452b7af787b8bf27de6490dc4eedf6f97599 ] The order in which we release resources is unfortunately leading to bus errors while dismantling the port. This is because we set priv->wol_ports_mask to 0 to tell bcm_sf2_sw_suspend() that it is now permissible to clock gate the switch. Later on, when dsa_slave_destroy() comes in from dsa_unregister_switch() and calls dsa_switch_ops::port_disable, we perform the same dismantling again, and this time we hit registers that are clock gated. Make sure that dsa_unregister_switch() is the first thing that happens, which takes care of releasing all user visible resources, then proceed with clock gating hardware. We still need to set priv->wol_ports_mask to 0 to make sure that an enabled port properly gets disabled in case it was previously used as part of Wake-on-LAN. Fixes: d9338023fb8e ("net: dsa: bcm_sf2: Make it a real platform device driver") Signed-off-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/dsa/bcm_sf2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -1129,10 +1129,10 @@ static int bcm_sf2_sw_remove(struct plat { struct bcm_sf2_priv *priv = platform_get_drvdata(pdev); - /* Disable all ports and interrupts */ priv->wol_ports_mask = 0; - bcm_sf2_sw_suspend(priv->dev->ds); dsa_unregister_switch(priv->dev->ds); + /* Disable all ports and interrupts */ + bcm_sf2_sw_suspend(priv->dev->ds); bcm_sf2_mdio_unregister(priv); return 0;