]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/ppp_generic.c
netdevice ppp: Convert directly reference of netdev->priv
[linux-2.6-omap-h63xx.git] / drivers / net / ppp_generic.c
index 7e857e938adb582ae432b26d35114e8099d51eb2..bad99e8cac33e023a3c0cb02bfde2b2b96dda4b2 100644 (file)
@@ -886,7 +886,7 @@ out_chrdev:
 static int
 ppp_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-       struct ppp *ppp = (struct ppp *) dev->priv;
+       struct ppp *ppp = netdev_priv(dev);
        int npi, proto;
        unsigned char *pp;
 
@@ -931,7 +931,7 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev)
 static int
 ppp_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
-       struct ppp *ppp = dev->priv;
+       struct ppp *ppp = netdev_priv(dev);
        int err = -EFAULT;
        void __user *addr = (void __user *) ifr->ifr_ifru.ifru_data;
        struct ppp_stats stats;
@@ -971,8 +971,13 @@ ppp_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        return err;
 }
 
+static const struct net_device_ops ppp_netdev_ops = {
+       .ndo_do_ioctl = ppp_net_ioctl,
+};
+
 static void ppp_setup(struct net_device *dev)
 {
+       dev->netdev_ops = &ppp_netdev_ops;
        dev->hard_header_len = PPP_HDRLEN;
        dev->mtu = PPP_MTU;
        dev->addr_len = 0;
@@ -1684,7 +1689,6 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
                        skb->protocol = htons(npindex_to_ethertype[npi]);
                        skb_reset_mac_header(skb);
                        netif_rx(skb);
-                       ppp->dev->last_rx = jiffies;
                }
        }
        return;
@@ -2414,13 +2418,12 @@ ppp_create_interface(int unit, int *retp)
        int ret = -ENOMEM;
        int i;
 
-       ppp = kzalloc(sizeof(struct ppp), GFP_KERNEL);
-       if (!ppp)
-               goto out;
-       dev = alloc_netdev(0, "", ppp_setup);
+       dev = alloc_netdev(sizeof(struct ppp), "", ppp_setup);
        if (!dev)
                goto out1;
 
+       ppp = netdev_priv(dev);
+       ppp->dev = dev;
        ppp->mru = PPP_MRU;
        init_ppp_file(&ppp->file, INTERFACE);
        ppp->file.hdrlen = PPP_HDRLEN - 2;      /* don't count proto bytes */
@@ -2433,11 +2436,8 @@ ppp_create_interface(int unit, int *retp)
        ppp->minseq = -1;
        skb_queue_head_init(&ppp->mrq);
 #endif /* CONFIG_PPP_MULTILINK */
-       ppp->dev = dev;
-       dev->priv = ppp;
 
        dev->hard_start_xmit = ppp_start_xmit;
-       dev->do_ioctl = ppp_net_ioctl;
 
        ret = -EEXIST;
        mutex_lock(&all_ppp_mutex);
@@ -2473,8 +2473,6 @@ out2:
        mutex_unlock(&all_ppp_mutex);
        free_netdev(dev);
 out1:
-       kfree(ppp);
-out:
        *retp = ret;
        return NULL;
 }