Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
[cascardo/linux.git] / drivers / scsi / scsi_netlink.c
index 1b59b27..40579ed 100644 (file)
@@ -50,7 +50,7 @@ scsi_nl_rcv_msg(struct sk_buff *skb)
        while (skb->len >= NLMSG_SPACE(0)) {
                err = 0;
 
-               nlh = (struct nlmsghdr *) skb->data;
+               nlh = nlmsg_hdr(skb);
                if ((nlh->nlmsg_len < (sizeof(*nlh) + sizeof(*hdr))) ||
                    (skb->len < nlh->nlmsg_len)) {
                        printk(KERN_WARNING "%s: discarding partial skb\n",
@@ -64,7 +64,7 @@ scsi_nl_rcv_msg(struct sk_buff *skb)
 
                if (nlh->nlmsg_type != SCSI_TRANSPORT_MSG) {
                        err = -EBADMSG;
-                       goto next_msg;
+                       return;
                }
 
                hdr = NLMSG_DATA(nlh);
@@ -98,27 +98,6 @@ next_msg:
 }
 
 
-/**
- * scsi_nl_rcv_msg -
- *    Receive handler for a socket. Extracts a received message buffer from
- *    the socket, and starts message processing.
- *
- * @sk:                socket
- * @len:       unused
- *
- **/
-static void
-scsi_nl_rcv(struct sock *sk, int len)
-{
-       struct sk_buff *skb;
-
-       while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
-               scsi_nl_rcv_msg(skb);
-               kfree_skb(skb);
-       }
-}
-
-
 /**
  * scsi_nl_rcv_event -
  *    Event handler for a netlink socket.
@@ -167,8 +146,9 @@ scsi_netlink_init(void)
                return;
        }
 
-       scsi_nl_sock = netlink_kernel_create(NETLINK_SCSITRANSPORT,
-                               SCSI_NL_GRP_CNT, scsi_nl_rcv, THIS_MODULE);
+       scsi_nl_sock = netlink_kernel_create(&init_net, NETLINK_SCSITRANSPORT,
+                               SCSI_NL_GRP_CNT, scsi_nl_rcv_msg, NULL,
+                               THIS_MODULE);
        if (!scsi_nl_sock) {
                printk(KERN_ERR "%s: register of recieve handler failed\n",
                                __FUNCTION__);