net: mark net_proto_ops as const
[safe/jmp/linux-2.6] / net / econet / af_econet.c
index 8789d2b..6529be3 100644 (file)
@@ -520,6 +520,7 @@ static int econet_getname(struct socket *sock, struct sockaddr *uaddr,
        if (peer)
                return -EOPNOTSUPP;
 
+       memset(sec, 0, sizeof(*sec));
        mutex_lock(&econet_mutex);
 
        sk = sock->sk;
@@ -540,8 +541,7 @@ static void econet_destroy_timer(unsigned long data)
 {
        struct sock *sk=(struct sock *)data;
 
-       if (!atomic_read(&sk->sk_wmem_alloc) &&
-           !atomic_read(&sk->sk_rmem_alloc)) {
+       if (!sk_has_allocations(sk)) {
                sk_free(sk);
                return;
        }
@@ -579,8 +579,7 @@ static int econet_release(struct socket *sock)
 
        skb_queue_purge(&sk->sk_receive_queue);
 
-       if (atomic_read(&sk->sk_rmem_alloc) ||
-           atomic_read(&sk->sk_wmem_alloc)) {
+       if (sk_has_allocations(sk)) {
                sk->sk_timer.data     = (unsigned long)sk;
                sk->sk_timer.expires  = jiffies + HZ;
                sk->sk_timer.function = econet_destroy_timer;
@@ -743,7 +742,7 @@ static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg
        return 0;
 }
 
-static struct net_proto_family econet_family_ops = {
+static const struct net_proto_family econet_family_ops = {
        .family =       PF_ECONET,
        .create =       econet_create,
        .owner  =       THIS_MODULE,
@@ -901,15 +900,10 @@ static void aun_tx_ack(unsigned long seq, int result)
        struct ec_cb *eb;
 
        spin_lock_irqsave(&aun_queue_lock, flags);
-       skb = skb_peek(&aun_queue);
-       while (skb && skb != (struct sk_buff *)&aun_queue)
-       {
-               struct sk_buff *newskb = skb->next;
+       skb_queue_walk(&aun_queue, skb) {
                eb = (struct ec_cb *)&skb->cb;
                if (eb->seq == seq)
                        goto foundit;
-
-               skb = newskb;
        }
        spin_unlock_irqrestore(&aun_queue_lock, flags);
        printk(KERN_DEBUG "AUN: unknown sequence %ld\n", seq);
@@ -982,23 +976,18 @@ static void aun_data_available(struct sock *sk, int slen)
 
 static void ab_cleanup(unsigned long h)
 {
-       struct sk_buff *skb;
+       struct sk_buff *skb, *n;
        unsigned long flags;
 
        spin_lock_irqsave(&aun_queue_lock, flags);
-       skb = skb_peek(&aun_queue);
-       while (skb && skb != (struct sk_buff *)&aun_queue)
-       {
-               struct sk_buff *newskb = skb->next;
+       skb_queue_walk_safe(&aun_queue, skb, n) {
                struct ec_cb *eb = (struct ec_cb *)&skb->cb;
-               if ((jiffies - eb->start) > eb->timeout)
-               {
+               if ((jiffies - eb->start) > eb->timeout) {
                        tx_result(skb->sk, eb->cookie,
                                  ECTYPE_TRANSMIT_NOT_PRESENT);
                        skb_unlink(skb, &aun_queue);
                        kfree_skb(skb);
                }
-               skb = newskb;
        }
        spin_unlock_irqrestore(&aun_queue_lock, flags);
 
@@ -1084,7 +1073,7 @@ static int econet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet
                skb->protocol = htons(ETH_P_IP);
                skb_pull(skb, sizeof(struct ec_framehdr));
                netif_rx(skb);
-               return 0;
+               return NET_RX_SUCCESS;
        }
 
        sk = ec_listening_socket(hdr->port, hdr->src_stn, hdr->src_net);
@@ -1095,15 +1084,15 @@ static int econet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet
                            hdr->port))
                goto drop;
 
-       return 0;
+       return NET_RX_SUCCESS;
 
 drop:
        kfree_skb(skb);
        return NET_RX_DROP;
 }
 
-static struct packet_type econet_packet_type = {
-       .type =         __constant_htons(ETH_P_ECONET),
+static struct packet_type econet_packet_type __read_mostly = {
+       .type =         cpu_to_be16(ETH_P_ECONET),
        .func =         econet_rcv,
 };