]> err.no Git - linux-2.6/commitdiff
[PATCH] remove TTY_DONT_FLIP
authorPaul Fulghum <paulkf@microgate.com>
Wed, 28 Jun 2006 11:26:47 +0000 (04:26 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 28 Jun 2006 21:59:05 +0000 (14:59 -0700)
Remove TTY_DONT_FLIP tty flag.  This flag was introduced in 2.1.X kernels
to prevent the N_TTY line discipline functions read_chan() and
n_tty_receive_buf() from running at the same time.  2.2.15 introduced
tty->read_lock to protect access to the N_TTY read buffer, which is the
only state requiring protection between these two functions.

The current TTY_DONT_FLIP implementation is broken for SMP, and is not
universally honored by drivers that send data directly to the line
discipline receive_buf function.

Because TTY_DONT_FLIP is not necessary, is broken in implementation, and is
not universally honored, it is removed.

Signed-off-by: Paul Fulghum <paulkf@microgate.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/char/mxser.c
drivers/char/n_tty.c
drivers/char/pty.c
drivers/char/tty_io.c
drivers/serial/crisv10.c
drivers/serial/jsm/jsm_tty.c
drivers/usb/serial/ir-usb.c
include/linux/tty.h
net/bluetooth/rfcomm/tty.c

index 645d9d713aec84452615d641cfb73603d4eef2b5..72cfd09091e0a63ce1587cabec737aeaeb41e127 100644 (file)
@@ -996,7 +996,6 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
 
        info->session = current->signal->session;
        info->pgrp = process_group(current);
-       clear_bit(TTY_DONT_FLIP, &tty->flags);
 
        /*
        status = mxser_get_msr(info->base, 0, info->port);
index b9371d5bf7906b48d4b340c5a8756c3fa132f516..603b9ade5eb089f16f041fc15e4876417a6c1505 100644 (file)
@@ -1132,7 +1132,7 @@ static inline int input_available_p(struct tty_struct *tty, int amt)
  *     buffer, and once to drain the space from the (physical) beginning of
  *     the buffer to head pointer.
  *
- *     Called under the tty->atomic_read_lock sem and with TTY_DONT_FLIP set
+ *     Called under the tty->atomic_read_lock sem
  *
  */
  
@@ -1271,7 +1271,6 @@ do_it_again:
        }
 
        add_wait_queue(&tty->read_wait, &wait);
-       set_bit(TTY_DONT_FLIP, &tty->flags);
        while (nr) {
                /* First test for status change. */
                if (tty->packet && tty->link->ctrl_status) {
@@ -1315,9 +1314,7 @@ do_it_again:
                                break;
                        }
                        n_tty_set_room(tty);
-                       clear_bit(TTY_DONT_FLIP, &tty->flags);
                        timeout = schedule_timeout(timeout);
-                       set_bit(TTY_DONT_FLIP, &tty->flags);
                        continue;
                }
                __set_current_state(TASK_RUNNING);
@@ -1394,7 +1391,6 @@ do_it_again:
                if (time)
                        timeout = time;
        }
-       clear_bit(TTY_DONT_FLIP, &tty->flags);
        mutex_unlock(&tty->atomic_read_lock);
        remove_wait_queue(&tty->read_wait, &wait);
 
index 9b5a2c0e7008c82183649e6006784088ceabd220..0c17f61549b432b5d395aa39ee9b1d6e3036d26a 100644 (file)
@@ -101,7 +101,7 @@ static void pty_unthrottle(struct tty_struct * tty)
  *
  * FIXME: Our pty_write method is called with our ldisc lock held but
  * not our partners. We can't just take the other one blindly without
- * risking deadlocks.  There is also the small matter of TTY_DONT_FLIP
+ * risking deadlocks.
  */
 static int pty_write(struct tty_struct * tty, const unsigned char *buf, int count)
 {
index bd74e82d8a72a443b8ca4579898e3dcf11e876f3..b846d87f2b56ad80a89145c443d5ea48cda89f96 100644 (file)
@@ -784,11 +784,8 @@ restart:
        }
 
        clear_bit(TTY_LDISC, &tty->flags);
-       clear_bit(TTY_DONT_FLIP, &tty->flags);
-       if (o_tty) {
+       if (o_tty)
                clear_bit(TTY_LDISC, &o_tty->flags);
-               clear_bit(TTY_DONT_FLIP, &o_tty->flags);
-       }
        spin_unlock_irqrestore(&tty_ldisc_lock, flags);
 
        /*
@@ -1955,7 +1952,6 @@ static void release_dev(struct file * filp)
         * race with the set_ldisc code path.
         */
        clear_bit(TTY_LDISC, &tty->flags);
