diff options
Diffstat (limited to 'drivers/net/wan/x25_asy.c')
-rw-r--r-- | drivers/net/wan/x25_asy.c | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index 2a6c7a60756f..e6e2ce3e7bcf 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c | |||
@@ -64,7 +64,7 @@ static struct x25_asy *x25_asy_alloc(void) | |||
64 | if (dev == NULL) | 64 | if (dev == NULL) |
65 | break; | 65 | break; |
66 | 66 | ||
67 | sl = dev->priv; | 67 | sl = netdev_priv(dev); |
68 | /* Not in use ? */ | 68 | /* Not in use ? */ |
69 | if (!test_and_set_bit(SLF_INUSE, &sl->flags)) | 69 | if (!test_and_set_bit(SLF_INUSE, &sl->flags)) |
70 | return sl; | 70 | return sl; |
@@ -86,7 +86,7 @@ static struct x25_asy *x25_asy_alloc(void) | |||
86 | return NULL; | 86 | return NULL; |
87 | 87 | ||
88 | /* Initialize channel control data */ | 88 | /* Initialize channel control data */ |
89 | sl = dev->priv; | 89 | sl = netdev_priv(dev); |
90 | dev->base_addr = i; | 90 | dev->base_addr = i; |
91 | 91 | ||
92 | /* register device so that it can be ifconfig'ed */ | 92 | /* register device so that it can be ifconfig'ed */ |
@@ -120,7 +120,7 @@ static void x25_asy_free(struct x25_asy *sl) | |||
120 | 120 | ||
121 | static int x25_asy_change_mtu(struct net_device *dev, int newmtu) | 121 | static int x25_asy_change_mtu(struct net_device *dev, int newmtu) |
122 | { | 122 | { |
123 | struct x25_asy *sl = dev->priv; | 123 | struct x25_asy *sl = netdev_priv(dev); |
124 | unsigned char *xbuff, *rbuff; | 124 | unsigned char *xbuff, *rbuff; |
125 | int len = 2 * newmtu; | 125 | int len = 2 * newmtu; |
126 | 126 | ||
@@ -211,7 +211,6 @@ static void x25_asy_bump(struct x25_asy *sl) | |||
211 | printk(KERN_DEBUG "x25_asy: data received err - %d\n", err); | 211 | printk(KERN_DEBUG "x25_asy: data received err - %d\n", err); |
212 | } else { | 212 | } else { |
213 | netif_rx(skb); | 213 | netif_rx(skb); |
214 | sl->dev->last_rx = jiffies; | ||
215 | sl->stats.rx_packets++; | 214 | sl->stats.rx_packets++; |
216 | } | 215 | } |
217 | } | 216 | } |
@@ -243,7 +242,7 @@ static void x25_asy_encaps(struct x25_asy *sl, unsigned char *icp, int len) | |||
243 | * if we did not request it before write operation. | 242 | * if we did not request it before write operation. |
244 | * 14 Oct 1994 Dmitry Gorodchanin. | 243 | * 14 Oct 1994 Dmitry Gorodchanin. |
245 | */ | 244 | */ |
246 | sl->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); | 245 | set_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); |
247 | actual = sl->tty->ops->write(sl->tty, sl->xbuff, count); | 246 | actual = sl->tty->ops->write(sl->tty, sl->xbuff, count); |
248 | sl->xleft = count - actual; | 247 | sl->xleft = count - actual; |
249 | sl->xhead = sl->xbuff + actual; | 248 | sl->xhead = sl->xbuff + actual; |
@@ -258,7 +257,7 @@ static void x25_asy_encaps(struct x25_asy *sl, unsigned char *icp, int len) | |||
258 | static void x25_asy_write_wakeup(struct tty_struct *tty) | 257 | static void x25_asy_write_wakeup(struct tty_struct *tty) |
259 | { | 258 | { |
260 | int actual; | 259 | int actual; |
261 | struct x25_asy *sl = (struct x25_asy *) tty->disc_data; | 260 | struct x25_asy *sl = tty->disc_data; |
262 | 261 | ||
263 | /* First make sure we're connected. */ | 262 | /* First make sure we're connected. */ |
264 | if (!sl || sl->magic != X25_ASY_MAGIC || !netif_running(sl->dev)) | 263 | if (!sl || sl->magic != X25_ASY_MAGIC || !netif_running(sl->dev)) |
@@ -268,7 +267,7 @@ static void x25_asy_write_wakeup(struct tty_struct *tty) | |||
268 | /* Now serial buffer is almost free & we can start | 267 | /* Now serial buffer is almost free & we can start |
269 | * transmission of another packet */ | 268 | * transmission of another packet */ |
270 | sl->stats.tx_packets++; | 269 | sl->stats.tx_packets++; |
271 | tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); | 270 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
272 | x25_asy_unlock(sl); | 271 | x25_asy_unlock(sl); |
273 | return; | 272 | return; |
274 | } | 273 | } |
@@ -280,7 +279,7 @@ static void x25_asy_write_wakeup(struct tty_struct *tty) | |||
280 | 279 | ||
281 | static void x25_asy_timeout(struct net_device *dev) | 280 | static void x25_asy_timeout(struct net_device *dev) |
282 | { | 281 | { |
283 | struct x25_asy *sl = dev->priv; | 282 | struct x25_asy *sl = netdev_priv(dev); |
284 | 283 | ||
285 | spin_lock(&sl->lock); | 284 | spin_lock(&sl->lock); |
286 | if (netif_queue_stopped(dev)) { | 285 | if (netif_queue_stopped(dev)) { |
@@ -291,7 +290,7 @@ static void x25_asy_timeout(struct net_device *dev) | |||
291 | (tty_chars_in_buffer(sl->tty) || sl->xleft) ? | 290 | (tty_chars_in_buffer(sl->tty) || sl->xleft) ? |
292 | "bad line quality" : "driver error"); | 291 | "bad line quality" : "driver error"); |
293 | sl->xleft = 0; | 292 | sl->xleft = 0; |
294 | sl->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); | 293 | clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); |
295 | x25_asy_unlock(sl); | 294 | x25_asy_unlock(sl); |
296 | } | 295 | } |
297 | spin_unlock(&sl->lock); | 296 | spin_unlock(&sl->lock); |
@@ -301,7 +300,7 @@ static void x25_asy_timeout(struct net_device *dev) | |||
301 | 300 | ||
302 | static int x25_asy_xmit(struct sk_buff *skb, struct net_device *dev) | 301 | static int x25_asy_xmit(struct sk_buff *skb, struct net_device *dev) |
303 | { | 302 | { |
304 | struct x25_asy *sl = dev->priv; | 303 | struct x25_asy *sl = netdev_priv(dev); |
305 | int err; | 304 | int err; |
306 | 305 | ||
307 | if (!netif_running(sl->dev)) { | 306 | if (!netif_running(sl->dev)) { |
@@ -361,7 +360,6 @@ static int x25_asy_xmit(struct sk_buff *skb, struct net_device *dev) | |||
361 | 360 | ||
362 | static int x25_asy_data_indication(struct net_device *dev, struct sk_buff *skb) | 361 | static int x25_asy_data_indication(struct net_device *dev, struct sk_buff *skb) |
363 | { | 362 | { |
364 | skb->dev->last_rx = jiffies; | ||
365 | return netif_rx(skb); | 363 | return netif_rx(skb); |
366 | } | 364 | } |
367 | 365 | ||
@@ -373,7 +371,7 @@ static int x25_asy_data_indication(struct net_device *dev, struct sk_buff *skb) | |||
373 | 371 | ||
374 | static void x25_asy_data_transmit(struct net_device *dev, struct sk_buff *skb) | 372 | static void x25_asy_data_transmit(struct net_device *dev, struct sk_buff *skb) |
375 | { | 373 | { |
376 | struct x25_asy *sl = dev->priv; | 374 | struct x25_asy *sl = netdev_priv(dev); |
377 | 375 | ||
378 | spin_lock(&sl->lock); | 376 | spin_lock(&sl->lock); |
379 | if (netif_queue_stopped(sl->dev) || sl->tty == NULL) { | 377 | if (netif_queue_stopped(sl->dev) || sl->tty == NULL) { |
@@ -398,7 +396,7 @@ static void x25_asy_data_transmit(struct net_device *dev, struct sk_buff *skb) | |||
398 | 396 | ||
399 | static void x25_asy_connected(struct net_device *dev, int reason) | 397 | static void x25_asy_connected(struct net_device *dev, int reason) |
400 | { | 398 | { |
401 | struct x25_asy *sl = dev->priv; | 399 | struct x25_asy *sl = netdev_priv(dev); |
402 | struct sk_buff *skb; | 400 | struct sk_buff *skb; |
403 | unsigned char *ptr; | 401 | unsigned char *ptr; |
404 | 402 | ||
@@ -413,12 +411,11 @@ static void x25_asy_connected(struct net_device *dev, int reason) | |||
413 | 411 | ||
414 | skb->protocol = x25_type_trans(skb, sl->dev); | 412 | skb->protocol = x25_type_trans(skb, sl->dev); |
415 | netif_rx(skb); | 413 | netif_rx(skb); |
416 | sl->dev->last_rx = jiffies; | ||
417 | } | 414 | } |
418 | 415 | ||
419 | static void x25_asy_disconnected(struct net_device *dev, int reason) | 416 | static void x25_asy_disconnected(struct net_device *dev, int reason) |
420 | { | 417 | { |
421 | struct x25_asy *sl = dev->priv; | 418 | struct x25_asy *sl = netdev_priv(dev); |
422 | struct sk_buff *skb; | 419 | struct sk_buff *skb; |
423 | unsigned char *ptr; | 420 | unsigned char *ptr; |
424 | 421 | ||
@@ -433,7 +430,6 @@ static void x25_asy_disconnected(struct net_device *dev, int reason) | |||
433 | 430 | ||
434 | skb->protocol = x25_type_trans(skb, sl->dev); | 431 | skb->protocol = x25_type_trans(skb, sl->dev); |
435 | netif_rx(skb); | 432 | netif_rx(skb); |
436 | sl->dev->last_rx = jiffies; | ||
437 | } | 433 | } |
438 | 434 | ||
439 | static struct lapb_register_struct x25_asy_callbacks = { | 435 | static struct lapb_register_struct x25_asy_callbacks = { |
@@ -450,7 +446,7 @@ static struct lapb_register_struct x25_asy_callbacks = { | |||
450 | /* Open the low-level part of the X.25 channel. Easy! */ | 446 | /* Open the low-level part of the X.25 channel. Easy! */ |
451 | static int x25_asy_open(struct net_device *dev) | 447 | static int x25_asy_open(struct net_device *dev) |
452 | { | 448 | { |
453 | struct x25_asy *sl = dev->priv; | 449 | struct x25_asy *sl = netdev_priv(dev); |
454 | unsigned long len; | 450 | unsigned long len; |
455 | int err; | 451 | int err; |
456 | 452 | ||
@@ -499,12 +495,12 @@ norbuff: | |||
499 | /* Close the low-level part of the X.25 channel. Easy! */ | 495 | /* Close the low-level part of the X.25 channel. Easy! */ |
500 | static int x25_asy_close(struct net_device *dev) | 496 | static int x25_asy_close(struct net_device *dev) |
501 | { | 497 | { |
502 | struct x25_asy *sl = dev->priv; | 498 | struct x25_asy *sl = netdev_priv(dev); |
503 | int err; | 499 | int err; |
504 | 500 | ||
505 | spin_lock(&sl->lock); | 501 | spin_lock(&sl->lock); |
506 | if (sl->tty) | 502 | if (sl->tty) |
507 | sl->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); | 503 | clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); |
508 | 504 | ||
509 | netif_stop_queue(dev); | 505 | netif_stop_queue(dev); |
510 | sl->rcount = 0; | 506 | sl->rcount = 0; |
@@ -527,7 +523,7 @@ static int x25_asy_close(struct net_device *dev) | |||
527 | static void x25_asy_receive_buf(struct tty_struct *tty, | 523 | static void x25_asy_receive_buf(struct tty_struct *tty, |
528 | const unsigned char *cp, char *fp, int count) | 524 | const unsigned char *cp, char *fp, int count) |
529 | { | 525 | { |
530 | struct x25_asy *sl = (struct x25_asy *) tty->disc_data; | 526 | struct x25_asy *sl = tty->disc_data; |
531 | 527 | ||
532 | if (!sl || sl->magic != X25_ASY_MAGIC || !netif_running(sl->dev)) | 528 | if (!sl || sl->magic != X25_ASY_MAGIC || !netif_running(sl->dev)) |
533 | return; | 529 | return; |
@@ -555,7 +551,7 @@ static void x25_asy_receive_buf(struct tty_struct *tty, | |||
555 | 551 | ||
556 | static int x25_asy_open_tty(struct tty_struct *tty) | 552 | static int x25_asy_open_tty(struct tty_struct *tty) |
557 | { | 553 | { |
558 | struct x25_asy *sl = (struct x25_asy *) tty->disc_data; | 554 | struct x25_asy *sl = tty->disc_data; |
559 | int err; | 555 | int err; |
560 | 556 | ||
561 | if (tty->ops->write == NULL) | 557 | if (tty->ops->write == NULL) |
@@ -596,7 +592,7 @@ static int x25_asy_open_tty(struct tty_struct *tty) | |||
596 | */ | 592 | */ |
597 | static void x25_asy_close_tty(struct tty_struct *tty) | 593 | static void x25_asy_close_tty(struct tty_struct *tty) |
598 | { | 594 | { |
599 | struct x25_asy *sl = (struct x25_asy *) tty->disc_data; | 595 | struct x25_asy *sl = tty->disc_data; |
600 | 596 | ||
601 | /* First make sure we're connected. */ | 597 | /* First make sure we're connected. */ |
602 | if (!sl || sl->magic != X25_ASY_MAGIC) | 598 | if (!sl || sl->magic != X25_ASY_MAGIC) |
@@ -615,7 +611,7 @@ static void x25_asy_close_tty(struct tty_struct *tty) | |||
615 | 611 | ||
616 | static struct net_device_stats *x25_asy_get_stats(struct net_device *dev) | 612 | static struct net_device_stats *x25_asy_get_stats(struct net_device *dev) |
617 | { | 613 | { |
618 | struct x25_asy *sl = dev->priv; | 614 | struct x25_asy *sl = netdev_priv(dev); |
619 | return &sl->stats; | 615 | return &sl->stats; |
620 | } | 616 | } |
621 | 617 | ||
@@ -624,7 +620,7 @@ static struct net_device_stats *x25_asy_get_stats(struct net_device *dev) | |||
624 | * STANDARD X.25 ENCAPSULATION * | 620 | * STANDARD X.25 ENCAPSULATION * |
625 | ************************************************************************/ | 621 | ************************************************************************/ |
626 | 622 | ||
627 | int x25_asy_esc(unsigned char *s, unsigned char *d, int len) | 623 | static int x25_asy_esc(unsigned char *s, unsigned char *d, int len) |
628 | { | 624 | { |
629 | unsigned char *ptr = d; | 625 | unsigned char *ptr = d; |
630 | unsigned char c; | 626 | unsigned char c; |
@@ -696,7 +692,7 @@ static void x25_asy_unesc(struct x25_asy *sl, unsigned char s) | |||
696 | static int x25_asy_ioctl(struct tty_struct *tty, struct file *file, | 692 | static int x25_asy_ioctl(struct tty_struct *tty, struct file *file, |
697 | unsigned int cmd, unsigned long arg) | 693 | unsigned int cmd, unsigned long arg) |
698 | { | 694 | { |
699 | struct x25_asy *sl = (struct x25_asy *) tty->disc_data; | 695 | struct x25_asy *sl = tty->disc_data; |
700 | 696 | ||
701 | /* First make sure we're connected. */ | 697 | /* First make sure we're connected. */ |
702 | if (!sl || sl->magic != X25_ASY_MAGIC) | 698 | if (!sl || sl->magic != X25_ASY_MAGIC) |
@@ -717,7 +713,7 @@ static int x25_asy_ioctl(struct tty_struct *tty, struct file *file, | |||
717 | 713 | ||
718 | static int x25_asy_open_dev(struct net_device *dev) | 714 | static int x25_asy_open_dev(struct net_device *dev) |
719 | { | 715 | { |
720 | struct x25_asy *sl = dev->priv; | 716 | struct x25_asy *sl = netdev_priv(dev); |
721 | if (sl->tty == NULL) | 717 | if (sl->tty == NULL) |
722 | return -ENODEV; | 718 | return -ENODEV; |
723 | return 0; | 719 | return 0; |
@@ -726,7 +722,7 @@ static int x25_asy_open_dev(struct net_device *dev) | |||
726 | /* Initialise the X.25 driver. Called by the device init code */ | 722 | /* Initialise the X.25 driver. Called by the device init code */ |
727 | static void x25_asy_setup(struct net_device *dev) | 723 | static void x25_asy_setup(struct net_device *dev) |
728 | { | 724 | { |
729 | struct x25_asy *sl = dev->priv; | 725 | struct x25_asy *sl = netdev_priv(dev); |
730 | 726 | ||
731 | sl->magic = X25_ASY_MAGIC; | 727 | sl->magic = X25_ASY_MAGIC; |
732 | sl->dev = dev; | 728 | sl->dev = dev; |
@@ -793,7 +789,7 @@ static void __exit exit_x25_asy(void) | |||
793 | for (i = 0; i < x25_asy_maxdev; i++) { | 789 | for (i = 0; i < x25_asy_maxdev; i++) { |
794 | dev = x25_asy_devs[i]; | 790 | dev = x25_asy_devs[i]; |
795 | if (dev) { | 791 | if (dev) { |
796 | struct x25_asy *sl = dev->priv; | 792 | struct x25_asy *sl = netdev_priv(dev); |
797 | 793 | ||
798 | spin_lock_bh(&sl->lock); | 794 | spin_lock_bh(&sl->lock); |
799 | if (sl->tty) | 795 | if (sl->tty) |