Skip to content

Commit 7db69ec

Browse files
minimaxwelldavem330
authored andcommitted
net: ethtool: plca: Target the command to the requested PHY
PLCA is a PHY-specific command. Instead of targeting the command towards dev->phydev, use the request to pick the targeted PHY. Signed-off-by: Maxime Chevallier <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 95132a0 commit 7db69ec

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

net/ethtool/plca.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static int plca_get_cfg_prepare_data(const struct ethnl_req_info *req_base,
6161
int ret;
6262

6363
// check that the PHY device is available and connected
64-
if (!dev->phydev) {
64+
if (!req_base->phydev) {
6565
ret = -EOPNOTSUPP;
6666
goto out;
6767
}
@@ -80,7 +80,7 @@ static int plca_get_cfg_prepare_data(const struct ethnl_req_info *req_base,
8080
memset(&data->plca_cfg, 0xff,
8181
sizeof_field(struct plca_reply_data, plca_cfg));
8282

83-
ret = ops->get_plca_cfg(dev->phydev, &data->plca_cfg);
83+
ret = ops->get_plca_cfg(req_base->phydev, &data->plca_cfg);
8484
ethnl_ops_complete(dev);
8585

8686
out:
@@ -141,15 +141,14 @@ const struct nla_policy ethnl_plca_set_cfg_policy[] = {
141141
static int
142142
ethnl_set_plca(struct ethnl_req_info *req_info, struct genl_info *info)
143143
{
144-
struct net_device *dev = req_info->dev;
145144
const struct ethtool_phy_ops *ops;
146145
struct nlattr **tb = info->attrs;
147146
struct phy_plca_cfg plca_cfg;
148147
bool mod = false;
149148
int ret;
150149

151150
// check that the PHY device is available and connected
152-
if (!dev->phydev)
151+
if (!req_info->phydev)
153152
return -EOPNOTSUPP;
154153

155154
ops = ethtool_phy_ops;
@@ -168,7 +167,7 @@ ethnl_set_plca(struct ethnl_req_info *req_info, struct genl_info *info)
168167
if (!mod)
169168
return 0;
170169

171-
ret = ops->set_plca_cfg(dev->phydev, &plca_cfg, info->extack);
170+
ret = ops->set_plca_cfg(req_info->phydev, &plca_cfg, info->extack);
172171
return ret < 0 ? ret : 1;
173172
}
174173

@@ -204,7 +203,7 @@ static int plca_get_status_prepare_data(const struct ethnl_req_info *req_base,
204203
int ret;
205204

206205
// check that the PHY device is available and connected
207-
if (!dev->phydev) {
206+
if (!req_base->phydev) {
208207
ret = -EOPNOTSUPP;
209208
goto out;
210209
}
@@ -223,7 +222,7 @@ static int plca_get_status_prepare_data(const struct ethnl_req_info *req_base,
223222
memset(&data->plca_st, 0xff,
224223
sizeof_field(struct plca_reply_data, plca_st));
225224

226-
ret = ops->get_plca_status(dev->phydev, &data->plca_st);
225+
ret = ops->get_plca_status(req_base->phydev, &data->plca_st);
227226
ethnl_ops_complete(dev);
228227
out:
229228
return ret;

0 commit comments

Comments
 (0)