aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee802154/netlink.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-11-14 17:14:41 +0100
committerDavid S. Miller <davem@davemloft.net>2013-11-14 17:10:40 -0500
commit1c582d915da13ca21ad375ae04ec1bd6193418b2 (patch)
treecff9bbc495ad1fdf99999cf5643b2b4f51327511 /net/ieee802154/netlink.c
parenthsr: use genl_register_family_with_ops() (diff)
downloadlinux-dev-1c582d915da13ca21ad375ae04ec1bd6193418b2.tar.xz
linux-dev-1c582d915da13ca21ad375ae04ec1bd6193418b2.zip
ieee802154: 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. While at it, also fix the registration error path - if the family registration failed then it shouldn't be unregistered. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ieee802154/netlink.c')
-rw-r--r--net/ieee802154/netlink.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/net/ieee802154/netlink.c b/net/ieee802154/netlink.c
index 7e49bbcc6967..eb9faef6782a 100644
--- a/net/ieee802154/netlink.c
+++ b/net/ieee802154/netlink.c
@@ -109,24 +109,39 @@ out:
return -ENOBUFS;
}
+static struct genl_ops ieee8021154_ops[] = {
+ /* see nl-phy.c */
+ IEEE802154_DUMP(IEEE802154_LIST_PHY, ieee802154_list_phy,
+ ieee802154_dump_phy),
+ IEEE802154_OP(IEEE802154_ADD_IFACE, ieee802154_add_iface),
+ IEEE802154_OP(IEEE802154_DEL_IFACE, ieee802154_del_iface),
+ /* see nl-mac.c */
+ IEEE802154_OP(IEEE802154_ASSOCIATE_REQ, ieee802154_associate_req),
+ IEEE802154_OP(IEEE802154_ASSOCIATE_RESP, ieee802154_associate_resp),
+ IEEE802154_OP(IEEE802154_DISASSOCIATE_REQ, ieee802154_disassociate_req),
+ IEEE802154_OP(IEEE802154_SCAN_REQ, ieee802154_scan_req),
+ IEEE802154_OP(IEEE802154_START_REQ, ieee802154_start_req),
+ IEEE802154_DUMP(IEEE802154_LIST_IFACE, ieee802154_list_iface,
+ ieee802154_dump_iface),
+};
+
int __init ieee802154_nl_init(void)
{
int rc;
- rc = genl_register_family(&nl802154_family);
+ rc = genl_register_family_with_ops(&nl802154_family, ieee8021154_ops,
+ ARRAY_SIZE(ieee8021154_ops));
if (rc)
- goto fail;
+ return rc;
- rc = nl802154_mac_register();
+ rc = genl_register_mc_group(&nl802154_family, &ieee802154_coord_mcgrp);
if (rc)
goto fail;
- rc = nl802154_phy_register();
+ rc = genl_register_mc_group(&nl802154_family, &ieee802154_beacon_mcgrp);
if (rc)
goto fail;
-
return 0;
-
fail:
genl_unregister_family(&nl802154_family);
return rc;
@@ -136,4 +151,3 @@ void __exit ieee802154_nl_exit(void)
{
genl_unregister_family(&nl802154_family);
}
-