aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/epca.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/epca.c')
-rw-r--r--drivers/char/epca.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index 407708a001e4..765c5c108bf4 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -1786,9 +1786,7 @@ static void doevent(int crd)
1786 if (tty) { /* Begin if valid tty */ 1786 if (tty) { /* Begin if valid tty */
1787 if (event & BREAK_IND) { /* Begin if BREAK_IND */ 1787 if (event & BREAK_IND) { /* Begin if BREAK_IND */
1788 /* A break has been indicated */ 1788 /* A break has been indicated */
1789 tty->flip.count++; 1789 tty_insert_flip_char(tty, 0, TTY_BREAK);
1790 *tty->flip.flag_buf_ptr++ = TTY_BREAK;
1791 *tty->flip.char_buf_ptr++ = 0;
1792 tty_schedule_flip(tty); 1790 tty_schedule_flip(tty);
1793 } else if (event & LOWTX_IND) { /* Begin LOWTX_IND */ 1791 } else if (event & LOWTX_IND) { /* Begin LOWTX_IND */
1794 if (ch->statusflags & LOWWAIT) 1792 if (ch->statusflags & LOWWAIT)
@@ -2124,7 +2122,6 @@ static void receive_data(struct channel *ch)
2124 int dataToRead, wrapgap, bytesAvailable; 2122 int dataToRead, wrapgap, bytesAvailable;
2125 unsigned int tail, head; 2123 unsigned int tail, head;
2126 unsigned int wrapmask; 2124 unsigned int wrapmask;
2127 int rc;
2128 2125
2129 /* --------------------------------------------------------------- 2126 /* ---------------------------------------------------------------
2130 This routine is called by doint when a receive data event 2127 This routine is called by doint when a receive data event
@@ -2162,16 +2159,15 @@ static void receive_data(struct channel *ch)
2162 return; 2159 return;
2163 } 2160 }
2164 2161
2165 if (tty->flip.count == TTY_FLIPBUF_SIZE) 2162 if (tty_buffer_request_room(tty, bytesAvailable + 1) == 0)
2166 return; 2163 return;
2167 2164
2168 if (readb(&bc->orun)) { 2165 if (readb(&bc->orun)) {
2169 writeb(0, &bc->orun); 2166 writeb(0, &bc->orun);
2170 printk(KERN_WARNING "epca; overrun! DigiBoard device %s\n",tty->name); 2167 printk(KERN_WARNING "epca; overrun! DigiBoard device %s\n",tty->name);
2168 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
2171 } 2169 }
2172 rxwinon(ch); 2170 rxwinon(ch);
2173 rptr = tty->flip.char_buf_ptr;
2174 rc = tty->flip.count;
2175 while (bytesAvailable > 0) { /* Begin while there is data on the card */ 2171 while (bytesAvailable > 0) { /* Begin while there is data on the card */
2176 wrapgap = (head >= tail) ? head - tail : ch->rxbufsize - tail; 2172 wrapgap = (head >= tail) ? head - tail : ch->rxbufsize - tail;
2177 /* --------------------------------------------------------------- 2173 /* ---------------------------------------------------------------
@@ -2183,8 +2179,7 @@ static void receive_data(struct channel *ch)
2183 /* -------------------------------------------------------------- 2179 /* --------------------------------------------------------------
2184 Make sure we don't overflow the buffer 2180 Make sure we don't overflow the buffer
2185 ----------------------------------------------------------------- */ 2181 ----------------------------------------------------------------- */
2186 if ((rc + dataToRead) > TTY_FLIPBUF_SIZE) 2182 dataToRead = tty_prepare_flip_string(tty, &rptr, dataToRead);
2187 dataToRead = TTY_FLIPBUF_SIZE - rc;
2188 if (dataToRead == 0) 2183 if (dataToRead == 0)
2189 break; 2184 break;
2190 /* --------------------------------------------------------------- 2185 /* ---------------------------------------------------------------
@@ -2192,13 +2187,9 @@ static void receive_data(struct channel *ch)
2192 for translation if necessary. 2187 for translation if necessary.
2193 ------------------------------------------------------------------ */ 2188 ------------------------------------------------------------------ */
2194 memcpy_fromio(rptr, ch->rxptr + tail, dataToRead); 2189 memcpy_fromio(rptr, ch->rxptr + tail, dataToRead);
2195 rc += dataToRead;
2196 rptr += dataToRead;
2197 tail = (tail + dataToRead) & wrapmask; 2190 tail = (tail + dataToRead) & wrapmask;
2198 bytesAvailable -= dataToRead; 2191 bytesAvailable -= dataToRead;
2199 } /* End while there is data on the card */ 2192 } /* End while there is data on the card */
2200 tty->flip.count = rc;
2201 tty->flip.char_buf_ptr = rptr;
2202 globalwinon(ch); 2193 globalwinon(ch);
2203 writew(tail, &bc->rout); 2194 writew(tail, &bc->rout);
2204 /* Must be called with global data */ 2195 /* Must be called with global data */