Merge branch 'master' of /repos/git/net-next-2.6
[safe/jmp/linux-2.6] / net / ieee802154 / netlink.c
index 5b738ec..33137b9 100644 (file)
@@ -75,6 +75,39 @@ out:
        return -ENOBUFS;
 }
 
+struct sk_buff *ieee802154_nl_new_reply(struct genl_info *info,
+               int flags, u8 req)
+{
+       void *hdr;
+       struct sk_buff *msg = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC);
+
+       if (!msg)
+               return NULL;
+
+       hdr = genlmsg_put_reply(msg, info,
+                       &nl802154_family, flags, req);
+       if (!hdr) {
+               nlmsg_free(msg);
+               return NULL;
+       }
+
+       return msg;
+}
+
+int ieee802154_nl_reply(struct sk_buff *msg, struct genl_info *info)
+{
+       /* XXX: nlh is right at the start of msg */
+       void *hdr = genlmsg_data(NLMSG_DATA(msg->data));
+
+       if (genlmsg_end(msg, hdr) < 0)
+               goto out;
+
+       return genlmsg_reply(msg, info);
+out:
+       nlmsg_free(msg);
+       return -ENOBUFS;
+}
+
 int __init ieee802154_nl_init(void)
 {
        int rc;
@@ -87,6 +120,10 @@ int __init ieee802154_nl_init(void)
        if (rc)
                goto fail;
 
+       rc = nl802154_phy_register();
+       if (rc)
+               goto fail;
+
        return 0;
 
 fail: