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/tty/n_r3964.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/tty/n_r3964.c')
-rw-r--r-- | drivers/tty/n_r3964.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c index 5c6c31459a2f..a4bc39c21a43 100644 --- a/drivers/tty/n_r3964.c +++ b/drivers/tty/n_r3964.c | |||
@@ -139,8 +139,8 @@ static int r3964_ioctl(struct tty_struct *tty, struct file *file, | |||
139 | static void r3964_set_termios(struct tty_struct *tty, struct ktermios *old); | 139 | static void r3964_set_termios(struct tty_struct *tty, struct ktermios *old); |
140 | static unsigned int r3964_poll(struct tty_struct *tty, struct file *file, | 140 | static unsigned int r3964_poll(struct tty_struct *tty, struct file *file, |
141 | struct poll_table_struct *wait); | 141 | struct poll_table_struct *wait); |
142 | static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp, | 142 | static unsigned int r3964_receive_buf(struct tty_struct *tty, |
143 | char *fp, int count); | 143 | const unsigned char *cp, char *fp, int count); |
144 | 144 | ||
145 | static struct tty_ldisc_ops tty_ldisc_N_R3964 = { | 145 | static struct tty_ldisc_ops tty_ldisc_N_R3964 = { |
146 | .owner = THIS_MODULE, | 146 | .owner = THIS_MODULE, |
@@ -1239,8 +1239,8 @@ static unsigned int r3964_poll(struct tty_struct *tty, struct file *file, | |||
1239 | return result; | 1239 | return result; |
1240 | } | 1240 | } |
1241 | 1241 | ||
1242 | static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp, | 1242 | static unsigned int r3964_receive_buf(struct tty_struct *tty, |
1243 | char *fp, int count) | 1243 | const unsigned char *cp, char *fp, int count) |
1244 | { | 1244 | { |
1245 | struct r3964_info *pInfo = tty->disc_data; | 1245 | struct r3964_info *pInfo = tty->disc_data; |
1246 | const unsigned char *p; | 1246 | const unsigned char *p; |
@@ -1257,6 +1257,8 @@ static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp, | |||
1257 | } | 1257 | } |
1258 | 1258 | ||
1259 | } | 1259 | } |
1260 | |||
1261 | return count; | ||
1260 | } | 1262 | } |
1261 | 1263 | ||
1262 | MODULE_LICENSE("GPL"); | 1264 | MODULE_LICENSE("GPL"); |