aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wan/hdlc_fr.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index cb1b415053eb..109bab34094d 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -135,10 +135,6 @@ typedef struct pvc_device_struct {
135 }state; 135 }state;
136}pvc_device; 136}pvc_device;
137 137
138struct pvc_desc {
139 pvc_device *pvc;
140};
141
142struct frad_state { 138struct frad_state {
143 fr_proto settings; 139 fr_proto settings;
144 pvc_device *first_pvc; 140 pvc_device *first_pvc;
@@ -178,10 +174,6 @@ static inline struct frad_state* state(hdlc_device *hdlc)
178 return(struct frad_state *)(hdlc->state); 174 return(struct frad_state *)(hdlc->state);
179} 175}
180 176
181static inline struct pvc_desc* pvcdev_to_desc(struct net_device *dev)
182{
183 return dev->priv;
184}
185 177
186static inline pvc_device* find_pvc(hdlc_device *hdlc, u16 dlci) 178static inline pvc_device* find_pvc(hdlc_device *hdlc, u16 dlci)
187{ 179{
@@ -351,7 +343,7 @@ static int fr_hard_header(struct sk_buff **skb_p, u16 dlci)
351 343
352static int pvc_open(struct net_device *dev) 344static int pvc_open(struct net_device *dev)
353{ 345{
354 pvc_device *pvc = pvcdev_to_desc(dev)->pvc; 346 pvc_device *pvc = dev->priv;
355 347
356 if ((pvc->frad->flags & IFF_UP) == 0) 348 if ((pvc->frad->flags & IFF_UP) == 0)
357 return -EIO; /* Frad must be UP in order to activate PVC */ 349 return -EIO; /* Frad must be UP in order to activate PVC */
@@ -371,7 +363,7 @@ static int pvc_open(struct net_device *dev)
371 363
372static int pvc_close(struct net_device *dev) 364static int pvc_close(struct net_device *dev)
373{ 365{
374 pvc_device *pvc = pvcdev_to_desc(dev)->pvc; 366 pvc_device *pvc = dev->priv;
375 367
376 if (--pvc->open_count == 0) { 368 if (--pvc->open_count == 0) {
377 hdlc_device *hdlc = dev_to_hdlc(pvc->frad); 369 hdlc_device *hdlc = dev_to_hdlc(pvc->frad);
@@ -390,7 +382,7 @@ static int pvc_close(struct net_device *dev)
390 382
391static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 383static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
392{ 384{
393 pvc_device *pvc = pvcdev_to_desc(dev)->pvc; 385 pvc_device *pvc = dev->priv;
394 fr_proto_pvc_info info; 386 fr_proto_pvc_info info;
395 387
396 if (ifr->ifr_settings.type == IF_GET_PROTO) { 388 if (ifr->ifr_settings.type == IF_GET_PROTO) {
@@ -418,7 +410,7 @@ static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
418 410
419static int pvc_xmit(struct sk_buff *skb, struct net_device *dev) 411static int pvc_xmit(struct sk_buff *skb, struct net_device *dev)
420{ 412{
421 pvc_device *pvc = pvcdev_to_desc(dev)->pvc; 413 pvc_device *pvc = dev->priv;
422 414
423 if (pvc->state.active) { 415 if (pvc->state.active) {
424 if (dev->type == ARPHRD_ETHER) { 416 if (dev->type == ARPHRD_ETHER) {
@@ -1079,7 +1071,7 @@ static void pvc_setup(struct net_device *dev)
1079static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) 1071static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
1080{ 1072{
1081 hdlc_device *hdlc = dev_to_hdlc(frad); 1073 hdlc_device *hdlc = dev_to_hdlc(frad);
1082 pvc_device *pvc = NULL; 1074 pvc_device *pvc;
1083 struct net_device *dev; 1075 struct net_device *dev;
1084 int result, used; 1076 int result, used;
1085 1077
@@ -1095,10 +1087,9 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
1095 used = pvc_is_used(pvc); 1087 used = pvc_is_used(pvc);
1096 1088
1097 if (type == ARPHRD_ETHER) 1089 if (type == ARPHRD_ETHER)
1098 dev = alloc_netdev(sizeof(struct pvc_desc), "pvceth%d", 1090 dev = alloc_netdev(0, "pvceth%d", ether_setup);
1099 ether_setup);
1100 else 1091 else
1101 dev = alloc_netdev(sizeof(struct pvc_desc), "pvc%d", pvc_setup); 1092 dev = alloc_netdev(0, "pvc%d", pvc_setup);
1102 1093
1103 if (!dev) { 1094 if (!dev) {
1104 printk(KERN_WARNING "%s: Memory squeeze on fr_pvc()\n", 1095 printk(KERN_WARNING "%s: Memory squeeze on fr_pvc()\n",
@@ -1120,7 +1111,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
1120 dev->change_mtu = pvc_change_mtu; 1111 dev->change_mtu = pvc_change_mtu;
1121 dev->mtu = HDLC_MAX_MTU; 1112 dev->mtu = HDLC_MAX_MTU;
1122 dev->tx_queue_len = 0; 1113 dev->tx_queue_len = 0;
1123 pvcdev_to_desc(dev)->pvc = pvc; 1114 dev->priv = pvc;
1124 1115
1125 result = dev_alloc_name(dev, dev->name); 1116 result = dev_alloc_name(dev, dev->name);
1126 if (result < 0) { 1117 if (result < 0) {