From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli Subject: Re: [PATCH net-next] lan78xx: Lan7801 Support for Fixed PHY Date: Wed, 25 Apr 2018 10:36:26 -0700 Message-ID: <7b563a2e-fff5-0d4b-aea2-3d98dda3c192@gmail.com> References: <20180423044630.2672-1-raghuramchary.jallipalli@microchip.com> <20180423124203.GC25919@lunn.ch> <0573C9D4B793EF43BF95221F2F4CC85153DA07@CHN-SV-EXMX06.mchp-main.com> <20180425123906.GA13486@lunn.ch> <0573C9D4B793EF43BF95221F2F4CC85153E14C@CHN-SV-EXMX06.mchp-main.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: davem@davemloft.net, netdev@vger.kernel.org, UNGLinuxDriver@microchip.com, Woojung.Huh@microchip.com To: RaghuramChary.Jallipalli@microchip.com, andrew@lunn.ch Return-path: Received: from mail-qt0-f195.google.com ([209.85.216.195]:43024 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754847AbeDYRgf (ORCPT ); Wed, 25 Apr 2018 13:36:35 -0400 Received: by mail-qt0-f195.google.com with SMTP id l11-v6so27875953qtj.10 for ; Wed, 25 Apr 2018 10:36:35 -0700 (PDT) In-Reply-To: <0573C9D4B793EF43BF95221F2F4CC85153E14C@CHN-SV-EXMX06.mchp-main.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 04/25/2018 10:04 AM, RaghuramChary.Jallipalli@microchip.com wrote: > Hi Andrew, >>>> >>> dev->fixedphy stores the fixed phydev, which will be passed to the >>> fixed_phy_unregister routine , so I think phy_is_pseudo_fixed_link check >> is not necessary. >> >> I'm saying you can get rid of dev->fixedphy, and just use >> netdev->phydev, and phy_is_pseudo_fixed_link(netdev->phydev) >> > After phy_disconnect() , the netdev->phydev becomes null, but the phydev->mdio instances > are still valid. So I'm saving the phydev ptr and passing to unregister the fixed phy. > If I try to unregister first and disconnect, I see panic at sysfs remove link. > I believe having dev->fixedphy should not cause any problem. It still is completely unnecessary, you can do something like the following: struct phy_device *phydev = netdev->phydev; phy_disconnect(phydev); if (phy_is_pseudo_fixed_link(phydev)) fixed_phy_unregister(phydev); while netdev->phydev becomes NULL after phy_disconnect(), you retained a reference to the original PHY device before disconnecting, in order to unregister it. Can you see if that works? -- Florian