diff options
author | Wang Chen <wangchen@cn.fujitsu.com> | 2008-11-20 07:24:17 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-20 07:24:17 -0500 |
commit | c8019bf3aff653cceb64f66489fc299ee5957b57 (patch) | |
tree | 2b2bd0d72c2709d5f9bfc05d66ef389c4731b15d | |
parent | f7b29271c35ed38f990ca3419696ca148349c2d3 (diff) |
netdevice ppp: Convert directly reference of netdev->priv
1. Use netdev_priv(dev) to replace dev->priv.
2. Alloc netdev's private data by alloc_netdev().
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ppp_generic.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index c1e57c093e08..bad99e8cac33 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -886,7 +886,7 @@ out_chrdev: | |||
886 | static int | 886 | static int |
887 | ppp_start_xmit(struct sk_buff *skb, struct net_device *dev) | 887 | ppp_start_xmit(struct sk_buff *skb, struct net_device *dev) |
888 | { | 888 | { |
889 | struct ppp *ppp = (struct ppp *) dev->priv; | 889 | struct ppp *ppp = netdev_priv(dev); |
890 | int npi, proto; | 890 | int npi, proto; |
891 | unsigned char *pp; | 891 | unsigned char *pp; |
892 | 892 | ||
@@ -931,7 +931,7 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
931 | static int | 931 | static int |
932 | ppp_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 932 | ppp_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
933 | { | 933 | { |
934 | struct ppp *ppp = dev->priv; | 934 | struct ppp *ppp = netdev_priv(dev); |
935 | int err = -EFAULT; | 935 | int err = -EFAULT; |
936 | void __user *addr = (void __user *) ifr->ifr_ifru.ifru_data; | 936 | void __user *addr = (void __user *) ifr->ifr_ifru.ifru_data; |
937 | struct ppp_stats stats; | 937 | struct ppp_stats stats; |
@@ -2418,13 +2418,12 @@ ppp_create_interface(int unit, int *retp) | |||
2418 | int ret = -ENOMEM; | 2418 | int ret = -ENOMEM; |
2419 | int i; | 2419 | int i; |
2420 | 2420 | ||
2421 | ppp = kzalloc(sizeof(struct ppp), GFP_KERNEL); | 2421 | dev = alloc_netdev(sizeof(struct ppp), "", ppp_setup); |
2422 | if (!ppp) | ||
2423 | goto out; | ||
2424 | dev = alloc_netdev(0, "", ppp_setup); | ||
2425 | if (!dev) | 2422 | if (!dev) |
2426 | goto out1; | 2423 | goto out1; |
2427 | 2424 | ||
2425 | ppp = netdev_priv(dev); | ||
2426 | ppp->dev = dev; | ||
2428 | ppp->mru = PPP_MRU; | 2427 | ppp->mru = PPP_MRU; |
2429 | init_ppp_file(&ppp->file, INTERFACE); | 2428 | init_ppp_file(&ppp->file, INTERFACE); |
2430 | ppp->file.hdrlen = PPP_HDRLEN - 2; /* don't count proto bytes */ | 2429 | ppp->file.hdrlen = PPP_HDRLEN - 2; /* don't count proto bytes */ |
@@ -2437,8 +2436,6 @@ ppp_create_interface(int unit, int *retp) | |||
2437 | ppp->minseq = -1; | 2436 | ppp->minseq = -1; |
2438 | skb_queue_head_init(&ppp->mrq); | 2437 | skb_queue_head_init(&ppp->mrq); |
2439 | #endif /* CONFIG_PPP_MULTILINK */ | 2438 | #endif /* CONFIG_PPP_MULTILINK */ |
2440 | ppp->dev = dev; | ||
2441 | dev->priv = ppp; | ||
2442 | 2439 | ||
2443 | dev->hard_start_xmit = ppp_start_xmit; | 2440 | dev->hard_start_xmit = ppp_start_xmit; |
2444 | 2441 | ||
@@ -2476,8 +2473,6 @@ out2: | |||
2476 | mutex_unlock(&all_ppp_mutex); | 2473 | mutex_unlock(&all_ppp_mutex); |
2477 | free_netdev(dev); | 2474 | free_netdev(dev); |
2478 | out1: | 2475 | out1: |
2479 | kfree(ppp); | ||
2480 | out: | ||
2481 | *retp = ret; | 2476 | *retp = ret; |
2482 | return NULL; | 2477 | return NULL; |
2483 | } | 2478 | } |