X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fchar%2Fn_hdlc.c;h=82bcfb9c839adb62a4cca24c10c55c20c8c72cf4;hb=62ad36a8a6541de82984e4f1a6cff09535d68098;hp=9f54733f16236e9e5618c91967d1d1434ef824ef;hpb=ea9b395fe20ac74be788f415af2622ac8f0c35c7;p=linux-2.6 diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c index 9f54733f16..82bcfb9c83 100644 --- a/drivers/char/n_hdlc.c +++ b/drivers/char/n_hdlc.c @@ -81,7 +81,6 @@ #define HDLC_MAGIC 0x239e #define HDLC_VERSION "$Revision: 4.8 $" -#include #include #include #include @@ -230,7 +229,7 @@ static void n_hdlc_release(struct n_hdlc *n_hdlc) wake_up_interruptible (&tty->read_wait); wake_up_interruptible (&tty->write_wait); - if (tty != NULL && tty->disc_data == n_hdlc) + if (tty->disc_data == n_hdlc) tty->disc_data = NULL; /* Break the tty->n_hdlc link */ /* Release transmit and receive buffers */ @@ -401,7 +400,12 @@ static void n_hdlc_send_frames(struct n_hdlc *n_hdlc, struct tty_struct *tty) /* Send the next block of data to device */ tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); actual = tty->driver->write(tty, tbuf->buf, tbuf->count); - + + /* rollback was possible and has been done */ + if (actual == -ERESTARTSYS) { + n_hdlc->tbuf = tbuf; + break; + } /* if transmit error, throw frame away by */ /* pretending it was accepted by driver */ if (actual < 0) @@ -781,13 +785,14 @@ static unsigned int n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp, poll_wait(filp, &tty->write_wait, wait); /* set bits for operations that won't block */ - if(n_hdlc->rx_buf_list.head) + if (n_hdlc->rx_buf_list.head) mask |= POLLIN | POLLRDNORM; /* readable */ if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) mask |= POLLHUP; - if(tty_hung_up_p(filp)) + if (tty_hung_up_p(filp)) mask |= POLLHUP; - if(n_hdlc->tx_free_buf_list.head) + if (!tty_is_writelocked(tty) && + n_hdlc->tx_free_buf_list.head) mask |= POLLOUT | POLLWRNORM; /* writable */ } return mask; @@ -862,7 +867,7 @@ static void n_hdlc_buf_put(struct n_hdlc_buf_list *list, spin_lock_irqsave(&list->spinlock,flags); buf->link=NULL; - if(list->tail) + if (list->tail) list->tail->link = buf; else list->head = buf;