aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/dgrp/dgrp_net_ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/dgrp/dgrp_net_ops.c')
-rw-r--r--drivers/staging/dgrp/dgrp_net_ops.c73
1 files changed, 11 insertions, 62 deletions
diff --git a/drivers/staging/dgrp/dgrp_net_ops.c b/drivers/staging/dgrp/dgrp_net_ops.c
index c409cd03e8c1..2d1bbfd5b67c 100644
--- a/drivers/staging/dgrp/dgrp_net_ops.c
+++ b/drivers/staging/dgrp/dgrp_net_ops.c
@@ -151,20 +151,15 @@ static void dgrp_read_data_block(struct ch_struct *ch, u8 *flipbuf,
* Copys the rbuf to the flipbuf and sends to line discipline.
* Sends input buffer data to the line discipline.
*
- * There are several modes to consider here:
- * rawreadok, tty->real_raw, and IF_PARMRK
*/
static void dgrp_input(struct ch_struct *ch)
{
struct nd_struct *nd;
struct tty_struct *tty;
- int remain;
int data_len;
int len;
- int flip_len;
int tty_count;
ulong lock_flags;
- struct tty_ldisc *ld;
u8 *myflipbuf;
u8 *myflipflagbuf;
@@ -212,37 +207,11 @@ static void dgrp_input(struct ch_struct *ch)
spin_unlock_irqrestore(&nd->nd_lock, lock_flags);
- /* Decide how much data we can send into the tty layer */
- if (dgrp_rawreadok && tty->real_raw)
- flip_len = MYFLIPLEN;
- else
- flip_len = TTY_FLIPBUF_SIZE;
-
/* data_len should be the number of chars that we read in */
data_len = (ch->ch_rin - ch->ch_rout) & RBUF_MASK;
- remain = data_len;
/* len is the amount of data we are going to transfer here */
- len = min(data_len, flip_len);
-
- /* take into consideration length of ldisc */
- len = min(len, (N_TTY_BUF_SIZE - 1) - tty->read_cnt);
-
- ld = tty_ldisc_ref(tty);
-
- /*
- * If we were unable to get a reference to the ld,
- * don't flush our buffer, and act like the ld doesn't
- * have any space to put the data right now.
- */
- if (!ld) {
- len = 0;
- } else if (!ld->ops->receive_buf) {
- spin_lock_irqsave(&nd->nd_lock, lock_flags);
- ch->ch_rout = ch->ch_rin;
- spin_unlock_irqrestore(&nd->nd_lock, lock_flags);
- len = 0;
- }
+ len = tty_buffer_request_room(tty, data_len);
/* Check DPA flow control */
if ((nd->nd_dpa_debug) &&
@@ -254,42 +223,22 @@ static void dgrp_input(struct ch_struct *ch)
dgrp_read_data_block(ch, myflipbuf, len);
- /*
- * In high performance mode, we don't have to update
- * flag_buf or any of the counts or pointers into flip buf.
- */
- if (!dgrp_rawreadok || !tty->real_raw) {
- if (I_PARMRK(tty) || I_BRKINT(tty) || I_INPCK(tty))
- parity_scan(ch, myflipbuf, myflipflagbuf, &len);
- else
- memset(myflipflagbuf, TTY_NORMAL, len);
- }
+ if (I_PARMRK(tty) || I_BRKINT(tty) || I_INPCK(tty))
+ parity_scan(ch, myflipbuf, myflipflagbuf, &len);
+ else
+ memset(myflipflagbuf, TTY_NORMAL, len);
if ((nd->nd_dpa_debug) &&
(nd->nd_dpa_port == PORT_NUM(MINOR(tty_devnum(tty)))))
dgrp_dpa_data(nd, 1, myflipbuf, len);
- /*
- * If we're doing raw reads, jam it right into the
- * line disc bypassing the flip buffers.
- */
- if (dgrp_rawreadok && tty->real_raw)
- ld->ops->receive_buf(tty, myflipbuf, NULL, len);
- else {
- len = tty_buffer_request_room(tty, len);
- tty_insert_flip_string_flags(tty, myflipbuf,
- myflipflagbuf, len);
-
- /* Tell the tty layer its okay to "eat" the data now */
- tty_flip_buffer_push(tty);
- }
+ tty_insert_flip_string_flags(tty, myflipbuf,
+ myflipflagbuf, len);
+ tty_flip_buffer_push(tty);
ch->ch_rxcount += len;
}
- if (ld)
- tty_ldisc_deref(ld);
-
/*
* Wake up any sleepers (maybe dgrp close) that might be waiting
* for a channel flag state change.
@@ -2549,7 +2498,7 @@ data:
/*
* Fabricate and insert a data packet header to
- * preceed the remaining data when it comes in.
+ * preced the remaining data when it comes in.
*/
if (remain < plen) {
@@ -2718,7 +2667,7 @@ data:
}
/*
- * Handle delayed response arrival preceeding
+ * Handle delayed response arrival preceding
* the open response we are waiting for.
*/
@@ -3556,7 +3505,7 @@ void dgrp_poll_handler(unsigned long arg)
/*
* Decrement statistics. These are only for use with
* KME, so don't worry that the operations are done
- * unlocked, and so the results are occassionally wrong.
+ * unlocked, and so the results are occasionally wrong.
*/
nd->nd_read_count -= (nd->nd_read_count +