From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751013AbbJCUZY (ORCPT ); Sat, 3 Oct 2015 16:25:24 -0400 Received: from mail-ig0-f182.google.com ([209.85.213.182]:32822 "EHLO mail-ig0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750788AbbJCUZW (ORCPT ); Sat, 3 Oct 2015 16:25:22 -0400 Subject: Re: [PATCH v2 3/5] net: dsa: complete dsa_switch_destroy To: Neil Armstrong , "David S. Miller" , Guenter Roeck , vivien.didelot@savoirfairelinux.com, Andrew Lunn , Fabian Frederick , Pavel Nakonechny , Joe Perches , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, nbd@openwrt.org, sergei.shtylyov@cogentembedded.com References: <560FE57C.5070608@baylibre.com> From: Florian Fainelli X-Enigmail-Draft-Status: N1110 Message-ID: <561039AF.8080706@gmail.com> Date: Sat, 3 Oct 2015 13:25:19 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <560FE57C.5070608@baylibre.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 03/10/2015 07:26, Neil Armstrong a écrit : > When unbinding dsa, complete the dsa_switch_destroy to unregister the > fixed link phy then cleanly unregister and destroy the net devices. > > Signed-off-by: Neil Armstrong > --- [snip] > + port_dn = cd->port_dn[port]; > + if (of_phy_is_fixed_link(port_dn)) { > + phydev = of_phy_find_device(port_dn); > + if (phydev) { > + int addr = phydev->addr; > + phy_device_free(phydev); > + of_node_put(port_dn); > + fixed_phy_del(addr); fixed_phy_del() removes the fixed PHY from the platform fixed MDIO bus list of PHYs, so we should be okay even with switch drivers which register a link_update callback via fixed_phy_set_link_update(), but I have not checked that. The sequence of call looks (phy_device_free then fixed_phy_del) looks sane though. Eventually this logic might be better moved into net/dsa/slave.c such that it is easy to see how it balances dsa_slave_phy_setup(). Reviewed-by: Florian Fainelli -- Florian