Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[safe/jmp/linux-2.6] / drivers / net / pppoe.c
index fb30563..5f20902 100644 (file)
@@ -97,7 +97,7 @@ static const struct proto_ops pppoe_ops;
 static struct ppp_channel_ops pppoe_chan_ops;
 
 /* per-net private data for this module */
-static unsigned int pppoe_net_id;
+static int pppoe_net_id;
 struct pppoe_net {
        /*
         * we could use _single_ hash table for all
@@ -513,17 +513,17 @@ out:
        return NET_RX_SUCCESS; /* Lies... :-) */
 }
 
-static struct packet_type pppoes_ptype = {
-       .type   = __constant_htons(ETH_P_PPP_SES),
+static struct packet_type pppoes_ptype __read_mostly = {
+       .type   = cpu_to_be16(ETH_P_PPP_SES),
        .func   = pppoe_rcv,
 };
 
-static struct packet_type pppoed_ptype = {
-       .type   = __constant_htons(ETH_P_PPP_DISC),
+static struct packet_type pppoed_ptype __read_mostly = {
+       .type   = cpu_to_be16(ETH_P_PPP_DISC),
        .func   = pppoe_disc_rcv,
 };
 
-static struct proto pppoe_sk_proto = {
+static struct proto pppoe_sk_proto __read_mostly = {
        .name     = "PPPOE",
        .owner    = THIS_MODULE,
        .obj_size = sizeof(struct pppox_sock),
@@ -695,7 +695,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
                po->chan.private = sk;
                po->chan.ops = &pppoe_chan_ops;
 
-               error = ppp_register_channel(&po->chan);
+               error = ppp_register_net_channel(dev_net(dev), &po->chan);
                if (error)
                        goto err_put;
 
@@ -877,7 +877,7 @@ static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock,
        skb->dev = dev;
 
        skb->priority = sk->sk_priority;
-       skb->protocol = __constant_htons(ETH_P_PPP_SES);
+       skb->protocol = cpu_to_be16(ETH_P_PPP_SES);
 
        ph = (struct pppoe_hdr *)skb_put(skb, total_len + sizeof(struct pppoe_hdr));
        start = (char *)&ph->tag[0];
@@ -937,7 +937,7 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
        ph->sid = po->num;
        ph->length = htons(data_len);
 
-       skb->protocol = __constant_htons(ETH_P_PPP_SES);
+       skb->protocol = cpu_to_be16(ETH_P_PPP_SES);
        skb->dev = dev;
 
        dev_hard_header(skb, dev, ETH_P_PPP_SES,
@@ -1004,7 +1004,6 @@ static int pppoe_seq_show(struct seq_file *seq, void *v)
 {
        struct pppox_sock *po;
        char *dev_name;
-       DECLARE_MAC_BUF(mac);
 
        if (v == SEQ_START_TOKEN) {
                seq_puts(seq, "Id       Address              Device\n");
@@ -1041,7 +1040,7 @@ out:
 static void *pppoe_seq_start(struct seq_file *seq, loff_t *pos)
        __acquires(pn->hash_lock)
 {
-       struct pppoe_net *pn = pppoe_pernet(seq->private);
+       struct pppoe_net *pn = pppoe_pernet(seq_file_net(seq));
        loff_t l = *pos;
 
        read_lock_bh(&pn->hash_lock);
@@ -1050,7 +1049,7 @@ static void *pppoe_seq_start(struct seq_file *seq, loff_t *pos)
 
 static void *pppoe_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 {
-       struct pppoe_net *pn = pppoe_pernet(seq->private);
+       struct pppoe_net *pn = pppoe_pernet(seq_file_net(seq));
        struct pppox_sock *po;
 
        ++*pos;
@@ -1064,6 +1063,7 @@ static void *pppoe_seq_next(struct seq_file *seq, void *v, loff_t *pos)
        else {
                int hash = hash_item(po->pppoe_pa.sid, po->pppoe_pa.remote);
 
+               po = NULL;
                while (++hash < PPPOE_HASH_SIZE) {
                        po = pn->hash_table[hash];
                        if (po)
@@ -1078,7 +1078,7 @@ out:
 static void pppoe_seq_stop(struct seq_file *seq, void *v)
        __releases(pn->hash_lock)
 {
-       struct pppoe_net *pn = pppoe_pernet(seq->private);
+       struct pppoe_net *pn = pppoe_pernet(seq_file_net(seq));
        read_unlock_bh(&pn->hash_lock);
 }
 
@@ -1091,30 +1091,8 @@ static const struct seq_operations pppoe_seq_ops = {
 
 static int pppoe_seq_open(struct inode *inode, struct file *file)
 {
-       struct seq_file *m;
-       struct net *net;
-       int err;
-
-       err = seq_open(file, &pppoe_seq_ops);
-       if (err)
-               return err;
-
-       m = file->private_data;
-       net = maybe_get_net(PDE_NET(PDE(inode)));
-       BUG_ON(!net);
-       m->private = net;
-
-       return err;
-}
-
-static int pppoe_seq_release(struct inode *inode, struct file *file)
-{
-       struct seq_file *m;
-
-       m = file->private_data;
-       put_net((struct net*)m->private);
-
-       return seq_release(inode, file);
+       return seq_open_net(inode, file, &pppoe_seq_ops,
+                       sizeof(struct seq_net_private));
 }
 
 static const struct file_operations pppoe_seq_fops = {
@@ -1122,7 +1100,7 @@ static const struct file_operations pppoe_seq_fops = {
        .open           = pppoe_seq_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
-       .release        = pppoe_seq_release,
+       .release        = seq_release_net,
 };
 
 #endif /* CONFIG_PROC_FS */
@@ -1198,7 +1176,7 @@ static __net_exit void pppoe_exit_net(struct net *net)
        kfree(pn);
 }
 
-static __net_initdata struct pernet_operations pppoe_net_ops = {
+static struct pernet_operations pppoe_net_ops = {
        .init = pppoe_init_net,
        .exit = pppoe_exit_net,
 };