aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/taskstats.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-11-14 11:14:39 -0500
committerDavid S. Miller <davem@davemloft.net>2013-11-14 17:10:40 -0500
commit88d36a9949513419de3a506e7fca8b82d1dc972a (patch)
treeea91ab0a7da6b3549a0559677b8cd9937006a6e7 /kernel/taskstats.c
parent1e9f3d6f1c403dd2b6270f654b4747147aa2306f (diff)
taskstats: use genl_register_family_with_ops()
This simplifies the code since there's no longer a need to have error handling in the registration. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/taskstats.c')
-rw-r--r--kernel/taskstats.c39
1 files changed, 14 insertions, 25 deletions
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index 9f4618eb51c8..609e77f68687 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -673,17 +673,18 @@ err:
673 nlmsg_free(rep_skb); 673 nlmsg_free(rep_skb);
674} 674}
675 675
676static struct genl_ops taskstats_ops = { 676static struct genl_ops taskstats_ops[] = {
677 .cmd = TASKSTATS_CMD_GET, 677 {
678 .doit = taskstats_user_cmd, 678 .cmd = TASKSTATS_CMD_GET,
679 .policy = taskstats_cmd_get_policy, 679 .doit = taskstats_user_cmd,
680 .flags = GENL_ADMIN_PERM, 680 .policy = taskstats_cmd_get_policy,
681}; 681 .flags = GENL_ADMIN_PERM,
682 682 },
683static struct genl_ops cgroupstats_ops = { 683 {
684 .cmd = CGROUPSTATS_CMD_GET, 684 .cmd = CGROUPSTATS_CMD_GET,
685 .doit = cgroupstats_user_cmd, 685 .doit = cgroupstats_user_cmd,
686 .policy = cgroupstats_cmd_get_policy, 686 .policy = cgroupstats_cmd_get_policy,
687 },
687}; 688};
688 689
689/* Needed early in initialization */ 690/* Needed early in initialization */
@@ -702,26 +703,14 @@ static int __init taskstats_init(void)
702{ 703{
703 int rc; 704 int rc;
704 705
705 rc = genl_register_family(&family); 706 rc = genl_register_family_with_ops(&family, taskstats_ops,
707 ARRAY_SIZE(taskstats_ops));
706 if (rc) 708 if (rc)
707 return rc; 709 return rc;
708 710
709 rc = genl_register_ops(&family, &taskstats_ops);
710 if (rc < 0)
711 goto err;
712
713 rc = genl_register_ops(&family, &cgroupstats_ops);
714 if (rc < 0)
715 goto err_cgroup_ops;
716
717 family_registered = 1; 711 family_registered = 1;
718 pr_info("registered taskstats version %d\n", TASKSTATS_GENL_VERSION); 712 pr_info("registered taskstats version %d\n", TASKSTATS_GENL_VERSION);
719 return 0; 713 return 0;
720err_cgroup_ops:
721 genl_unregister_ops(&family, &taskstats_ops);
722err:
723 genl_unregister_family(&family);
724 return rc;
725} 714}
726 715
727/* 716/*