wimax: use genl_register_family_with_ops()

This simplifies the code since there's no longer a need to
have error handling in the registration.

Unfortunately it means more extern function declarations are
needed, but the overall goal would seem to justify this.

Due to the removal of duplication in the netlink policies,
this reduces the size of wimax by almost 1k.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Johannes Berg
2013-11-14 17:14:42 +01:00
committed by David S. Miller
parent 1c582d915d
commit b61a5eea59
6 changed files with 47 additions and 119 deletions

View File

@@ -321,17 +321,6 @@ int wimax_msg(struct wimax_dev *wimax_dev, const char *pipe_name,
}
EXPORT_SYMBOL_GPL(wimax_msg);
static const struct nla_policy wimax_gnl_msg_policy[WIMAX_GNL_ATTR_MAX + 1] = {
[WIMAX_GNL_MSG_IFIDX] = {
.type = NLA_U32,
},
[WIMAX_GNL_MSG_DATA] = {
.type = NLA_UNSPEC, /* libnl doesn't grok BINARY yet */
},
};
/*
* Relays a message from user space to the driver
*
@@ -340,7 +329,6 @@ static const struct nla_policy wimax_gnl_msg_policy[WIMAX_GNL_ATTR_MAX + 1] = {
*
* This call will block while handling/relaying the message.
*/
static
int wimax_gnl_doit_msg_from_user(struct sk_buff *skb, struct genl_info *info)
{
int result, ifindex;
@@ -418,16 +406,3 @@ error_no_wimax_dev:
return result;
}
/*
* Generic Netlink glue
*/
struct genl_ops wimax_gnl_msg_from_user = {
.cmd = WIMAX_GNL_OP_MSG_FROM_USER,
.flags = GENL_ADMIN_PERM,
.policy = wimax_gnl_msg_policy,
.doit = wimax_gnl_doit_msg_from_user,
.dumpit = NULL,
};