Commit 98130546 authored by Michal Kubecek's avatar Michal Kubecek Committed by David S. Miller

ethtool: rename ethnl_parse_header() to ethnl_parse_header_dev_get()

Andrew Lunn pointed out that even if it's documented that
ethnl_parse_header() takes reference to network device if it fills it
into the target structure, its name doesn't make it apparent so that
corresponding dev_put() looks like mismatched.

Rename the function ethnl_parse_header_dev_get() to indicate that it
takes a reference.
Suggested-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarMichal Kubecek <mkubecek@suse.cz>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f8ab3047
...@@ -102,8 +102,10 @@ int ethnl_set_debug(struct sk_buff *skb, struct genl_info *info) ...@@ -102,8 +102,10 @@ int ethnl_set_debug(struct sk_buff *skb, struct genl_info *info)
info->extack); info->extack);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = ethnl_parse_header(&req_info, tb[ETHTOOL_A_DEBUG_HEADER], ret = ethnl_parse_header_dev_get(&req_info,
genl_info_net(info), info->extack, true); tb[ETHTOOL_A_DEBUG_HEADER],
genl_info_net(info), info->extack,
true);
if (ret < 0) if (ret < 0)
return ret; return ret;
dev = req_info.dev; dev = req_info.dev;
......
...@@ -121,8 +121,10 @@ int ethnl_set_linkinfo(struct sk_buff *skb, struct genl_info *info) ...@@ -121,8 +121,10 @@ int ethnl_set_linkinfo(struct sk_buff *skb, struct genl_info *info)
info->extack); info->extack);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = ethnl_parse_header(&req_info, tb[ETHTOOL_A_LINKINFO_HEADER], ret = ethnl_parse_header_dev_get(&req_info,
genl_info_net(info), info->extack, true); tb[ETHTOOL_A_LINKINFO_HEADER],
genl_info_net(info), info->extack,
true);
if (ret < 0) if (ret < 0)
return ret; return ret;
dev = req_info.dev; dev = req_info.dev;
......
...@@ -334,8 +334,10 @@ int ethnl_set_linkmodes(struct sk_buff *skb, struct genl_info *info) ...@@ -334,8 +334,10 @@ int ethnl_set_linkmodes(struct sk_buff *skb, struct genl_info *info)
info->extack); info->extack);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = ethnl_parse_header(&req_info, tb[ETHTOOL_A_LINKMODES_HEADER], ret = ethnl_parse_header_dev_get(&req_info,
genl_info_net(info), info->extack, true); tb[ETHTOOL_A_LINKMODES_HEADER],
genl_info_net(info), info->extack,
true);
if (ret < 0) if (ret < 0)
return ret; return ret;
dev = req_info.dev; dev = req_info.dev;
......
...@@ -18,7 +18,7 @@ static const struct nla_policy ethnl_header_policy[ETHTOOL_A_HEADER_MAX + 1] = { ...@@ -18,7 +18,7 @@ static const struct nla_policy ethnl_header_policy[ETHTOOL_A_HEADER_MAX + 1] = {
}; };
/** /**
* ethnl_parse_header() - parse request header * ethnl_parse_header_dev_get() - parse request header
* @req_info: structure to put results into * @req_info: structure to put results into
* @header: nest attribute with request header * @header: nest attribute with request header
* @net: request netns * @net: request netns
...@@ -33,9 +33,9 @@ static const struct nla_policy ethnl_header_policy[ETHTOOL_A_HEADER_MAX + 1] = { ...@@ -33,9 +33,9 @@ static const struct nla_policy ethnl_header_policy[ETHTOOL_A_HEADER_MAX + 1] = {
* *
* Return: 0 on success or negative error code * Return: 0 on success or negative error code
*/ */
int ethnl_parse_header(struct ethnl_req_info *req_info, int ethnl_parse_header_dev_get(struct ethnl_req_info *req_info,
const struct nlattr *header, struct net *net, const struct nlattr *header, struct net *net,
struct netlink_ext_ack *extack, bool require_dev) struct netlink_ext_ack *extack, bool require_dev)
{ {
struct nlattr *tb[ETHTOOL_A_HEADER_MAX + 1]; struct nlattr *tb[ETHTOOL_A_HEADER_MAX + 1];
const struct nlattr *devname_attr; const struct nlattr *devname_attr;
...@@ -253,8 +253,8 @@ static int ethnl_default_parse(struct ethnl_req_info *req_info, ...@@ -253,8 +253,8 @@ static int ethnl_default_parse(struct ethnl_req_info *req_info,
request_ops->request_policy, extack); request_ops->request_policy, extack);
if (ret < 0) if (ret < 0)
goto out; goto out;
ret = ethnl_parse_header(req_info, tb[request_ops->hdr_attr], net, ret = ethnl_parse_header_dev_get(req_info, tb[request_ops->hdr_attr],
extack, require_dev); net, extack, require_dev);
if (ret < 0) if (ret < 0)
goto out; goto out;
......
...@@ -10,9 +10,10 @@ ...@@ -10,9 +10,10 @@
struct ethnl_req_info; struct ethnl_req_info;
int ethnl_parse_header(struct ethnl_req_info *req_info, int ethnl_parse_header_dev_get(struct ethnl_req_info *req_info,
const struct nlattr *nest, struct net *net, const struct nlattr *nest, struct net *net,
struct netlink_ext_ack *extack, bool require_dev); struct netlink_ext_ack *extack,
bool require_dev);
int ethnl_fill_reply_header(struct sk_buff *skb, struct net_device *dev, int ethnl_fill_reply_header(struct sk_buff *skb, struct net_device *dev,
u16 attrtype); u16 attrtype);
struct sk_buff *ethnl_reply_init(size_t payload, struct net_device *dev, u8 cmd, struct sk_buff *ethnl_reply_init(size_t payload, struct net_device *dev, u8 cmd,
......
...@@ -123,8 +123,9 @@ int ethnl_set_wol(struct sk_buff *skb, struct genl_info *info) ...@@ -123,8 +123,9 @@ int ethnl_set_wol(struct sk_buff *skb, struct genl_info *info)
wol_set_policy, info->extack); wol_set_policy, info->extack);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = ethnl_parse_header(&req_info, tb[ETHTOOL_A_WOL_HEADER], ret = ethnl_parse_header_dev_get(&req_info, tb[ETHTOOL_A_WOL_HEADER],
genl_info_net(info), info->extack, true); genl_info_net(info), info->extack,
true);
if (ret < 0) if (ret < 0)
return ret; return ret;
dev = req_info.dev; dev = req_info.dev;
......
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