aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKrzysztof Halasa <khc@pm.waw.pl>2008-02-01 16:37:12 -0500
committerJeff Garzik <jeff@garzik.org>2008-02-05 13:31:39 -0500
commit40d25142f2ef27084fc317ac8bb5bae460c8ea72 (patch)
tree400145d4607b8db1151c7379cb60fdc050210dc9 /drivers
parent983e23041b28abb113862b2935a85cfb9aab4f5a (diff)
Generic HDLC - remove now unneeded hdlc_device_desc
Removes now unneeded struct hdlc_device_desc Signed-off-by: Krzysztof Halasa <khc@pm.waw.pl> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wan/hdlc.c24
-rw-r--r--drivers/net/wan/hdlc_cisco.c5
-rw-r--r--drivers/net/wan/hdlc_fr.c7
-rw-r--r--drivers/net/wan/hdlc_ppp.c2
-rw-r--r--drivers/net/wan/hdlc_raw.c2
-rw-r--r--drivers/net/wan/hdlc_raw_eth.c2
-rw-r--r--drivers/net/wan/hdlc_x25.c10
7 files changed, 24 insertions, 28 deletions
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c
index d553e6f32851..39951d0c34d6 100644
--- a/drivers/net/wan/hdlc.c
+++ b/drivers/net/wan/hdlc.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Generic HDLC support routines for Linux 2 * Generic HDLC support routines for Linux
3 * 3 *
4 * Copyright (C) 1999 - 2006 Krzysztof Halasa <khc@pm.waw.pl> 4 * Copyright (C) 1999 - 2008 Krzysztof Halasa <khc@pm.waw.pl>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2 of the GNU General Public License 7 * under the terms of version 2 of the GNU General Public License
@@ -39,7 +39,7 @@
39#include <net/net_namespace.h> 39#include <net/net_namespace.h>
40 40
41 41
42static const char* version = "HDLC support module revision 1.21"; 42static const char* version = "HDLC support module revision 1.22";
43 43
44#undef DEBUG_LINK 44#undef DEBUG_LINK
45 45
@@ -66,19 +66,15 @@ static struct net_device_stats *hdlc_get_stats(struct net_device *dev)
66static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev, 66static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
67 struct packet_type *p, struct net_device *orig_dev) 67 struct packet_type *p, struct net_device *orig_dev)
68{ 68{
69 struct hdlc_device_desc *desc = dev_to_desc(dev); 69 struct hdlc_device *hdlc = dev_to_hdlc(dev);
70 70
71 if (dev->nd_net != &init_net) { 71 if (dev->nd_net != &init_net) {
72 kfree_skb(skb); 72 kfree_skb(skb);
73 return 0; 73 return 0;
74 } 74 }
75 75
76 if (desc->netif_rx) 76 BUG_ON(!hdlc->proto->netif_rx);
77 return desc->netif_rx(skb); 77 return hdlc->proto->netif_rx(skb);
78
79 desc->stats.rx_dropped++; /* Shouldn't happen */
80 dev_kfree_skb(skb);
81 return NET_RX_DROP;
82} 78}
83 79
84 80
@@ -87,7 +83,7 @@ static inline void hdlc_proto_start(struct net_device *dev)
87{ 83{
88 hdlc_device *hdlc = dev_to_hdlc(dev); 84 hdlc_device *hdlc = dev_to_hdlc(dev);
89 if (hdlc->proto->start) 85 if (hdlc->proto->start)
90 return hdlc->proto->start(dev); 86 hdlc->proto->start(dev);
91} 87}
92 88
93 89
@@ -96,7 +92,7 @@ static inline void hdlc_proto_stop(struct net_device *dev)
96{ 92{
97 hdlc_device *hdlc = dev_to_hdlc(dev); 93 hdlc_device *hdlc = dev_to_hdlc(dev);
98 if (hdlc->proto->stop) 94 if (hdlc->proto->stop)
99 return hdlc->proto->stop(dev); 95 hdlc->proto->stop(dev);
100} 96}
101 97
102 98
@@ -263,8 +259,7 @@ static void hdlc_setup(struct net_device *dev)
263struct net_device *alloc_hdlcdev(void *priv) 259struct net_device *alloc_hdlcdev(void *priv)
264{ 260{
265 struct net_device *dev; 261 struct net_device *dev;
266 dev = alloc_netdev(sizeof(struct hdlc_device_desc) + 262 dev = alloc_netdev(sizeof(struct hdlc_device), "hdlc%d", hdlc_setup);
267 sizeof(hdlc_device), "hdlc%d", hdlc_setup);
268 if (dev) 263 if (dev)
269 dev_to_hdlc(dev)->priv = priv; 264 dev_to_hdlc(dev)->priv = priv;
270 return dev; 265 return dev;
@@ -281,7 +276,7 @@ void unregister_hdlc_device(struct net_device *dev)
281 276
282 277
283int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto, 278int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
284 int (*rx)(struct sk_buff *skb), size_t size) 279 size_t size)
285{ 280{
286 detach_hdlc_protocol(dev); 281 detach_hdlc_protocol(dev);
287 282
@@ -297,7 +292,6 @@ int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
297 return -ENOBUFS; 292 return -ENOBUFS;
298 } 293 }
299 dev_to_hdlc(dev)->proto = proto; 294 dev_to_hdlc(dev)->proto = proto;
300 dev_to_desc(dev)->netif_rx = rx;
301 return 0; 295 return 0;
302} 296}
303 297
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
index 038a6e748bbf..7133c688cf20 100644
--- a/drivers/net/wan/hdlc_cisco.c
+++ b/drivers/net/wan/hdlc_cisco.c
@@ -250,7 +250,7 @@ static int cisco_rx(struct sk_buff *skb)
250 return NET_RX_DROP; 250 return NET_RX_DROP;
251 251
252 rx_error: 252 rx_error:
253 dev_to_desc(dev)->stats.rx_errors++; /* Mark error */ 253 dev_to_hdlc(dev)->stats.rx_errors++; /* Mark error */
254 dev_kfree_skb_any(skb); 254 dev_kfree_skb_any(skb);
255 return NET_RX_DROP; 255 return NET_RX_DROP;
256} 256}
@@ -314,6 +314,7 @@ static struct hdlc_proto proto = {
314 .stop = cisco_stop, 314 .stop = cisco_stop,
315 .type_trans = cisco_type_trans, 315 .type_trans = cisco_type_trans,
316 .ioctl = cisco_ioctl, 316 .ioctl = cisco_ioctl,
317 .netif_rx = cisco_rx,
317 .module = THIS_MODULE, 318 .module = THIS_MODULE,
318}; 319};
319 320
@@ -360,7 +361,7 @@ static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr)
360 if (result) 361 if (result)
361 return result; 362 return result;
362 363
363 result = attach_hdlc_protocol(dev, &proto, cisco_rx, 364 result = attach_hdlc_protocol(dev, &proto,
364 sizeof(struct cisco_state)); 365 sizeof(struct cisco_state));
365 if (result) 366 if (result)
366 return result; 367 return result;
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index 51296c2b8b89..2bd609c27068 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -956,7 +956,7 @@ static int fr_rx(struct sk_buff *skb)
956 956
957 957
958 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { 958 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
959 dev_to_desc(frad)->stats.rx_dropped++; 959 dev_to_hdlc(frad)->stats.rx_dropped++;
960 return NET_RX_DROP; 960 return NET_RX_DROP;
961 } 961 }
962 962
@@ -1017,7 +1017,7 @@ static int fr_rx(struct sk_buff *skb)
1017 } 1017 }
1018 1018
1019 rx_error: 1019 rx_error:
1020 dev_to_desc(frad)->stats.rx_errors++; /* Mark error */ 1020 dev_to_hdlc(frad)->stats.rx_errors++; /* Mark error */
1021 dev_kfree_skb_any(skb); 1021 dev_kfree_skb_any(skb);
1022 return NET_RX_DROP; 1022 return NET_RX_DROP;
1023} 1023}
@@ -1217,6 +1217,7 @@ static struct hdlc_proto proto = {
1217 .stop = fr_stop, 1217 .stop = fr_stop,
1218 .detach = fr_destroy, 1218 .detach = fr_destroy,
1219 .ioctl = fr_ioctl, 1219 .ioctl = fr_ioctl,
1220 .netif_rx = fr_rx,
1220 .module = THIS_MODULE, 1221 .module = THIS_MODULE,
1221}; 1222};
1222 1223
@@ -1275,7 +1276,7 @@ static int fr_ioctl(struct net_device *dev, struct ifreq *ifr)
1275 return result; 1276 return result;
1276 1277
1277 if (dev_to_hdlc(dev)->proto != &proto) { /* Different proto */ 1278 if (dev_to_hdlc(dev)->proto != &proto) { /* Different proto */
1278 result = attach_hdlc_protocol(dev, &proto, fr_rx, 1279 result = attach_hdlc_protocol(dev, &proto,
1279 sizeof(struct frad_state)); 1280 sizeof(struct frad_state));
1280 if (result) 1281 if (result)
1281 return result; 1282 return result;
diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c
index 519e1550e2e7..10396d9686f4 100644
--- a/drivers/net/wan/hdlc_ppp.c
+++ b/drivers/net/wan/hdlc_ppp.c
@@ -122,7 +122,7 @@ static int ppp_ioctl(struct net_device *dev, struct ifreq *ifr)
122 if (result) 122 if (result)
123 return result; 123 return result;
124 124
125 result = attach_hdlc_protocol(dev, &proto, NULL, 125 result = attach_hdlc_protocol(dev, &proto,
126 sizeof(struct ppp_state)); 126 sizeof(struct ppp_state));
127 if (result) 127 if (result)
128 return result; 128 return result;
diff --git a/drivers/net/wan/hdlc_raw.c b/drivers/net/wan/hdlc_raw.c
index e23bc6656267..bbbb819d764c 100644
--- a/drivers/net/wan/hdlc_raw.c
+++ b/drivers/net/wan/hdlc_raw.c
@@ -82,7 +82,7 @@ static int raw_ioctl(struct net_device *dev, struct ifreq *ifr)
82 if (result) 82 if (result)
83 return result; 83 return result;
84 84
85 result = attach_hdlc_protocol(dev, &proto, NULL, 85 result = attach_hdlc_protocol(dev, &proto,
86 sizeof(raw_hdlc_proto)); 86 sizeof(raw_hdlc_proto));
87 if (result) 87 if (result)
88 return result; 88 return result;
diff --git a/drivers/net/wan/hdlc_raw_eth.c b/drivers/net/wan/hdlc_raw_eth.c
index 8895394e6006..11b16bdfe6aa 100644
--- a/drivers/net/wan/hdlc_raw_eth.c
+++ b/drivers/net/wan/hdlc_raw_eth.c
@@ -96,7 +96,7 @@ static int raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr)
96 if (result) 96 if (result)
97 return result; 97 return result;
98 98
99 result = attach_hdlc_protocol(dev, &proto, NULL, 99 result = attach_hdlc_protocol(dev, &proto,
100 sizeof(raw_hdlc_proto)); 100 sizeof(raw_hdlc_proto));
101 if (result) 101 if (result)
102 return result; 102 return result;
diff --git a/drivers/net/wan/hdlc_x25.c b/drivers/net/wan/hdlc_x25.c
index cd7b22f50edc..c15cc11e399b 100644
--- a/drivers/net/wan/hdlc_x25.c
+++ b/drivers/net/wan/hdlc_x25.c
@@ -164,17 +164,17 @@ static void x25_close(struct net_device *dev)
164 164
165static int x25_rx(struct sk_buff *skb) 165static int x25_rx(struct sk_buff *skb)
166{ 166{
167 struct hdlc_device_desc *desc = dev_to_desc(skb->dev); 167 struct hdlc_device *hdlc = dev_to_hdlc(skb->dev);
168 168
169 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { 169 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
170 desc->stats.rx_dropped++; 170 hdlc->stats.rx_dropped++;
171 return NET_RX_DROP; 171 return NET_RX_DROP;
172 } 172 }
173 173
174 if (lapb_data_received(skb->dev, skb) == LAPB_OK) 174 if (lapb_data_received(skb->dev, skb) == LAPB_OK)
175 return NET_RX_SUCCESS; 175 return NET_RX_SUCCESS;
176 176
177 desc->stats.rx_errors++; 177 hdlc->stats.rx_errors++;
178 dev_kfree_skb_any(skb); 178 dev_kfree_skb_any(skb);
179 return NET_RX_DROP; 179 return NET_RX_DROP;
180} 180}
@@ -184,6 +184,7 @@ static struct hdlc_proto proto = {
184 .open = x25_open, 184 .open = x25_open,
185 .close = x25_close, 185 .close = x25_close,
186 .ioctl = x25_ioctl, 186 .ioctl = x25_ioctl,
187 .netif_rx = x25_rx,
187 .module = THIS_MODULE, 188 .module = THIS_MODULE,
188}; 189};
189 190
@@ -211,8 +212,7 @@ static int x25_ioctl(struct net_device *dev, struct ifreq *ifr)
211 if (result) 212 if (result)
212 return result; 213 return result;
213 214
214 if ((result = attach_hdlc_protocol(dev, &proto, 215 if ((result = attach_hdlc_protocol(dev, &proto, 0)))
215 x25_rx, 0)) != 0)
216 return result; 216 return result;
217 dev->hard_start_xmit = x25_xmit; 217 dev->hard_start_xmit = x25_xmit;
218 dev->type = ARPHRD_X25; 218 dev->type = ARPHRD_X25;