]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/connector/connector.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[linux-2.6-omap-h63xx.git] / drivers / connector / connector.c
index a905f782033196259dcdb46b5931701d0a642bad..bf9716b75513d957a79e8836d8a127295d86f4d4 100644 (file)
@@ -145,6 +145,8 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v
                                if (queue_work(dev->cbdev->cn_queue,
                                                        &__cbq->work))
                                        err = 0;
+                               else
+                                       err = -EINVAL;
                        } else {
                                struct cn_callback_data *d;
                                
@@ -212,13 +214,13 @@ static void cn_rx_skb(struct sk_buff *__skb)
        skb = skb_get(__skb);
 
        if (skb->len >= NLMSG_SPACE(0)) {
-               nlh = (struct nlmsghdr *)skb->data;
+               nlh = nlmsg_hdr(skb);
 
                if (nlh->nlmsg_len < sizeof(struct cn_msg) ||
                    skb->len < nlh->nlmsg_len ||
                    nlh->nlmsg_len > CONNECTOR_MAX_MSG_SIZE) {
                        kfree_skb(skb);
-                       goto out;
+                       return;
                }
 
                len = NLMSG_ALIGN(nlh->nlmsg_len);
@@ -229,21 +231,6 @@ static void cn_rx_skb(struct sk_buff *__skb)
                if (err < 0)
                        kfree_skb(skb);
        }
-
-out:
-       kfree_skb(__skb);
-}
-
-/*
- * Netlink socket input callback - dequeues the skbs and calls the
- * main netlink receiving function.
- */
-static void cn_input(struct sock *sk, int len)
-{
-       struct sk_buff *skb;
-
-       while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL)
-               cn_rx_skb(skb);
 }
 
 /*
@@ -442,13 +429,13 @@ static int __devinit cn_init(void)
        struct cn_dev *dev = &cdev;
        int err;
 
-       dev->input = cn_input;
+       dev->input = cn_rx_skb;
        dev->id.idx = cn_idx;
        dev->id.val = cn_val;
 
-       dev->nls = netlink_kernel_create(NETLINK_CONNECTOR,
+       dev->nls = netlink_kernel_create(&init_net, NETLINK_CONNECTOR,
                                         CN_NETLINK_USERS + 0xf,
-                                        dev->input, THIS_MODULE);
+                                        dev->input, NULL, THIS_MODULE);
        if (!dev->nls)
                return -EIO;