e1000e: perform 10/100 adaptive IFS only on parts that support it
[safe/jmp/linux-2.6] / drivers / net / ppp_synctty.c
index 48ed5fd..3a13cec 100644 (file)
@@ -206,6 +206,7 @@ ppp_sync_open(struct tty_struct *tty)
 {
        struct syncppp *ap;
        int err;
+       int speed;
 
        if (tty->ops->write == NULL)
                return -EOPNOTSUPP;
@@ -234,6 +235,8 @@ ppp_sync_open(struct tty_struct *tty)
        ap->chan.ops = &sync_ops;
        ap->chan.mtu = PPP_MRU;
        ap->chan.hdrlen = 2;    /* for A/C bytes */
+       speed = tty_get_baud_rate(tty);
+       ap->chan.speed = speed;
        err = ppp_register_channel(&ap->chan);
        if (err)
                goto out_free;
@@ -281,8 +284,7 @@ ppp_sync_close(struct tty_struct *tty)
 
        ppp_unregister_channel(&ap->chan);
        skb_queue_purge(&ap->rqueue);
-       if (ap->tpkt)
-               kfree_skb(ap->tpkt);
+       kfree_skb(ap->tpkt);
        kfree(ap);
 }
 
@@ -333,9 +335,6 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file,
        err = -EFAULT;
        switch (cmd) {
        case PPPIOCGCHAN:
-               err = -ENXIO;
-               if (!ap)
-                       break;
                err = -EFAULT;
                if (put_user(ppp_channel_index(&ap->chan), p))
                        break;
@@ -343,9 +342,6 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file,
                break;
 
        case PPPIOCGUNIT:
-               err = -ENXIO;
-               if (!ap)
-                       break;
                err = -EFAULT;
                if (put_user(ppp_unit_number(&ap->chan), p))
                        break;
@@ -382,10 +378,7 @@ ppp_sync_poll(struct tty_struct *tty, struct file *file, poll_table *wait)
        return 0;
 }
 
-/*
- * This can now be called from hard interrupt level as well
- * as soft interrupt level or mainline.
- */
+/* May sleep, don't call from interrupt level or with interrupts disabled */
 static void
 ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf,
                  char *cflags, int count)
@@ -401,9 +394,7 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf,
        if (!skb_queue_empty(&ap->rqueue))
                tasklet_schedule(&ap->tsk);
        sp_put(ap);
-       if (test_and_clear_bit(TTY_THROTTLED, &tty->flags)
-           && tty->ops->unthrottle)
-               tty->ops->unthrottle(tty);
+       tty_unthrottle(tty);
 }
 
 static void
@@ -420,7 +411,7 @@ ppp_sync_wakeup(struct tty_struct *tty)
 }
 
 
-static struct tty_ldisc ppp_sync_ldisc = {
+static struct tty_ldisc_ops ppp_sync_ldisc = {
        .owner  = THIS_MODULE,
        .magic  = TTY_LDISC_MAGIC,
        .name   = "pppsync",
@@ -671,8 +662,8 @@ ppp_sync_push(struct syncppp *ap)
                }
                /* haven't made any progress */
                spin_unlock_bh(&ap->xmit_lock);
-               if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags)
-                     || (!tty_stuffed && ap->tpkt)))
+               if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) ||
+                     (!tty_stuffed && ap->tpkt)))
                        break;
                if (!spin_trylock_bh(&ap->xmit_lock))
                        break;