]> git.hungrycats.org Git - linux/commitdiff
[NETLINK]: Un-duplicate rcv wakeup logic.
authorJames Morris <jmorris@intercode.com.au>
Sun, 23 Feb 2003 14:14:23 +0000 (06:14 -0800)
committerJames Morris <jmorris@intercode.com.au>
Sun, 23 Feb 2003 14:14:23 +0000 (06:14 -0800)
net/netlink/af_netlink.c

index 71f8c8fccb3ad0d3065a14b3e9c0a675623d67af..ebb013257f4f1e452d86daa77636fe176bf42b71 100644 (file)
@@ -585,6 +585,16 @@ void netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code)
        read_unlock(&nl_table_lock);
 }
 
+static inline void netlink_rcv_wake(struct sock *sk)
+{
+       struct netlink_opt *nlk = nlk_sk(sk);
+
+       if (skb_queue_len(&sk->receive_queue) == 0)
+               clear_bit(0, &nlk->state);
+       if (!test_bit(0, &nlk->state))
+               wake_up_interruptible(&nlk->wait);
+}
+
 static int netlink_sendmsg(struct kiocb *iocb, struct socket *sock,
                           struct msghdr *msg, int len,
                           struct scm_cookie *scm)
@@ -706,10 +716,7 @@ static int netlink_recvmsg(struct kiocb *iocb, struct socket *sock,
                netlink_dump(sk);
 
 out:
-       if (skb_queue_len(&sk->receive_queue) == 0)
-               clear_bit(0, &nlk->state);
-       if (!test_bit(0, &nlk->state))
-               wake_up_interruptible(&nlk->wait);
+       netlink_rcv_wake(sk);
        return err ? : copied;
 }
 
@@ -719,11 +726,7 @@ void netlink_data_ready(struct sock *sk, int len)
 
        if (nlk->data_ready)
                nlk->data_ready(sk, len);
-
-       if (skb_queue_len(&sk->receive_queue) == 0)
-               clear_bit(0, &nlk->state);
-       if (!test_bit(0, &nlk->state))
-               wake_up_interruptible(&nlk->wait);
+       netlink_rcv_wake(sk);
 }
 
 /*