diff options
author | Felipe Balbi <balbi@ti.com> | 2011-03-21 06:25:08 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-04-22 20:31:53 -0400 |
commit | b1c43f82c5aa265442f82dba31ce985ebb7aa71c (patch) | |
tree | 8b344d8d5355b30e8deff901180edc708a653227 /drivers/net/ppp_async.c | |
parent | e9a470f445271eb157ee860a93b062324402fc3a (diff) |
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/ppp_async.c')
-rw-r--r-- | drivers/net/ppp_async.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index a1b82c9c67d2..53872d7d7382 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -340,7 +340,7 @@ ppp_asynctty_poll(struct tty_struct *tty, struct file *file, poll_table *wait) | |||
340 | } | 340 | } |
341 | 341 | ||
342 | /* May sleep, don't call from interrupt level or with interrupts disabled */ | 342 | /* May sleep, don't call from interrupt level or with interrupts disabled */ |
343 | static void | 343 | static unsigned int |
344 | ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, | 344 | ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, |
345 | char *cflags, int count) | 345 | char *cflags, int count) |
346 | { | 346 | { |
@@ -348,7 +348,7 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
348 | unsigned long flags; | 348 | unsigned long flags; |
349 | 349 | ||
350 | if (!ap) | 350 | if (!ap) |
351 | return; | 351 | return -ENODEV; |
352 | spin_lock_irqsave(&ap->recv_lock, flags); | 352 | spin_lock_irqsave(&ap->recv_lock, flags); |
353 | ppp_async_input(ap, buf, cflags, count); | 353 | ppp_async_input(ap, buf, cflags, count); |
354 | spin_unlock_irqrestore(&ap->recv_lock, flags); | 354 | spin_unlock_irqrestore(&ap->recv_lock, flags); |
@@ -356,6 +356,8 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
356 | tasklet_schedule(&ap->tsk); | 356 | tasklet_schedule(&ap->tsk); |
357 | ap_put(ap); | 357 | ap_put(ap); |
358 | tty_unthrottle(tty); | 358 | tty_unthrottle(tty); |
359 | |||
360 | return count; | ||
359 | } | 361 | } |
360 | 362 | ||
361 | static void | 363 | static void |