summaryrefslogtreecommitdiff
path: root/net/tipc
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2009-05-21 10:34:05 +0000
committerDavid S. Miller <davem@davemloft.net>2009-05-21 16:50:23 -0700
commitacb0a200ae48d95e3117608d0225a23e5efa283c (patch)
tree74e81fc4bffe2e182379b8ed773ba3c30bc8dd04 /net/tipc
parent502664eeaf880d364821521bbced7ae342f77f64 (diff)
downloadlinux-3.10-acb0a200ae48d95e3117608d0225a23e5efa283c.tar.gz
linux-3.10-acb0a200ae48d95e3117608d0225a23e5efa283c.tar.bz2
linux-3.10-acb0a200ae48d95e3117608d0225a23e5efa283c.zip
tipc: Use genl_register_family_with_ops()
Use genl_register_family_with_ops() instead of a copy. This also changes netlink related variable names to be kernel-wide unique for consistency with other users. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/netlink.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c
index c387217bb23..3c57005e44d 100644
--- a/net/tipc/netlink.c
+++ b/net/tipc/netlink.c
@@ -68,7 +68,7 @@ static int handle_cmd(struct sk_buff *skb, struct genl_info *info)
return 0;
}
-static struct genl_family family = {
+static struct genl_family tipc_genl_family = {
.id = GENL_ID_GENERATE,
.name = TIPC_GENL_NAME,
.version = TIPC_GENL_VERSION,
@@ -76,39 +76,33 @@ static struct genl_family family = {
.maxattr = 0,
};
-static struct genl_ops ops = {
+static struct genl_ops tipc_genl_ops = {
.cmd = TIPC_GENL_CMD,
.doit = handle_cmd,
};
-static int family_registered = 0;
+static int tipc_genl_family_registered;
int tipc_netlink_start(void)
{
+ int res;
+ res = genl_register_family_with_ops(&tipc_genl_family,
+ &tipc_genl_ops, 1);
+ if (res) {
+ err("Failed to register netlink interface\n");
+ return res;
+ }
- if (genl_register_family(&family))
- goto err;
-
- family_registered = 1;
-
- if (genl_register_ops(&family, &ops))
- goto err_unregister;
-
+ tipc_genl_family_registered = 1;
return 0;
-
- err_unregister:
- genl_unregister_family(&family);
- family_registered = 0;
- err:
- err("Failed to register netlink interface\n");
- return -EFAULT;
}
void tipc_netlink_stop(void)
{
- if (family_registered) {
- genl_unregister_family(&family);
- family_registered = 0;
- }
+ if (!tipc_genl_family_registered)
+ return;
+
+ genl_unregister_family(&tipc_genl_family);
+ tipc_genl_family_registered = 0;
}