--- /dev/null
+From eed70fd9452fe0fcd1a221731a4333b51a8081f2 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@armlinux.org.uk>
+Date: Fri, 3 Jan 2020 15:13:56 +0000
+Subject: net: phylink: fix failure to register on x86 systems
+
+The kernel test robot reports a boot failure with qemu in 5.5-rc,
+referencing commit 2203cbf2c8b5 ("net: sfp: move fwnode parsing into
+sfp-bus layer"). This is caused by phylink_create() being passed a
+NULL fwnode, causing fwnode_property_get_reference_args() to return
+-EINVAL.
+
+Don't attempt to attach to a SFP bus if we have no fwnode, which
+avoids this issue.
+
+Reported-by: kernel test robot <rong.a.chen@intel.com>
+Fixes: 2203cbf2c8b5 ("net: sfp: move fwnode parsing into sfp-bus layer")
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/phy/phylink.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/net/phy/phylink.c
++++ b/drivers/net/phy/phylink.c
+@@ -541,6 +541,9 @@ static int phylink_register_sfp(struct p
+ struct sfp_bus *bus;
+ int ret;
+
++ if (!fwnode)
++ return 0;
++
+ bus = sfp_bus_find_fwnode(fwnode);
+ if (IS_ERR(bus)) {
+ ret = PTR_ERR(bus);
dev_err(&phydev->mdio.dev, "incompatible SFP module inserted\n");
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
-@@ -1663,7 +1663,7 @@ static int phylink_sfp_module_insert(voi
+@@ -1666,7 +1666,7 @@ static int phylink_sfp_module_insert(voi
linkmode_copy(support1, support);
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
-@@ -1717,6 +1717,26 @@ static int phylink_sfp_module_insert(voi
+@@ -1720,6 +1720,26 @@ static int phylink_sfp_module_insert(voi
return ret;
}
static void phylink_sfp_link_down(void *upstream)
{
struct phylink *pl = upstream;
-@@ -1752,6 +1772,8 @@ static const struct sfp_upstream_ops sfp
+@@ -1755,6 +1775,8 @@ static const struct sfp_upstream_ops sfp
.attach = phylink_sfp_attach,
.detach = phylink_sfp_detach,
.module_insert = phylink_sfp_module_insert,
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
-@@ -728,11 +728,9 @@ static int phylink_bringup_phy(struct ph
+@@ -731,11 +731,9 @@ static int phylink_bringup_phy(struct ph
return 0;
}
if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED ||
(pl->link_an_mode == MLO_AN_INBAND &&
phy_interface_mode_is_8023z(interface))))
-@@ -741,15 +739,7 @@ static int __phylink_connect_phy(struct
+@@ -744,15 +742,7 @@ static int __phylink_connect_phy(struct
if (pl->phydev)
return -EBUSY;
}
/**
-@@ -769,13 +759,23 @@ static int __phylink_connect_phy(struct
+@@ -772,13 +762,23 @@ static int __phylink_connect_phy(struct
*/
int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
{
}
EXPORT_SYMBOL_GPL(phylink_connect_phy);
-@@ -1759,8 +1759,17 @@ static void phylink_sfp_link_up(void *up
+@@ -1762,8 +1762,17 @@ static void phylink_sfp_link_up(void *up
static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
{
struct phylink *pl = upstream;
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
-@@ -671,7 +671,8 @@ static void phylink_phy_change(struct ph
+@@ -674,7 +674,8 @@ static void phylink_phy_change(struct ph
phy_duplex_to_str(phydev->duplex));
}
{
struct phylink_link_state config;
__ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
-@@ -691,7 +692,7 @@ static int phylink_bringup_phy(struct ph
+@@ -694,7 +695,7 @@ static int phylink_bringup_phy(struct ph
ethtool_convert_legacy_u32_to_link_mode(supported, phy->supported);
ethtool_convert_legacy_u32_to_link_mode(config.advertising,
phy->advertising);
ret = phylink_validate(pl, supported, &config);
if (ret)
-@@ -707,6 +708,7 @@ static int phylink_bringup_phy(struct ph
+@@ -710,6 +711,7 @@ static int phylink_bringup_phy(struct ph
mutex_lock(&phy->lock);
mutex_lock(&pl->state_mutex);
pl->phydev = phy;
linkmode_copy(pl->supported, supported);
linkmode_copy(pl->link_config.advertising, config.advertising);
-@@ -771,7 +773,7 @@ int phylink_connect_phy(struct phylink *
+@@ -774,7 +776,7 @@ int phylink_connect_phy(struct phylink *
if (ret < 0)
return ret;
if (ret)
phy_detach(phy);
-@@ -824,7 +826,7 @@ int phylink_of_phy_connect(struct phylin
+@@ -827,7 +829,7 @@ int phylink_of_phy_connect(struct phylin
if (!phy_dev)
return -ENODEV;
if (ret)
phy_detach(phy_dev);
-@@ -1759,13 +1761,22 @@ static void phylink_sfp_link_up(void *up
+@@ -1762,13 +1764,22 @@ static void phylink_sfp_link_up(void *up
static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
{
struct phylink *pl = upstream;
pl->cur_interface, pl->phydev);
netif_carrier_on(ndev);
-@@ -610,7 +611,7 @@ struct phylink *phylink_create(struct ne
+@@ -613,7 +614,7 @@ struct phylink *phylink_create(struct ne
return ERR_PTR(ret);
}
ret = phylink_parse_fixedlink(pl, fwnode);
if (ret < 0) {
kfree(pl);
-@@ -618,6 +619,8 @@ struct phylink *phylink_create(struct ne
+@@ -621,6 +622,8 @@ struct phylink *phylink_create(struct ne
}
}
ret = phylink_register_sfp(pl, fwnode);
if (ret < 0) {
kfree(pl);
-@@ -733,8 +736,8 @@ static int phylink_bringup_phy(struct ph
+@@ -736,8 +739,8 @@ static int phylink_bringup_phy(struct ph
static int phylink_attach_phy(struct phylink *pl, struct phy_device *phy,
phy_interface_t interface)
{
phy_interface_mode_is_8023z(interface))))
return -EINVAL;
-@@ -801,8 +804,8 @@ int phylink_of_phy_connect(struct phylin
+@@ -804,8 +807,8 @@ int phylink_of_phy_connect(struct phylin
int ret;
/* Fixed links and 802.3z are handled without needing a PHY */
phy_interface_mode_is_8023z(pl->link_interface)))
return 0;
-@@ -813,7 +816,7 @@ int phylink_of_phy_connect(struct phylin
+@@ -816,7 +819,7 @@ int phylink_of_phy_connect(struct phylin
phy_node = of_parse_phandle(dn, "phy-device", 0);
if (!phy_node) {
return -ENODEV;
return 0;
}
-@@ -876,7 +879,7 @@ int phylink_fixed_state_cb(struct phylin
+@@ -879,7 +882,7 @@ int phylink_fixed_state_cb(struct phylin
/* It does not make sense to let the link be overriden unless we use
* MLO_AN_FIXED
*/
return -EINVAL;
mutex_lock(&pl->state_mutex);
-@@ -926,7 +929,7 @@ void phylink_start(struct phylink *pl)
+@@ -929,7 +932,7 @@ void phylink_start(struct phylink *pl)
ASSERT_RTNL();
netdev_info(pl->netdev, "configuring for %s/%s link mode\n",
phy_modes(pl->link_config.interface));
/* Always set the carrier off */
-@@ -948,7 +951,7 @@ void phylink_start(struct phylink *pl)
+@@ -951,7 +954,7 @@ void phylink_start(struct phylink *pl)
clear_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
phylink_run_resolve(pl);
int irq = gpiod_to_irq(pl->link_gpio);
if (irq > 0) {
-@@ -963,7 +966,7 @@ void phylink_start(struct phylink *pl)
+@@ -966,7 +969,7 @@ void phylink_start(struct phylink *pl)
if (irq <= 0)
mod_timer(&pl->link_poll, jiffies + HZ);
}
mod_timer(&pl->link_poll, jiffies + HZ);
if (pl->phydev)
phy_start(pl->phydev);
-@@ -1090,7 +1093,7 @@ int phylink_ethtool_ksettings_get(struct
+@@ -1093,7 +1096,7 @@ int phylink_ethtool_ksettings_get(struct
linkmode_copy(kset->link_modes.supported, pl->supported);
case MLO_AN_FIXED:
/* We are using fixed settings. Report these as the
* current link settings - and note that these also
-@@ -1163,7 +1166,7 @@ int phylink_ethtool_ksettings_set(struct
+@@ -1166,7 +1169,7 @@ int phylink_ethtool_ksettings_set(struct
/* If we have a fixed link (as specified by firmware), refuse
* to change link parameters.
*/
(s->speed != pl->link_config.speed ||
s->duplex != pl->link_config.duplex))
return -EINVAL;
-@@ -1175,7 +1178,7 @@ int phylink_ethtool_ksettings_set(struct
+@@ -1178,7 +1181,7 @@ int phylink_ethtool_ksettings_set(struct
__clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, config.advertising);
} else {
/* If we have a fixed link, refuse to enable autonegotiation */
return -EINVAL;
config.speed = SPEED_UNKNOWN;
-@@ -1217,7 +1220,7 @@ int phylink_ethtool_ksettings_set(struct
+@@ -1220,7 +1223,7 @@ int phylink_ethtool_ksettings_set(struct
* configuration. For a fixed link, this isn't able to change any
* parameters, which just leaves inband mode.
*/
!test_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state)) {
phylink_mac_config(pl, &pl->link_config);
phylink_mac_an_restart(pl);
-@@ -1307,7 +1310,7 @@ int phylink_ethtool_set_pauseparam(struc
+@@ -1310,7 +1313,7 @@ int phylink_ethtool_set_pauseparam(struc
pause->tx_pause);
} else if (!test_bit(PHYLINK_DISABLE_STOPPED,
&pl->phylink_disable_state)) {
case MLO_AN_FIXED:
/* Should we allow fixed links to change against the config? */
phylink_resolve_flow(pl, config);
-@@ -1496,7 +1499,7 @@ static int phylink_mii_read(struct phyli
+@@ -1499,7 +1502,7 @@ static int phylink_mii_read(struct phyli
struct phylink_link_state state;
int val = 0xffff;
case MLO_AN_FIXED:
if (phy_id == 0) {
phylink_get_fixed_state(pl, &state);
-@@ -1524,7 +1527,7 @@ static int phylink_mii_read(struct phyli
+@@ -1527,7 +1530,7 @@ static int phylink_mii_read(struct phyli
static int phylink_mii_write(struct phylink *pl, unsigned int phy_id,
unsigned int reg, unsigned int val)
{
case MLO_AN_FIXED:
break;
-@@ -1698,10 +1701,10 @@ static int phylink_sfp_module_insert(voi
+@@ -1701,10 +1704,10 @@ static int phylink_sfp_module_insert(voi
linkmode_copy(pl->link_config.advertising, config.advertising);
}
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
-@@ -1633,25 +1633,21 @@ static void phylink_sfp_detach(void *ups
+@@ -1636,25 +1636,21 @@ static void phylink_sfp_detach(void *ups
pl->netdev->sfp_bus = NULL;
}
config.interface = PHY_INTERFACE_MODE_NA;
config.speed = SPEED_UNKNOWN;
config.duplex = DUPLEX_UNKNOWN;
-@@ -1666,8 +1662,6 @@ static int phylink_sfp_module_insert(voi
+@@ -1669,8 +1665,6 @@ static int phylink_sfp_module_insert(voi
return ret;
}
iface = sfp_select_interface(pl->sfp_bus, config.advertising);
if (iface == PHY_INTERFACE_MODE_NA) {
netdev_err(pl->netdev,
-@@ -1677,18 +1671,18 @@ static int phylink_sfp_module_insert(voi
+@@ -1680,18 +1674,18 @@ static int phylink_sfp_module_insert(voi
}
config.interface = iface;
__ETHTOOL_LINK_MODE_MASK_NBITS, support);
if (phy_interface_mode_is_8023z(iface) && pl->phydev)
-@@ -1701,15 +1695,15 @@ static int phylink_sfp_module_insert(voi
+@@ -1704,15 +1698,15 @@ static int phylink_sfp_module_insert(voi
linkmode_copy(pl->link_config.advertising, config.advertising);
}
phy_modes(config.interface));
}
-@@ -1722,6 +1716,21 @@ static int phylink_sfp_module_insert(voi
+@@ -1725,6 +1719,21 @@ static int phylink_sfp_module_insert(voi
return ret;
}
};
static inline void linkmode_zero(unsigned long *dst)
-@@ -1633,7 +1636,7 @@ static void phylink_sfp_detach(void *ups
+@@ -1636,7 +1639,7 @@ static void phylink_sfp_detach(void *ups
pl->netdev->sfp_bus = NULL;
}
const unsigned long *supported,
const unsigned long *advertising)
{
-@@ -1707,7 +1710,7 @@ static int phylink_sfp_config(struct phy
+@@ -1710,7 +1713,7 @@ static int phylink_sfp_config(struct phy
phy_modes(config.interface));
}
if (changed && !test_bit(PHYLINK_DISABLE_STOPPED,
&pl->phylink_disable_state))
-@@ -1720,15 +1723,20 @@ static int phylink_sfp_module_insert(voi
+@@ -1723,15 +1726,20 @@ static int phylink_sfp_module_insert(voi
const struct sfp_eeprom_id *id)
{
struct phylink *pl = upstream;
}
static int phylink_sfp_module_start(void *upstream)
-@@ -1736,10 +1744,19 @@ static int phylink_sfp_module_start(void
+@@ -1739,10 +1747,19 @@ static int phylink_sfp_module_start(void
struct phylink *pl = upstream;
/* If this SFP module has a PHY, start the PHY now. */
}
static void phylink_sfp_module_stop(void *upstream)
-@@ -1773,10 +1790,30 @@ static void phylink_sfp_link_up(void *up
+@@ -1776,10 +1793,30 @@ static void phylink_sfp_link_up(void *up
static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
{
struct phylink *pl = upstream;
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
-@@ -1787,12 +1787,22 @@ static void phylink_sfp_link_up(void *up
+@@ -1790,12 +1790,22 @@ static void phylink_sfp_link_up(void *up
phylink_run_resolve(pl);
}
int ret;
/*
-@@ -1807,8 +1817,13 @@ static int phylink_sfp_connect_phy(void
+@@ -1810,8 +1820,13 @@ static int phylink_sfp_connect_phy(void
ethtool_convert_legacy_u32_to_link_mode(supported, phy->supported);
ethtool_convert_legacy_u32_to_link_mode(advertising, phy->advertising);
--- /dev/null
+From eed70fd9452fe0fcd1a221731a4333b51a8081f2 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@armlinux.org.uk>
+Date: Fri, 3 Jan 2020 15:13:56 +0000
+Subject: net: phylink: fix failure to register on x86 systems
+
+The kernel test robot reports a boot failure with qemu in 5.5-rc,
+referencing commit 2203cbf2c8b5 ("net: sfp: move fwnode parsing into
+sfp-bus layer"). This is caused by phylink_create() being passed a
+NULL fwnode, causing fwnode_property_get_reference_args() to return
+-EINVAL.
+
+Don't attempt to attach to a SFP bus if we have no fwnode, which
+avoids this issue.
+
+Reported-by: kernel test robot <rong.a.chen@intel.com>
+Fixes: 2203cbf2c8b5 ("net: sfp: move fwnode parsing into sfp-bus layer")
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/phy/phylink.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/net/phy/phylink.c
++++ b/drivers/net/phy/phylink.c
+@@ -568,6 +568,9 @@ static int phylink_register_sfp(struct p
+ struct sfp_bus *bus;
+ int ret;
+
++ if (!fwnode)
++ return 0;
++
+ bus = sfp_bus_find_fwnode(fwnode);
+ if (IS_ERR(bus)) {
+ ret = PTR_ERR(bus);
dev_err(&phydev->mdio.dev, "incompatible SFP module inserted\n");
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
-@@ -1718,7 +1718,7 @@ static int phylink_sfp_module_insert(voi
+@@ -1721,7 +1721,7 @@ static int phylink_sfp_module_insert(voi
linkmode_copy(support1, support);
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
-@@ -1772,6 +1772,26 @@ static int phylink_sfp_module_insert(voi
+@@ -1775,6 +1775,26 @@ static int phylink_sfp_module_insert(voi
return ret;
}
static void phylink_sfp_link_down(void *upstream)
{
struct phylink *pl = upstream;
-@@ -1807,6 +1827,8 @@ static const struct sfp_upstream_ops sfp
+@@ -1810,6 +1830,8 @@ static const struct sfp_upstream_ops sfp
.attach = phylink_sfp_attach,
.detach = phylink_sfp_detach,
.module_insert = phylink_sfp_module_insert,
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
-@@ -765,11 +765,9 @@ static int phylink_bringup_phy(struct ph
+@@ -768,11 +768,9 @@ static int phylink_bringup_phy(struct ph
return 0;
}
if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED ||
(pl->link_an_mode == MLO_AN_INBAND &&
phy_interface_mode_is_8023z(interface))))
-@@ -778,15 +776,7 @@ static int __phylink_connect_phy(struct
+@@ -781,15 +779,7 @@ static int __phylink_connect_phy(struct
if (pl->phydev)
return -EBUSY;
}
/**
-@@ -806,13 +796,23 @@ static int __phylink_connect_phy(struct
+@@ -809,13 +799,23 @@ static int __phylink_connect_phy(struct
*/
int phylink_connect_phy(struct phylink *pl, struct phy_device *phy)
{
}
EXPORT_SYMBOL_GPL(phylink_connect_phy);
-@@ -1814,8 +1814,17 @@ static void phylink_sfp_link_up(void *up
+@@ -1817,8 +1817,17 @@ static void phylink_sfp_link_up(void *up
static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
{
struct phylink *pl = upstream;
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
-@@ -712,7 +712,8 @@ static void phylink_phy_change(struct ph
+@@ -715,7 +715,8 @@ static void phylink_phy_change(struct ph
phy_duplex_to_str(phydev->duplex));
}
{
struct phylink_link_state config;
__ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
-@@ -730,7 +731,7 @@ static int phylink_bringup_phy(struct ph
+@@ -733,7 +734,7 @@ static int phylink_bringup_phy(struct ph
memset(&config, 0, sizeof(config));
linkmode_copy(supported, phy->supported);
linkmode_copy(config.advertising, phy->advertising);
ret = phylink_validate(pl, supported, &config);
if (ret)
-@@ -746,6 +747,7 @@ static int phylink_bringup_phy(struct ph
+@@ -749,6 +750,7 @@ static int phylink_bringup_phy(struct ph
mutex_lock(&phy->lock);
mutex_lock(&pl->state_mutex);
pl->phydev = phy;
linkmode_copy(pl->supported, supported);
linkmode_copy(pl->link_config.advertising, config.advertising);
-@@ -808,7 +810,7 @@ int phylink_connect_phy(struct phylink *
+@@ -811,7 +813,7 @@ int phylink_connect_phy(struct phylink *
if (ret < 0)
return ret;
if (ret)
phy_detach(phy);
-@@ -861,7 +863,7 @@ int phylink_of_phy_connect(struct phylin
+@@ -864,7 +866,7 @@ int phylink_of_phy_connect(struct phylin
if (!phy_dev)
return -ENODEV;
if (ret)
phy_detach(phy_dev);
-@@ -1814,13 +1816,22 @@ static void phylink_sfp_link_up(void *up
+@@ -1817,13 +1819,22 @@ static void phylink_sfp_link_up(void *up
static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
{
struct phylink *pl = upstream;
case MLO_AN_PHY:
link_state = pl->phy_state;
phylink_resolve_flow(pl, &link_state);
-@@ -649,7 +650,7 @@ struct phylink *phylink_create(struct ph
+@@ -652,7 +653,7 @@ struct phylink *phylink_create(struct ph
return ERR_PTR(ret);
}
ret = phylink_parse_fixedlink(pl, fwnode);
if (ret < 0) {
kfree(pl);
-@@ -657,6 +658,8 @@ struct phylink *phylink_create(struct ph
+@@ -660,6 +661,8 @@ struct phylink *phylink_create(struct ph
}
}
ret = phylink_register_sfp(pl, fwnode);
if (ret < 0) {
kfree(pl);
-@@ -770,8 +773,8 @@ static int phylink_bringup_phy(struct ph
+@@ -773,8 +776,8 @@ static int phylink_bringup_phy(struct ph
static int phylink_attach_phy(struct phylink *pl, struct phy_device *phy,
phy_interface_t interface)
{
phy_interface_mode_is_8023z(interface))))
return -EINVAL;
-@@ -838,8 +841,8 @@ int phylink_of_phy_connect(struct phylin
+@@ -841,8 +844,8 @@ int phylink_of_phy_connect(struct phylin
int ret;
/* Fixed links and 802.3z are handled without needing a PHY */
phy_interface_mode_is_8023z(pl->link_interface)))
return 0;
-@@ -850,7 +853,7 @@ int phylink_of_phy_connect(struct phylin
+@@ -853,7 +856,7 @@ int phylink_of_phy_connect(struct phylin
phy_node = of_parse_phandle(dn, "phy-device", 0);
if (!phy_node) {
return -ENODEV;
return 0;
}
-@@ -913,7 +916,7 @@ int phylink_fixed_state_cb(struct phylin
+@@ -916,7 +919,7 @@ int phylink_fixed_state_cb(struct phylin
/* It does not make sense to let the link be overriden unless we use
* MLO_AN_FIXED
*/
return -EINVAL;
mutex_lock(&pl->state_mutex);
-@@ -963,7 +966,7 @@ void phylink_start(struct phylink *pl)
+@@ -966,7 +969,7 @@ void phylink_start(struct phylink *pl)
ASSERT_RTNL();
phylink_info(pl, "configuring for %s/%s link mode\n",
phy_modes(pl->link_config.interface));
/* Always set the carrier off */
-@@ -986,7 +989,7 @@ void phylink_start(struct phylink *pl)
+@@ -989,7 +992,7 @@ void phylink_start(struct phylink *pl)
clear_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
phylink_run_resolve(pl);
int irq = gpiod_to_irq(pl->link_gpio);
if (irq > 0) {
-@@ -1001,7 +1004,7 @@ void phylink_start(struct phylink *pl)
+@@ -1004,7 +1007,7 @@ void phylink_start(struct phylink *pl)
if (irq <= 0)
mod_timer(&pl->link_poll, jiffies + HZ);
}
mod_timer(&pl->link_poll, jiffies + HZ);
if (pl->phydev)
phy_start(pl->phydev);
-@@ -1128,7 +1131,7 @@ int phylink_ethtool_ksettings_get(struct
+@@ -1131,7 +1134,7 @@ int phylink_ethtool_ksettings_get(struct
linkmode_copy(kset->link_modes.supported, pl->supported);
case MLO_AN_FIXED:
/* We are using fixed settings. Report these as the
* current link settings - and note that these also
-@@ -1200,7 +1203,7 @@ int phylink_ethtool_ksettings_set(struct
+@@ -1203,7 +1206,7 @@ int phylink_ethtool_ksettings_set(struct
/* If we have a fixed link (as specified by firmware), refuse
* to change link parameters.
*/
(s->speed != pl->link_config.speed ||
s->duplex != pl->link_config.duplex))
return -EINVAL;
-@@ -1212,7 +1215,7 @@ int phylink_ethtool_ksettings_set(struct
+@@ -1215,7 +1218,7 @@ int phylink_ethtool_ksettings_set(struct
__clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, config.advertising);
} else {
/* If we have a fixed link, refuse to enable autonegotiation */
return -EINVAL;
config.speed = SPEED_UNKNOWN;
-@@ -1254,7 +1257,7 @@ int phylink_ethtool_ksettings_set(struct
+@@ -1257,7 +1260,7 @@ int phylink_ethtool_ksettings_set(struct
* configuration. For a fixed link, this isn't able to change any
* parameters, which just leaves inband mode.
*/
!test_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state)) {
phylink_mac_config(pl, &pl->link_config);
phylink_mac_an_restart(pl);
-@@ -1344,7 +1347,7 @@ int phylink_ethtool_set_pauseparam(struc
+@@ -1347,7 +1350,7 @@ int phylink_ethtool_set_pauseparam(struc
pause->tx_pause);
} else if (!test_bit(PHYLINK_DISABLE_STOPPED,
&pl->phylink_disable_state)) {
case MLO_AN_FIXED:
/* Should we allow fixed links to change against the config? */
phylink_resolve_flow(pl, config);
-@@ -1551,7 +1554,7 @@ static int phylink_mii_read(struct phyli
+@@ -1554,7 +1557,7 @@ static int phylink_mii_read(struct phyli
struct phylink_link_state state;
int val = 0xffff;
case MLO_AN_FIXED:
if (phy_id == 0) {
phylink_get_fixed_state(pl, &state);
-@@ -1579,7 +1582,7 @@ static int phylink_mii_read(struct phyli
+@@ -1582,7 +1585,7 @@ static int phylink_mii_read(struct phyli
static int phylink_mii_write(struct phylink *pl, unsigned int phy_id,
unsigned int reg, unsigned int val)
{
case MLO_AN_FIXED:
break;
-@@ -1753,10 +1756,10 @@ static int phylink_sfp_module_insert(voi
+@@ -1756,10 +1759,10 @@ static int phylink_sfp_module_insert(voi
linkmode_copy(pl->link_config.advertising, config.advertising);
}
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
-@@ -1688,25 +1688,21 @@ static void phylink_sfp_detach(void *ups
+@@ -1691,25 +1691,21 @@ static void phylink_sfp_detach(void *ups
pl->netdev->sfp_bus = NULL;
}
config.interface = PHY_INTERFACE_MODE_NA;
config.speed = SPEED_UNKNOWN;
config.duplex = DUPLEX_UNKNOWN;
-@@ -1721,8 +1717,6 @@ static int phylink_sfp_module_insert(voi
+@@ -1724,8 +1720,6 @@ static int phylink_sfp_module_insert(voi
return ret;
}
iface = sfp_select_interface(pl->sfp_bus, config.advertising);
if (iface == PHY_INTERFACE_MODE_NA) {
phylink_err(pl,
-@@ -1732,18 +1726,18 @@ static int phylink_sfp_module_insert(voi
+@@ -1735,18 +1729,18 @@ static int phylink_sfp_module_insert(voi
}
config.interface = iface;
__ETHTOOL_LINK_MODE_MASK_NBITS, support);
if (phy_interface_mode_is_8023z(iface) && pl->phydev)
-@@ -1756,15 +1750,15 @@ static int phylink_sfp_module_insert(voi
+@@ -1759,15 +1753,15 @@ static int phylink_sfp_module_insert(voi
linkmode_copy(pl->link_config.advertising, config.advertising);
}
phy_modes(config.interface));
}
-@@ -1777,6 +1771,21 @@ static int phylink_sfp_module_insert(voi
+@@ -1780,6 +1774,21 @@ static int phylink_sfp_module_insert(voi
return ret;
}
};
#define phylink_printk(level, pl, fmt, ...) \
-@@ -1688,7 +1691,7 @@ static void phylink_sfp_detach(void *ups
+@@ -1691,7 +1694,7 @@ static void phylink_sfp_detach(void *ups
pl->netdev->sfp_bus = NULL;
}
const unsigned long *supported,
const unsigned long *advertising)
{
-@@ -1762,7 +1765,7 @@ static int phylink_sfp_config(struct phy
+@@ -1765,7 +1768,7 @@ static int phylink_sfp_config(struct phy
phy_modes(config.interface));
}
if (changed && !test_bit(PHYLINK_DISABLE_STOPPED,
&pl->phylink_disable_state))
-@@ -1775,15 +1778,20 @@ static int phylink_sfp_module_insert(voi
+@@ -1778,15 +1781,20 @@ static int phylink_sfp_module_insert(voi
const struct sfp_eeprom_id *id)
{
struct phylink *pl = upstream;
}
static int phylink_sfp_module_start(void *upstream)
-@@ -1791,10 +1799,19 @@ static int phylink_sfp_module_start(void
+@@ -1794,10 +1802,19 @@ static int phylink_sfp_module_start(void
struct phylink *pl = upstream;
/* If this SFP module has a PHY, start the PHY now. */
}
static void phylink_sfp_module_stop(void *upstream)
-@@ -1828,10 +1845,26 @@ static void phylink_sfp_link_up(void *up
+@@ -1831,10 +1848,26 @@ static void phylink_sfp_link_up(void *up
static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
{
struct phylink *pl = upstream;
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
-@@ -1842,10 +1842,20 @@ static void phylink_sfp_link_up(void *up
+@@ -1845,10 +1845,20 @@ static void phylink_sfp_link_up(void *up
phylink_run_resolve(pl);
}
int ret;
/*
-@@ -1857,9 +1867,13 @@ static int phylink_sfp_connect_phy(void
+@@ -1860,9 +1870,13 @@ static int phylink_sfp_connect_phy(void
*/
phy_support_asym_pause(phy);