Commit 814a1784 authored by David S. Miller's avatar David S. Miller

Merge branch 'sfp-phylink-fixes'

Russell King says:

====================
More SFP/phylink fixes

This series fixes a few more bits with sfp/phylink, particularly
confusion with the right way to test for the RTNL mutex being
held, a change in 2016 to the mdiobus_scan() behaviour that wasn't
noticed, and a fix for reading module EEPROMs.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 75e8e156 8b874514
......@@ -807,7 +807,7 @@ void phylink_disconnect_phy(struct phylink *pl)
{
struct phy_device *phy;
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
phy = pl->phydev;
if (phy) {
......@@ -877,7 +877,7 @@ EXPORT_SYMBOL_GPL(phylink_mac_change);
*/
void phylink_start(struct phylink *pl)
{
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
netdev_info(pl->netdev, "configuring for %s/%s link mode\n",
phylink_an_mode_str(pl->link_an_mode),
......@@ -917,7 +917,7 @@ EXPORT_SYMBOL_GPL(phylink_start);
*/
void phylink_stop(struct phylink *pl)
{
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
if (pl->phydev)
phy_stop(pl->phydev);
......@@ -941,7 +941,7 @@ EXPORT_SYMBOL_GPL(phylink_stop);
*/
void phylink_ethtool_get_wol(struct phylink *pl, struct ethtool_wolinfo *wol)
{
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
wol->supported = 0;
wol->wolopts = 0;
......@@ -966,7 +966,7 @@ int phylink_ethtool_set_wol(struct phylink *pl, struct ethtool_wolinfo *wol)
{
int ret = -EOPNOTSUPP;
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
if (pl->phydev)
ret = phy_ethtool_set_wol(pl->phydev, wol);
......@@ -1011,7 +1011,7 @@ int phylink_ethtool_ksettings_get(struct phylink *pl,
{
struct phylink_link_state link_state;
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
if (pl->phydev) {
phy_ethtool_ksettings_get(pl->phydev, kset);
......@@ -1064,7 +1064,7 @@ int phylink_ethtool_ksettings_set(struct phylink *pl,
struct phylink_link_state config;
int ret;
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
if (kset->base.autoneg != AUTONEG_DISABLE &&
kset->base.autoneg != AUTONEG_ENABLE)
......@@ -1165,7 +1165,7 @@ int phylink_ethtool_nway_reset(struct phylink *pl)
{
int ret = 0;
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
if (pl->phydev)
ret = phy_restart_aneg(pl->phydev);
......@@ -1183,7 +1183,7 @@ EXPORT_SYMBOL_GPL(phylink_ethtool_nway_reset);
void phylink_ethtool_get_pauseparam(struct phylink *pl,
struct ethtool_pauseparam *pause)
{
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
pause->autoneg = !!(pl->link_config.pause & MLO_PAUSE_AN);
pause->rx_pause = !!(pl->link_config.pause & MLO_PAUSE_RX);
......@@ -1201,7 +1201,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,
{
struct phylink_link_state *config = &pl->link_config;
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
if (!phylink_test(pl->supported, Pause) &&
!phylink_test(pl->supported, Asym_Pause))
......@@ -1287,7 +1287,7 @@ int phylink_get_eee_err(struct phylink *pl)
{
int ret = 0;
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
if (pl->phydev)
ret = phy_get_eee_err(pl->phydev);
......@@ -1305,7 +1305,7 @@ int phylink_ethtool_get_eee(struct phylink *pl, struct ethtool_eee *eee)
{
int ret = -EOPNOTSUPP;
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
if (pl->phydev)
ret = phy_ethtool_get_eee(pl->phydev, eee);
......@@ -1323,7 +1323,7 @@ int phylink_ethtool_set_eee(struct phylink *pl, struct ethtool_eee *eee)
{
int ret = -EOPNOTSUPP;
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
if (pl->phydev)
ret = phy_ethtool_set_eee(pl->phydev, eee);
......@@ -1513,7 +1513,7 @@ int phylink_mii_ioctl(struct phylink *pl, struct ifreq *ifr, int cmd)
struct mii_ioctl_data *mii = if_mii(ifr);
int ret;
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
if (pl->phydev) {
/* PHYs only exist for MLO_AN_PHY and SGMII */
......@@ -1581,7 +1581,7 @@ static int phylink_sfp_module_insert(void *upstream,
port = sfp_parse_port(pl->sfp_bus, id, support);
iface = sfp_parse_interface(pl->sfp_bus, id);
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
switch (iface) {
case PHY_INTERFACE_MODE_SGMII:
......@@ -1650,7 +1650,7 @@ static void phylink_sfp_link_down(void *upstream)
{
struct phylink *pl = upstream;
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
set_bit(PHYLINK_DISABLE_LINK, &pl->phylink_disable_state);
flush_work(&pl->resolve);
......@@ -1662,7 +1662,7 @@ static void phylink_sfp_link_up(void *upstream)
{
struct phylink *pl = upstream;
WARN_ON(!lockdep_rtnl_is_held());
ASSERT_RTNL();
clear_bit(PHYLINK_DISABLE_LINK, &pl->phylink_disable_state);
phylink_run_resolve(pl);
......
......@@ -356,12 +356,12 @@ static void sfp_sm_probe_phy(struct sfp *sfp)
msleep(T_PHY_RESET_MS);
phy = mdiobus_scan(sfp->i2c_mii, SFP_PHY_ADDR);
if (IS_ERR(phy)) {
dev_err(sfp->dev, "mdiobus scan returned %ld\n", PTR_ERR(phy));
if (phy == ERR_PTR(-ENODEV)) {
dev_info(sfp->dev, "no PHY detected\n");
return;
}
if (!phy) {
dev_info(sfp->dev, "no PHY detected\n");
if (IS_ERR(phy)) {
dev_err(sfp->dev, "mdiobus scan returned %ld\n", PTR_ERR(phy));
return;
}
......@@ -724,20 +724,19 @@ static int sfp_module_eeprom(struct sfp *sfp, struct ethtool_eeprom *ee,
len = min_t(unsigned int, last, ETH_MODULE_SFF_8079_LEN);
len -= first;
ret = sfp->read(sfp, false, first, data, len);
ret = sfp_read(sfp, false, first, data, len);
if (ret < 0)
return ret;
first += len;
data += len;
}
if (first >= ETH_MODULE_SFF_8079_LEN &&
first < ETH_MODULE_SFF_8472_LEN) {
if (first < ETH_MODULE_SFF_8472_LEN && last > ETH_MODULE_SFF_8079_LEN) {
len = min_t(unsigned int, last, ETH_MODULE_SFF_8472_LEN);
len -= first;
first -= ETH_MODULE_SFF_8079_LEN;
ret = sfp->read(sfp, true, first, data, len);
ret = sfp_read(sfp, true, first, data, len);
if (ret < 0)
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment