Skip to content

Commit 345237d

Browse files
minimaxwelldavem330
authored andcommitted
net: ethtool: pse-pd: Target the command to the requested PHY
PSE and PD configuration is a PHY-specific command. Instead of targeting the command towards dev->phydev, use the request to pick the targeted PHY device. Signed-off-by: Maxime Chevallier <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7db69ec commit 345237d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

net/ethtool/pse-pd.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@ const struct nla_policy ethnl_pse_get_policy[ETHTOOL_A_PSE_HEADER + 1] = {
3131
[ETHTOOL_A_PSE_HEADER] = NLA_POLICY_NESTED(ethnl_header_policy),
3232
};
3333

34-
static int pse_get_pse_attributes(struct net_device *dev,
34+
static int pse_get_pse_attributes(struct phy_device *phydev,
3535
struct netlink_ext_ack *extack,
3636
struct pse_reply_data *data)
3737
{
38-
struct phy_device *phydev = dev->phydev;
39-
4038
if (!phydev) {
4139
NL_SET_ERR_MSG(extack, "No PHY is attached");
4240
return -EOPNOTSUPP;
@@ -64,7 +62,7 @@ static int pse_prepare_data(const struct ethnl_req_info *req_base,
6462
if (ret < 0)
6563
return ret;
6664

67-
ret = pse_get_pse_attributes(dev, info->extack, data);
65+
ret = pse_get_pse_attributes(req_base->phydev, info->extack, data);
6866

6967
ethnl_ops_complete(dev);
7068

@@ -124,15 +122,14 @@ ethnl_set_pse_validate(struct ethnl_req_info *req_info, struct genl_info *info)
124122
static int
125123
ethnl_set_pse(struct ethnl_req_info *req_info, struct genl_info *info)
126124
{
127-
struct net_device *dev = req_info->dev;
128125
struct pse_control_config config = {};
129126
struct nlattr **tb = info->attrs;
130127
struct phy_device *phydev;
131128

132129
/* this values are already validated by the ethnl_pse_set_policy */
133130
config.admin_cotrol = nla_get_u32(tb[ETHTOOL_A_PODL_PSE_ADMIN_CONTROL]);
134131

135-
phydev = dev->phydev;
132+
phydev = req_info->phydev;
136133
if (!phydev) {
137134
NL_SET_ERR_MSG(info->extack, "No PHY is attached");
138135
return -EOPNOTSUPP;

0 commit comments

Comments
 (0)