net: phy: Fix modular PHYLIB build
After commitc59530d0d5
("net: Move PHY statistics code into PHY library helpers") we made net/core/ethtool.c reference symbols which are part of the library which can be modular. David introduced a temporary fix with1ecd6e8ad9
("phy: Temporary build fix after phylib changes.") which would prevent such modularity. This is not desireable of course, so instead, just inline the functions into include/linux/phy.h to keep both options available. Fixes:c59530d0d5
("net: Move PHY statistics code into PHY library helpers") Fixes:1ecd6e8ad9
("phy: Temporary build fix after phylib changes.") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
af201bab50
commit
9e8d438e8b
@ -9,6 +9,7 @@ menuconfig MDIO_DEVICE
|
|||||||
|
|
||||||
config MDIO_BUS
|
config MDIO_BUS
|
||||||
tristate
|
tristate
|
||||||
|
default m if PHYLIB=m
|
||||||
default MDIO_DEVICE
|
default MDIO_DEVICE
|
||||||
help
|
help
|
||||||
This internal symbol is used for link time dependencies and it
|
This internal symbol is used for link time dependencies and it
|
||||||
@ -170,7 +171,7 @@ config PHYLINK
|
|||||||
autonegotiation modes.
|
autonegotiation modes.
|
||||||
|
|
||||||
menuconfig PHYLIB
|
menuconfig PHYLIB
|
||||||
bool "PHY Device support and infrastructure"
|
tristate "PHY Device support and infrastructure"
|
||||||
depends on NETDEVICES
|
depends on NETDEVICES
|
||||||
select MDIO_DEVICE
|
select MDIO_DEVICE
|
||||||
help
|
help
|
||||||
|
@ -1277,51 +1277,3 @@ int phy_ethtool_nway_reset(struct net_device *ndev)
|
|||||||
return phy_restart_aneg(phydev);
|
return phy_restart_aneg(phydev);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(phy_ethtool_nway_reset);
|
EXPORT_SYMBOL(phy_ethtool_nway_reset);
|
||||||
|
|
||||||
int phy_ethtool_get_strings(struct phy_device *phydev, u8 *data)
|
|
||||||
{
|
|
||||||
if (!phydev->drv)
|
|
||||||
return -EIO;
|
|
||||||
|
|
||||||
mutex_lock(&phydev->lock);
|
|
||||||
phydev->drv->get_strings(phydev, data);
|
|
||||||
mutex_unlock(&phydev->lock);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(phy_ethtool_get_strings);
|
|
||||||
|
|
||||||
int phy_ethtool_get_sset_count(struct phy_device *phydev)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (!phydev->drv)
|
|
||||||
return -EIO;
|
|
||||||
|
|
||||||
if (phydev->drv->get_sset_count &&
|
|
||||||
phydev->drv->get_strings &&
|
|
||||||
phydev->drv->get_stats) {
|
|
||||||
mutex_lock(&phydev->lock);
|
|
||||||
ret = phydev->drv->get_sset_count(phydev);
|
|
||||||
mutex_unlock(&phydev->lock);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(phy_ethtool_get_sset_count);
|
|
||||||
|
|
||||||
int phy_ethtool_get_stats(struct phy_device *phydev,
|
|
||||||
struct ethtool_stats *stats, u64 *data)
|
|
||||||
{
|
|
||||||
if (!phydev->drv)
|
|
||||||
return -EIO;
|
|
||||||
|
|
||||||
mutex_lock(&phydev->lock);
|
|
||||||
phydev->drv->get_stats(phydev, stats, data);
|
|
||||||
mutex_unlock(&phydev->lock);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(phy_ethtool_get_stats);
|
|
||||||
|
@ -1066,28 +1066,54 @@ int phy_ethtool_nway_reset(struct net_device *ndev);
|
|||||||
#if IS_ENABLED(CONFIG_PHYLIB)
|
#if IS_ENABLED(CONFIG_PHYLIB)
|
||||||
int __init mdio_bus_init(void);
|
int __init mdio_bus_init(void);
|
||||||
void mdio_bus_exit(void);
|
void mdio_bus_exit(void);
|
||||||
int phy_ethtool_get_strings(struct phy_device *phydev, u8 *data);
|
|
||||||
int phy_ethtool_get_sset_count(struct phy_device *phydev);
|
|
||||||
int phy_ethtool_get_stats(struct phy_device *phydev,
|
|
||||||
struct ethtool_stats *stats, u64 *data);
|
|
||||||
#else
|
|
||||||
int phy_ethtool_get_strings(struct phy_device *phydev, u8 *data)
|
|
||||||
{
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
int phy_ethtool_get_sset_count(struct phy_device *phydev)
|
|
||||||
{
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
|
|
||||||
int phy_ethtool_get_stats(struct phy_device *phydev,
|
|
||||||
struct ethtool_stats *stats, u64 *data)
|
|
||||||
{
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Inline function for use within net/core/ethtool.c (built-in) */
|
||||||
|
static inline int phy_ethtool_get_strings(struct phy_device *phydev, u8 *data)
|
||||||
|
{
|
||||||
|
if (!phydev->drv)
|
||||||
|
return -EIO;
|
||||||
|
|
||||||
|
mutex_lock(&phydev->lock);
|
||||||
|
phydev->drv->get_strings(phydev, data);
|
||||||
|
mutex_unlock(&phydev->lock);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int phy_ethtool_get_sset_count(struct phy_device *phydev)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!phydev->drv)
|
||||||
|
return -EIO;
|
||||||
|
|
||||||
|
if (phydev->drv->get_sset_count &&
|
||||||
|
phydev->drv->get_strings &&
|
||||||
|
phydev->drv->get_stats) {
|
||||||
|
mutex_lock(&phydev->lock);
|
||||||
|
ret = phydev->drv->get_sset_count(phydev);
|
||||||
|
mutex_unlock(&phydev->lock);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int phy_ethtool_get_stats(struct phy_device *phydev,
|
||||||
|
struct ethtool_stats *stats, u64 *data)
|
||||||
|
{
|
||||||
|
if (!phydev->drv)
|
||||||
|
return -EIO;
|
||||||
|
|
||||||
|
mutex_lock(&phydev->lock);
|
||||||
|
phydev->drv->get_stats(phydev, stats, data);
|
||||||
|
mutex_unlock(&phydev->lock);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
extern struct bus_type mdio_bus_type;
|
extern struct bus_type mdio_bus_type;
|
||||||
|
|
||||||
struct mdio_board_info {
|
struct mdio_board_info {
|
||||||
|
Loading…
Reference in New Issue
Block a user