From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli Subject: [PATCH net-next 2/5] net: phy: phylink: Use PHY device interface if N/A Date: Thu, 30 Nov 2017 11:57:41 -0800 Message-ID: <20171130195744.17743-3-f.fainelli@gmail.com> References: <20171130195744.17743-1-f.fainelli@gmail.com> Cc: davem@davemloft.net, andrew@lunn.ch, rmk+kernel@armlinux.org.uk, vivien.didelot@savoirfairelinux.com, Florian Fainelli To: netdev@vger.kernel.org Return-path: Received: from mail-qt0-f193.google.com ([209.85.216.193]:45210 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751706AbdK3T5x (ORCPT ); Thu, 30 Nov 2017 14:57:53 -0500 Received: by mail-qt0-f193.google.com with SMTP id g10so10264821qtj.12 for ; Thu, 30 Nov 2017 11:57:52 -0800 (PST) In-Reply-To: <20171130195744.17743-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: We may not always be able to resolve a correct phy_interface_t value before actually connecting to the PHY device, when that happens, just have phylink_connect_phy() utilize what the PHY device/driver provided. Signed-off-by: Florian Fainelli --- drivers/net/phy/phylink.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 0a81c7ff51b5..8a30ea8873af 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -657,6 +657,12 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy) { int ret; + /* Use PHY device/driver interface */ + if (pl->link_interface == PHY_INTERFACE_MODE_NA) { + pl->link_interface = phy->interface; + pl->link_config.interface = pl->link_interface; + } + ret = phy_attach_direct(pl->netdev, phy, 0, pl->link_interface); if (ret) return ret; -- 2.14.3