diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-09-16 07:04:29 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-09-16 19:20:20 -0400 |
commit | d97a077a15ae21e161e74def7762caa99200e4cf (patch) | |
tree | 2c017dad747ab7d1ddb5fc090d1d3b1038f0c33f | |
parent | 026359bc6eddfdc2d2e684bf0b51691649b90f33 (diff) |
wan: make LAPB callbacks const
This is compile tested only.
Suggested by dumpster diving in PAX.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/wan/hdlc_x25.c | 16 | ||||
-rw-r--r-- | drivers/net/wan/lapbether.c | 3 | ||||
-rw-r--r-- | drivers/net/wan/x25_asy.c | 3 | ||||
-rw-r--r-- | include/linux/lapb.h | 3 | ||||
-rw-r--r-- | include/net/lapb.h | 2 | ||||
-rw-r--r-- | net/lapb/lapb_iface.c | 29 |
6 files changed, 28 insertions, 28 deletions
diff --git a/drivers/net/wan/hdlc_x25.c b/drivers/net/wan/hdlc_x25.c index 56aeb011cb3d..a49aec5efd20 100644 --- a/drivers/net/wan/hdlc_x25.c +++ b/drivers/net/wan/hdlc_x25.c | |||
@@ -134,15 +134,15 @@ static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev) | |||
134 | 134 | ||
135 | static int x25_open(struct net_device *dev) | 135 | static int x25_open(struct net_device *dev) |
136 | { | 136 | { |
137 | struct lapb_register_struct cb; | ||
138 | int result; | 137 | int result; |
139 | 138 | static const struct lapb_register_struct cb = { | |
140 | cb.connect_confirmation = x25_connected; | 139 | .connect_confirmation = x25_connected, |
141 | cb.connect_indication = x25_connected; | 140 | .connect_indication = x25_connected, |
142 | cb.disconnect_confirmation = x25_disconnected; | 141 | .disconnect_confirmation = x25_disconnected, |
143 | cb.disconnect_indication = x25_disconnected; | 142 | .disconnect_indication = x25_disconnected, |
144 | cb.data_indication = x25_data_indication; | 143 | .data_indication = x25_data_indication, |
145 | cb.data_transmit = x25_data_transmit; | 144 | .data_transmit = x25_data_transmit, |
145 | }; | ||
146 | 146 | ||
147 | result = lapb_register(dev, &cb); | 147 | result = lapb_register(dev, &cb); |
148 | if (result != LAPB_OK) | 148 | if (result != LAPB_OK) |
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c index a817081737a0..7beeb9b88a3b 100644 --- a/drivers/net/wan/lapbether.c +++ b/drivers/net/wan/lapbether.c | |||
@@ -259,14 +259,13 @@ static int lapbeth_set_mac_address(struct net_device *dev, void *addr) | |||
259 | } | 259 | } |
260 | 260 | ||
261 | 261 | ||
262 | static struct lapb_register_struct lapbeth_callbacks = { | 262 | static const struct lapb_register_struct lapbeth_callbacks = { |
263 | .connect_confirmation = lapbeth_connected, | 263 | .connect_confirmation = lapbeth_connected, |
264 | .connect_indication = lapbeth_connected, | 264 | .connect_indication = lapbeth_connected, |
265 | .disconnect_confirmation = lapbeth_disconnected, | 265 | .disconnect_confirmation = lapbeth_disconnected, |
266 | .disconnect_indication = lapbeth_disconnected, | 266 | .disconnect_indication = lapbeth_disconnected, |
267 | .data_indication = lapbeth_data_indication, | 267 | .data_indication = lapbeth_data_indication, |
268 | .data_transmit = lapbeth_data_transmit, | 268 | .data_transmit = lapbeth_data_transmit, |
269 | |||
270 | }; | 269 | }; |
271 | 270 | ||
272 | /* | 271 | /* |
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index 46ceb3ae9073..8a10bb730d5a 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c | |||
@@ -434,14 +434,13 @@ static void x25_asy_disconnected(struct net_device *dev, int reason) | |||
434 | netif_rx(skb); | 434 | netif_rx(skb); |
435 | } | 435 | } |
436 | 436 | ||
437 | static struct lapb_register_struct x25_asy_callbacks = { | 437 | static const struct lapb_register_struct x25_asy_callbacks = { |
438 | .connect_confirmation = x25_asy_connected, | 438 | .connect_confirmation = x25_asy_connected, |
439 | .connect_indication = x25_asy_connected, | 439 | .connect_indication = x25_asy_connected, |
440 | .disconnect_confirmation = x25_asy_disconnected, | 440 | .disconnect_confirmation = x25_asy_disconnected, |
441 | .disconnect_indication = x25_asy_disconnected, | 441 | .disconnect_indication = x25_asy_disconnected, |
442 | .data_indication = x25_asy_data_indication, | 442 | .data_indication = x25_asy_data_indication, |
443 | .data_transmit = x25_asy_data_transmit, | 443 | .data_transmit = x25_asy_data_transmit, |
444 | |||
445 | }; | 444 | }; |
446 | 445 | ||
447 | 446 | ||
diff --git a/include/linux/lapb.h b/include/linux/lapb.h index ce709e1885cc..873c1eb635e4 100644 --- a/include/linux/lapb.h +++ b/include/linux/lapb.h | |||
@@ -44,7 +44,8 @@ struct lapb_parms_struct { | |||
44 | unsigned int mode; | 44 | unsigned int mode; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | extern int lapb_register(struct net_device *dev, struct lapb_register_struct *callbacks); | 47 | extern int lapb_register(struct net_device *dev, |
48 | const struct lapb_register_struct *callbacks); | ||
48 | extern int lapb_unregister(struct net_device *dev); | 49 | extern int lapb_unregister(struct net_device *dev); |
49 | extern int lapb_getparms(struct net_device *dev, struct lapb_parms_struct *parms); | 50 | extern int lapb_getparms(struct net_device *dev, struct lapb_parms_struct *parms); |
50 | extern int lapb_setparms(struct net_device *dev, struct lapb_parms_struct *parms); | 51 | extern int lapb_setparms(struct net_device *dev, struct lapb_parms_struct *parms); |
diff --git a/include/net/lapb.h b/include/net/lapb.h index 96cb5ddaa9f1..fd2bf572ee1d 100644 --- a/include/net/lapb.h +++ b/include/net/lapb.h | |||
@@ -95,7 +95,7 @@ struct lapb_cb { | |||
95 | struct sk_buff_head write_queue; | 95 | struct sk_buff_head write_queue; |
96 | struct sk_buff_head ack_queue; | 96 | struct sk_buff_head ack_queue; |
97 | unsigned char window; | 97 | unsigned char window; |
98 | struct lapb_register_struct callbacks; | 98 | const struct lapb_register_struct *callbacks; |
99 | 99 | ||
100 | /* FRMR control information */ | 100 | /* FRMR control information */ |
101 | struct lapb_frame frmr_data; | 101 | struct lapb_frame frmr_data; |
diff --git a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c index 956b7e47dc52..8d0324bac01c 100644 --- a/net/lapb/lapb_iface.c +++ b/net/lapb/lapb_iface.c | |||
@@ -139,7 +139,8 @@ out: | |||
139 | return lapb; | 139 | return lapb; |
140 | } | 140 | } |
141 | 141 | ||
142 | int lapb_register(struct net_device *dev, struct lapb_register_struct *callbacks) | 142 | int lapb_register(struct net_device *dev, |
143 | const struct lapb_register_struct *callbacks) | ||
143 | { | 144 | { |
144 | struct lapb_cb *lapb; | 145 | struct lapb_cb *lapb; |
145 | int rc = LAPB_BADTOKEN; | 146 | int rc = LAPB_BADTOKEN; |
@@ -158,7 +159,7 @@ int lapb_register(struct net_device *dev, struct lapb_register_struct *callbacks | |||
158 | goto out; | 159 | goto out; |
159 | 160 | ||
160 | lapb->dev = dev; | 161 | lapb->dev = dev; |
161 | lapb->callbacks = *callbacks; | 162 | lapb->callbacks = callbacks; |
162 | 163 | ||
163 | __lapb_insert_cb(lapb); | 164 | __lapb_insert_cb(lapb); |
164 | 165 | ||
@@ -380,32 +381,32 @@ int lapb_data_received(struct net_device *dev, struct sk_buff *skb) | |||
380 | 381 | ||
381 | void lapb_connect_confirmation(struct lapb_cb *lapb, int reason) | 382 | void lapb_connect_confirmation(struct lapb_cb *lapb, int reason) |
382 | { | 383 | { |
383 | if (lapb->callbacks.connect_confirmation) | 384 | if (lapb->callbacks->connect_confirmation) |
384 | lapb->callbacks.connect_confirmation(lapb->dev, reason); | 385 | lapb->callbacks->connect_confirmation(lapb->dev, reason); |
385 | } | 386 | } |
386 | 387 | ||
387 | void lapb_connect_indication(struct lapb_cb *lapb, int reason) | 388 | void lapb_connect_indication(struct lapb_cb *lapb, int reason) |
388 | { | 389 | { |
389 | if (lapb->callbacks.connect_indication) | 390 | if (lapb->callbacks->connect_indication) |
390 | lapb->callbacks.connect_indication(lapb->dev, reason); | 391 | lapb->callbacks->connect_indication(lapb->dev, reason); |
391 | } | 392 | } |
392 | 393 | ||
393 | void lapb_disconnect_confirmation(struct lapb_cb *lapb, int reason) | 394 | void lapb_disconnect_confirmation(struct lapb_cb *lapb, int reason) |
394 | { | 395 | { |
395 | if (lapb->callbacks.disconnect_confirmation) | 396 | if (lapb->callbacks->disconnect_confirmation) |
396 | lapb->callbacks.disconnect_confirmation(lapb->dev, reason); | 397 | lapb->callbacks->disconnect_confirmation(lapb->dev, reason); |
397 | } | 398 | } |
398 | 399 | ||
399 | void lapb_disconnect_indication(struct lapb_cb *lapb, int reason) | 400 | void lapb_disconnect_indication(struct lapb_cb *lapb, int reason) |
400 | { | 401 | { |
401 | if (lapb->callbacks.disconnect_indication) | 402 | if (lapb->callbacks->disconnect_indication) |
402 | lapb->callbacks.disconnect_indication(lapb->dev, reason); | 403 | lapb->callbacks->disconnect_indication(lapb->dev, reason); |
403 | } | 404 | } |
404 | 405 | ||
405 | int lapb_data_indication(struct lapb_cb *lapb, struct sk_buff *skb) | 406 | int lapb_data_indication(struct lapb_cb *lapb, struct sk_buff *skb) |
406 | { | 407 | { |
407 | if (lapb->callbacks.data_indication) | 408 | if (lapb->callbacks->data_indication) |
408 | return lapb->callbacks.data_indication(lapb->dev, skb); | 409 | return lapb->callbacks->data_indication(lapb->dev, skb); |
409 | 410 | ||
410 | kfree_skb(skb); | 411 | kfree_skb(skb); |
411 | return NET_RX_SUCCESS; /* For now; must be != NET_RX_DROP */ | 412 | return NET_RX_SUCCESS; /* For now; must be != NET_RX_DROP */ |
@@ -415,8 +416,8 @@ int lapb_data_transmit(struct lapb_cb *lapb, struct sk_buff *skb) | |||
415 | { | 416 | { |
416 | int used = 0; | 417 | int used = 0; |
417 | 418 | ||
418 | if (lapb->callbacks.data_transmit) { | 419 | if (lapb->callbacks->data_transmit) { |
419 | lapb->callbacks.data_transmit(lapb->dev, skb); | 420 | lapb->callbacks->data_transmit(lapb->dev, skb); |
420 | used = 1; | 421 | used = 1; |
421 | } | 422 | } |
422 | 423 | ||