-       clear_bit(TTY_DONT_FLIP, &tty->flags);
        cancel_delayed_work(&tty->buf.work);
 
        /*
@@ -2784,13 +2780,6 @@ static void flush_to_ldisc(void *private_)
        if (disc == NULL)       /*  !TTY_LDISC */
                return;
 
-       if (test_bit(TTY_DONT_FLIP, &tty->flags)) {
-               /*
-                * Do it after the next timer tick:
-                */
-               schedule_delayed_work(&tty->buf.work, 1);
-               goto out;
-       }
        spin_lock_irqsave(&tty->buf.lock, flags);
        while((tbuf = tty->buf.head) != NULL) {
                while ((count = tbuf->commit - tbuf->read) != 0) {
@@ -2809,7 +2798,7 @@ static void flush_to_ldisc(void *private_)
                tty_buffer_free(tty, tbuf);
        }
        spin_unlock_irqrestore(&tty->buf.lock, flags);
-out:
+
        tty_ldisc_deref(disc);
 }
 
index 89700141f87e0d41b462ce6881a9f0a775d98549..5cacc5e74a9246e1982150027b95e96b4dbbd9c6 100644 (file)
@@ -2573,12 +2573,6 @@ static void flush_to_flip_buffer(struct e100_serial *info)
 
        DFLIP(
          if (1) {
-
-                 if (test_bit(TTY_DONT_FLIP, &tty->flags)) {
-                         DEBUG_LOG(info->line, "*** TTY_DONT_FLIP set flip.count %i ***\n", tty->flip.count);
-                         DEBUG_LOG(info->line, "*** recv_cnt %i\n", info->recv_cnt);
-                 } else {
-                 }
                  DEBUG_LOG(info->line, "*** rxtot %i\n", info->icount.rx);
                  DEBUG_LOG(info->line, "ldisc %lu\n", tty->ldisc.chars_in_buffer(tty));
                  DEBUG_LOG(info->line, "room  %lu\n", tty->ldisc.receive_room(tty));
index 7d823705193cfd55cebe2323b95d8edbf5d44c62..f8262e6ad8d3c3fc9728e621248c2d54f70bf2e5 100644 (file)
@@ -588,13 +588,6 @@ void jsm_input(struct jsm_channel *ch)
        len = min(len, (N_TTY_BUF_SIZE - 1) - tp->read_cnt);
        ld = tty_ldisc_ref(tp);
 
-       /*
-        * If the DONT_FLIP flag is on, don't flush our buffer, and act
-        * like the ld doesn't have any space to put the data right now.
-        */
-       if (test_bit(TTY_DONT_FLIP, &tp->flags))
-               len = 0;
-
        /*
         * If we were unable to get a reference to the ld,
         * don't flush our buffer, and act like the ld doesn't
index 9432c73022758435fd9dbfaf1c374aee31079bbf..d7f3f736a6928fc760d2159e1562132935584e40 100644 (file)
@@ -453,8 +453,7 @@ static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
                        tty = port->tty;
 
                        /*
-                        *      FIXME: must not do this in IRQ context,
-                        *      must honour TTY_DONT_FLIP
+                        *      FIXME: must not do this in IRQ context
                         */
                        tty->ldisc.receive_buf(
                                tty,
index cb35ca50a0a66feffff3a63b598634efc9f1f027..341cc4552c009260a2346371991ed7baedc77a63 100644 (file)
@@ -259,7 +259,6 @@ struct tty_struct {
 #define TTY_DO_WRITE_WAKEUP    5       /* Call write_wakeup after queuing new */
 #define TTY_PUSH               6       /* n_tty private */
 #define TTY_CLOSING            7       /* ->close() in progress */
-#define TTY_DONT_FLIP          8       /* Defer buffer flip */
 #define TTY_LDISC              9       /* Line discipline attached */
 #define TTY_HW_COOK_OUT        14      /* Hardware can do output cooking */
 #define TTY_HW_COOK_IN                 15      /* Hardware can do input cooking */
index 74368f79ee5d084e0645c6af221062567f475e47..b81fad893328663203c6be595df7de9f2895c4e4 100644 (file)
@@ -480,12 +480,8 @@ static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb)
 
        BT_DBG("dlc %p tty %p len %d", dlc, tty, skb->len);
 
-       if (test_bit(TTY_DONT_FLIP, &tty->flags)) {
-               tty_buffer_request_room(tty, skb->len);
-               tty_insert_flip_string(tty, skb->data, skb->len);
-               tty_flip_buffer_push(tty);
-       } else
-               tty->ldisc.receive_buf(tty, skb->data, NULL, skb->len);
+       tty_insert_flip_string(tty, skb->data, skb->len);
+       tty_flip_buffer_push(tty);
 
        kfree_skb(skb);
 }