diff options
author | Felipe Balbi <balbi@ti.com> | 2011-03-21 12:25:08 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-04-22 17:31:53 -0700 |
commit | b1c43f82c5aa265442f82dba31ce985ebb7aa71c (patch) | |
tree | 8b344d8d5355b30e8deff901180edc708a653227 /drivers/net/wan | |
parent | e9a470f445271eb157ee860a93b062324402fc3a (diff) | |
download | linux-stable-b1c43f82c5aa265442f82dba31ce985ebb7aa71c.tar.gz linux-stable-b1c43f82c5aa265442f82dba31ce985ebb7aa71c.tar.bz2 linux-stable-b1c43f82c5aa265442f82dba31ce985ebb7aa71c.zip |
tty: make receive_buf() return the amout of bytes received
it makes it simpler to keep track of the amount of
bytes received and simplifies how flush_to_ldisc counts
the remaining bytes. It also fixes a bug of lost bytes
on n_tty when flushing too many bytes via the USB
serial gadget driver.
Tested-by: Stefan Bigler <stefan.bigler@keymile.com>
Tested-by: Toby Gray <toby.gray@realvnc.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/net/wan')
-rw-r--r-- | drivers/net/wan/x25_asy.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index 24297b274cd4..40398bf7d036 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c @@ -517,17 +517,18 @@ static int x25_asy_close(struct net_device *dev) * and sent on to some IP layer for further processing. */ -static void x25_asy_receive_buf(struct tty_struct *tty, +static unsigned int x25_asy_receive_buf(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) { struct x25_asy *sl = tty->disc_data; + int bytes = count; if (!sl || sl->magic != X25_ASY_MAGIC || !netif_running(sl->dev)) return; /* Read the characters out of the buffer */ - while (count--) { + while (bytes--) { if (fp && *fp++) { if (!test_and_set_bit(SLF_ERROR, &sl->flags)) sl->dev->stats.rx_errors++; @@ -536,6 +537,8 @@ static void x25_asy_receive_buf(struct tty_struct *tty, } x25_asy_unesc(sl, *cp++); } + + return count; } /* |