[ATM] br2684: Use seq_list_xxx helpers
[firefly-linux-kernel-4.4.55.git] / net / atm / br2684.c
index f949b5c74ec19217e548ad2c762e7655acb19f65..3e2643893178d6baae15301d4d71eb39825a84a5 100644 (file)
@@ -173,7 +173,7 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
        }
        skb_push(skb, minheadroom);
        if (brvcc->encaps == e_llc)
-               memcpy(skb->data, llc_oui_pid_pad, 10);
+               skb_copy_to_linear_data(skb, llc_oui_pid_pad, 10);
        else
                memset(skb->data, 0, 2);
 #endif /* FASTER_VERSION */
@@ -375,11 +375,11 @@ packet_fails_filter(__be16 type, struct br2684_vcc *brvcc, struct sk_buff *skb)
 {
        if (brvcc->filter.netmask == 0)
                return 0;                       /* no filter in place */
-       if (type == __constant_htons(ETH_P_IP) &&
+       if (type == htons(ETH_P_IP) &&
            (((struct iphdr *) (skb->data))->daddr & brvcc->filter.
             netmask) == brvcc->filter.prefix)
                return 0;
-       if (type == __constant_htons(ETH_P_ARP))
+       if (type == htons(ETH_P_ARP))
                return 0;
        /* TODO: we should probably filter ARPs too.. don't want to have
         *   them returning values that don't make sense, or is that ok?
@@ -458,7 +458,7 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
        /* FIXME: tcpdump shows that pointer to mac header is 2 bytes earlier,
           than should be. What else should I set? */
        skb_pull(skb, plen);
-       skb->mac.raw = ((char *) (skb->data)) - ETH_HLEN;
+       skb_set_mac_header(skb, -ETH_HLEN);
        skb->pkt_type = PACKET_HOST;
 #ifdef CONFIG_BR2684_FAST_TRANS
        skb->protocol = ((u16 *) skb->data)[-1];
@@ -699,28 +699,13 @@ static struct atm_ioctl br2684_ioctl_ops = {
 #ifdef CONFIG_PROC_FS
 static void *br2684_seq_start(struct seq_file *seq, loff_t *pos)
 {
-       loff_t offs = 0;
-       struct br2684_dev *brd;
-
        read_lock(&devs_lock);
-
-       list_for_each_entry(brd, &br2684_devs, br2684_devs) {
-               if (offs == *pos)
-                       return brd;
-               ++offs;
-       }
-       return NULL;
+       return seq_list_start(&br2684_devs, *pos);
 }
 
 static void *br2684_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 {
-       struct br2684_dev *brd = v;
-
-       ++*pos;
-
-       brd = list_entry(brd->br2684_devs.next,
-                        struct br2684_dev, br2684_devs);
-       return (&brd->br2684_devs != &br2684_devs) ? brd : NULL;
+       return seq_list_next(v, &br2684_devs, pos);
 }
 
 static void br2684_seq_stop(struct seq_file *seq, void *v)
@@ -730,7 +715,8 @@ static void br2684_seq_stop(struct seq_file *seq, void *v)
 
 static int br2684_seq_show(struct seq_file *seq, void *v)
 {
-       const struct br2684_dev *brdev = v;
+       const struct br2684_dev *brdev = list_entry(v, struct br2684_dev,
+                       br2684_devs);
        const struct net_device *net_dev = brdev->net_dev;
        const struct br2684_vcc *brvcc;
 
@@ -784,7 +770,7 @@ static int br2684_proc_open(struct inode *inode, struct file *file)
        return seq_open(file, &br2684_seq_ops);
 }
 
-static struct file_operations br2684_proc_ops = {
+static const struct file_operations br2684_proc_ops = {
        .owner   = THIS_MODULE,
        .open    = br2684_proc_open,
        .read    = seq_read,