Commit 95dfc7ef authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller

net: ethtool: Export helpers for getting EEPROM info

There are two ways to retrieve information from SFP EEPROMs.  Many
devices make use of the common code, and assign the sfp_bus pointer in
the netdev to point to the bus holding the SFP device. Some MAC
drivers directly implement ops in there ethool structure.

Export within net/ethtool the two helpers used to call these methods,
so that they can also be used in the new netlink code.
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4c88fa41
...@@ -47,4 +47,9 @@ int __ethtool_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info); ...@@ -47,4 +47,9 @@ int __ethtool_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info);
extern const struct ethtool_phy_ops *ethtool_phy_ops; extern const struct ethtool_phy_ops *ethtool_phy_ops;
int ethtool_get_module_info_call(struct net_device *dev,
struct ethtool_modinfo *modinfo);
int ethtool_get_module_eeprom_call(struct net_device *dev,
struct ethtool_eeprom *ee, u8 *data);
#endif /* _ETHTOOL_COMMON_H */ #endif /* _ETHTOOL_COMMON_H */
...@@ -2188,8 +2188,8 @@ static int ethtool_get_ts_info(struct net_device *dev, void __user *useraddr) ...@@ -2188,8 +2188,8 @@ static int ethtool_get_ts_info(struct net_device *dev, void __user *useraddr)
return 0; return 0;
} }
static int __ethtool_get_module_info(struct net_device *dev, int ethtool_get_module_info_call(struct net_device *dev,
struct ethtool_modinfo *modinfo) struct ethtool_modinfo *modinfo)
{ {
const struct ethtool_ops *ops = dev->ethtool_ops; const struct ethtool_ops *ops = dev->ethtool_ops;
struct phy_device *phydev = dev->phydev; struct phy_device *phydev = dev->phydev;
...@@ -2215,7 +2215,7 @@ static int ethtool_get_module_info(struct net_device *dev, ...@@ -2215,7 +2215,7 @@ static int ethtool_get_module_info(struct net_device *dev,
if (copy_from_user(&modinfo, useraddr, sizeof(modinfo))) if (copy_from_user(&modinfo, useraddr, sizeof(modinfo)))
return -EFAULT; return -EFAULT;
ret = __ethtool_get_module_info(dev, &modinfo); ret = ethtool_get_module_info_call(dev, &modinfo);
if (ret) if (ret)
return ret; return ret;
...@@ -2225,8 +2225,8 @@ static int ethtool_get_module_info(struct net_device *dev, ...@@ -2225,8 +2225,8 @@ static int ethtool_get_module_info(struct net_device *dev,
return 0; return 0;
} }
static int __ethtool_get_module_eeprom(struct net_device *dev, int ethtool_get_module_eeprom_call(struct net_device *dev,
struct ethtool_eeprom *ee, u8 *data) struct ethtool_eeprom *ee, u8 *data)
{ {
const struct ethtool_ops *ops = dev->ethtool_ops; const struct ethtool_ops *ops = dev->ethtool_ops;
struct phy_device *phydev = dev->phydev; struct phy_device *phydev = dev->phydev;
...@@ -2249,12 +2249,12 @@ static int ethtool_get_module_eeprom(struct net_device *dev, ...@@ -2249,12 +2249,12 @@ static int ethtool_get_module_eeprom(struct net_device *dev,
int ret; int ret;
struct ethtool_modinfo modinfo; struct ethtool_modinfo modinfo;
ret = __ethtool_get_module_info(dev, &modinfo); ret = ethtool_get_module_info_call(dev, &modinfo);
if (ret) if (ret)
return ret; return ret;
return ethtool_get_any_eeprom(dev, useraddr, return ethtool_get_any_eeprom(dev, useraddr,
__ethtool_get_module_eeprom, ethtool_get_module_eeprom_call,
modinfo.eeprom_len); modinfo.eeprom_len);
} }
......
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