Here's the big tty/serial merge for .40
Some api cleanups, and driver updates, nothing really major. You will
get two conflicts when you merge this to your tree (one in the tty
Makefile and one in the bluetooth driver), but they should be "obvious"
as to what to do. If you want me to do the merge, just let me know and
I will.
Please pull from:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/tty-2.6.git/ tty-next
All of these patches have been in the -mm and -next trees for a while.
Patches will be sent to the linux-serial mailing list, if anyone wants
to see them.
thanks,
greg k-h
------------
Documentation/pti/pti_intel_mid.txt | 99 +++
drivers/bluetooth/hci_ldisc.c | 10 +-
drivers/input/serio/serport.c | 10 +-
drivers/isdn/gigaset/ser-gigaset.c | 8 +-
drivers/misc/Kconfig | 25 +-
drivers/misc/Makefile | 1 +
drivers/misc/pch_phub.c | 153 +++-
drivers/misc/pti.c | 980 +++++++++++++++++++++++
drivers/misc/ti-st/st_core.c | 6 +-
drivers/net/caif/caif_serial.c | 6 +-
drivers/net/can/slcan.c | 9 +-
drivers/net/hamradio/6pack.c | 8 +-
drivers/net/hamradio/mkiss.c | 11 +-
drivers/net/irda/irtty-sir.c | 16 +-
drivers/net/ppp_async.c | 6 +-
drivers/net/ppp_synctty.c | 6 +-
drivers/net/slip.c | 11 +-
drivers/net/wan/x25_asy.c | 7 +-
drivers/parport/parport_pc.c | 2 +-
drivers/tty/Kconfig | 31 +
drivers/tty/Makefile | 2 +
drivers/tty/amiserial.c | 2 -
drivers/tty/cyclades.c | 5 +-
drivers/tty/ipwireless/Makefile | 2 -
drivers/tty/moxa.c | 18 +-
drivers/tty/n_gsm.c | 41 +-
drivers/tty/n_hdlc.c | 18 +-
drivers/tty/n_r3964.c | 10 +-
drivers/tty/n_tracerouter.c | 243 ++++++
drivers/tty/n_tracesink.c | 238 ++++++
drivers/tty/n_tracesink.h | 36 +
drivers/tty/n_tty.c | 61 +--
drivers/tty/nozomi.c | 29 +-
drivers/tty/pty.c | 35 +-
drivers/tty/rocket.c | 47 --
drivers/tty/serial/21285.c | 2 -
drivers/tty/serial/8250.c | 44 +-
drivers/tty/serial/8250.h | 3 +-
drivers/tty/serial/8250_accent.c | 2 -
drivers/tty/serial/8250_boca.c | 2 -
drivers/tty/serial/8250_exar_st16c554.c | 2 -
drivers/tty/serial/8250_fourport.c | 2 -
drivers/tty/serial/8250_hub6.c | 2 -
drivers/tty/serial/8250_mca.c | 2 -
drivers/tty/serial/8250_pci.c | 53 ++-
drivers/tty/serial/8250_pnp.c | 2 -
drivers/tty/serial/Kconfig | 27 +-
drivers/tty/serial/Makefile | 1 +
drivers/tty/serial/altera_uart.c | 26 +-
drivers/tty/serial/amba-pl010.c | 2 -
drivers/tty/serial/amba-pl011.c | 2 -
drivers/tty/serial/atmel_serial.c | 2 -
drivers/tty/serial/clps711x.c | 2 -
drivers/tty/serial/cpm_uart/cpm_uart.h | 2 -
drivers/tty/serial/cpm_uart/cpm_uart_core.c | 2 -
drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c | 2 -
drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h | 2 -
drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c | 2 -
drivers/tty/serial/cpm_uart/cpm_uart_cpm2.h | 2 -
drivers/tty/serial/ifx6x60.c | 2 -
drivers/tty/serial/imx.c | 2 -
drivers/tty/serial/msm_serial.c | 2 +-
drivers/tty/serial/msm_serial.h | 2 -
drivers/tty/serial/msm_smd_tty.c | 3 +-
drivers/tty/serial/netx-serial.c | 2 -
drivers/tty/serial/pch_uart.c | 8 +
drivers/tty/serial/pmac_zilog.c | 2 -
drivers/tty/serial/pxa.c | 2 -
drivers/tty/serial/s3c2400.c | 3 +-
drivers/tty/serial/s3c2410.c | 3 +-
drivers/tty/serial/s3c2412.c | 3 +-
drivers/tty/serial/s3c2440.c | 3 +-
drivers/tty/serial/s3c24a0.c | 3 +-
drivers/tty/serial/s3c6400.c | 3 +-
drivers/tty/serial/s5pv210.c | 3 +-
drivers/tty/serial/sa1100.c | 2 -
drivers/tty/serial/samsung.c | 3 +-
drivers/tty/serial/samsung.h | 3 +-
drivers/tty/serial/sb1250-duart.c | 2 -
drivers/tty/serial/serial_core.c | 90 +--
drivers/tty/serial/serial_ks8695.c | 2 -
drivers/tty/serial/serial_txx9.c | 2 -
drivers/tty/serial/sh-sci.c | 2 -
drivers/tty/serial/vt8500_serial.c | 2 -
drivers/tty/serial/xilinx_uartps.c | 1113 +++++++++++++++++++++++++++
drivers/tty/synclink.c | 2 -
drivers/tty/tty_buffer.c | 15 +-
drivers/tty/tty_io.c | 53 +-
drivers/tty/tty_ioctl.c | 2 -
drivers/tty/tty_ldisc.c | 13 +
drivers/tty/tty_mutex.c | 3 -
drivers/tty/vt/keyboard.c | 2 -
drivers/tty/vt/selection.c | 5 +-
drivers/tty/vt/vc_screen.c | 2 -
drivers/tty/vt/vt.c | 13 +-
drivers/tty/vt/vt_ioctl.c | 25 +-
fs/exec.c | 1 +
include/linux/pti.h | 42 +
include/linux/serial_core.h | 6 +-
include/linux/serial_reg.h | 2 +
include/linux/tty.h | 4 +
include/linux/tty_ldisc.h | 9 +-
sound/soc/codecs/cx20442.c | 8 +-
103 files changed, 3344 insertions(+), 512 deletions(-)
create mode 100644 Documentation/pti/pti_intel_mid.txt
create mode 100644 drivers/misc/pti.c
create mode 100644 drivers/tty/n_tracerouter.c
create mode 100644 drivers/tty/n_tracesink.c
create mode 100644 drivers/tty/n_tracesink.h
create mode 100644 drivers/tty/serial/xilinx_uartps.c
create mode 100644 include/linux/pti.h
---------------
Alan Cox (1):
parport: Use request_muxed_region for IT87 probe and lock
Andrew Morton (1):
drivers/tty/vt/vt_ioctl.c: repair insane ?: expression
Antony Pavlov (1):
serial: 8250_pci: add support for Cronyx Omega PCI multiserial board.
Arthur Taylor (1):
vt: Add K_OFF return value to vt_ioctl KDGKBMODE
Felipe Balbi (1):
tty: make receive_buf() return the amout of bytes received
Govindraj.R (1):
Serial: Remove unused code.
Herton Ronaldo Krzesinski (1):
vt: remove uneeded retval check before tty->ops->open inside tty_open
J Freyensee (4):
export kernel call get_task_comm().
Kernel documentation for the PTI feature.
Intel PTI implementaiton of MIPI 1149.7.
n_tracerouter and n_tracesink ldisc additions.
Jesper Juhl (1):
Serial: ifx6x60c: Remove duplicate includes of linux/tty.h
Jiri Slaby (23):
tty: VT, remove unused variable
TTY: serial_core, remove unused variable
Char: cyclades, fix unused variable
TTY: VT, remove unused variables
Char: moxa, remove unused variables
TTY: rocket, remove unused variables
TTY: unify tty_init_dev fail path handling
TTY: unify pty_install fail path handling
TTY: unify pty_unix98_install fail path handling
TTY: introduce deinit helpers for proper ldisc shutdown
TTY: plug in deinitialize_tty_struct
TTY: fix fail path in tty_open
Char: moxa, do not touch NORMAL_ACTIVE bit
serial: core, move termios handling to uart_startup
serial: core, do not set DTR/RTS twice on startup
serial: core, remove uart_update_termios
Char: nozomi, use GFP_KERNEL for kfifo allocation
Char: nozomi, remove port.count checks
Char: nozomi, remove useless tty_sem
Char: moxa, fix locking in moxa_write
TTY: serial_core, remove invalid test
TTY: serial_core, remove superfluous set_task_state
TTY: tty_io, annotate locking functions
Joe Perches (1):
n_gsm: Use print_hex_dump_bytes
John Linn (1):
tty/serial: add support for Xilinx PS UART
Jovi Zhang (1):
tty: remove invalid location line in file header
Julia Lawall (1):
drivers/tty/moxa.c: Put correct tty value
Kukjin Kim (1):
tty: Remove to support serial for S5P6442
Mark Brown (1):
ASoC: Update cx20442 for TTY API change
Petr Písař (1):
tty: Clean console safely
Scott Kilau (1):
8250_pci: Add support for the Digi/IBM PCIe 2-port Adapter
Stephen Warren (2):
tty/serial: Add explicit PORT_TEGRA type
tty/serial: Fix break handling for PORT_TEGRA
Tobias Klauser (1):
serial: altera_uart: Scan for a free port if platform device id is -1
Tomoya MORINAGA (2):
pch_uart: Support new device ML7223 IOH
pch_phub: Support new device ML7223
On Mon, May 23, 2011 at 12:05 PM, Greg KH <[email protected]> wrote:
>
> Some api cleanups, and driver updates, nothing really major. ?You will
> get two conflicts when you merge this to your tree (one in the tty
> Makefile and one in the bluetooth driver), but they should be "obvious"
> as to what to do.
I went a bit beyond "obvious", and actually fixed in the merge what
looked to be some missed things:
- the hci_uart_tty_receive "Return value" comment was stale
- it really looked to me like the 'stat.byte_rx' increment should use
the new 'received' count that we return.
So anybody who cares should probably check the end result.
Linus
On Mon, May 23, 2011 at 12:27:35PM -0700, Linus Torvalds wrote:
> On Mon, May 23, 2011 at 12:05 PM, Greg KH <[email protected]> wrote:
> >
> > Some api cleanups, and driver updates, nothing really major. ?You will
> > get two conflicts when you merge this to your tree (one in the tty
> > Makefile and one in the bluetooth driver), but they should be "obvious"
> > as to what to do.
>
> I went a bit beyond "obvious", and actually fixed in the merge what
> looked to be some missed things:
>
> - the hci_uart_tty_receive "Return value" comment was stale
>
> - it really looked to me like the 'stat.byte_rx' increment should use
> the new 'received' count that we return.
>
> So anybody who cares should probably check the end result.
It looks correct to me, thanks for catching this and doing the merge.
greg k-h
On Mon, 23 May 2011, Greg KH wrote:
> Here's the big tty/serial merge for .40
/me confused: this patch
> Felipe Balbi (1):
> tty: make receive_buf() return the amout of bytes received
is more than one year old, which I wouldn't care about, if it didn't
introduce a regression on my mackerel
(arch/arm/mach-shmobile/board-mackerel.c) board. With it in place printing
a lot of text over ssh pauses the output multiple times for several
seconds. With this patch reverted the behaviour is back to normal. To
reproduce one can either cat a few largish files under /etc or just dmesg
- if there have been enough messages accumulated.
Thanks
Guennadi
>
> Some api cleanups, and driver updates, nothing really major. You will
> get two conflicts when you merge this to your tree (one in the tty
> Makefile and one in the bluetooth driver), but they should be "obvious"
> as to what to do. If you want me to do the merge, just let me know and
> I will.
>
> Please pull from:
> master.kernel.org:/pub/scm/linux/kernel/git/gregkh/tty-2.6.git/ tty-next
>
> All of these patches have been in the -mm and -next trees for a while.
>
> Patches will be sent to the linux-serial mailing list, if anyone wants
> to see them.
>
> thanks,
>
> greg k-h
>
> ------------
>
> Documentation/pti/pti_intel_mid.txt | 99 +++
> drivers/bluetooth/hci_ldisc.c | 10 +-
> drivers/input/serio/serport.c | 10 +-
> drivers/isdn/gigaset/ser-gigaset.c | 8 +-
> drivers/misc/Kconfig | 25 +-
> drivers/misc/Makefile | 1 +
> drivers/misc/pch_phub.c | 153 +++-
> drivers/misc/pti.c | 980 +++++++++++++++++++++++
> drivers/misc/ti-st/st_core.c | 6 +-
> drivers/net/caif/caif_serial.c | 6 +-
> drivers/net/can/slcan.c | 9 +-
> drivers/net/hamradio/6pack.c | 8 +-
> drivers/net/hamradio/mkiss.c | 11 +-
> drivers/net/irda/irtty-sir.c | 16 +-
> drivers/net/ppp_async.c | 6 +-
> drivers/net/ppp_synctty.c | 6 +-
> drivers/net/slip.c | 11 +-
> drivers/net/wan/x25_asy.c | 7 +-
> drivers/parport/parport_pc.c | 2 +-
> drivers/tty/Kconfig | 31 +
> drivers/tty/Makefile | 2 +
> drivers/tty/amiserial.c | 2 -
> drivers/tty/cyclades.c | 5 +-
> drivers/tty/ipwireless/Makefile | 2 -
> drivers/tty/moxa.c | 18 +-
> drivers/tty/n_gsm.c | 41 +-
> drivers/tty/n_hdlc.c | 18 +-
> drivers/tty/n_r3964.c | 10 +-
> drivers/tty/n_tracerouter.c | 243 ++++++
> drivers/tty/n_tracesink.c | 238 ++++++
> drivers/tty/n_tracesink.h | 36 +
> drivers/tty/n_tty.c | 61 +--
> drivers/tty/nozomi.c | 29 +-
> drivers/tty/pty.c | 35 +-
> drivers/tty/rocket.c | 47 --
> drivers/tty/serial/21285.c | 2 -
> drivers/tty/serial/8250.c | 44 +-
> drivers/tty/serial/8250.h | 3 +-
> drivers/tty/serial/8250_accent.c | 2 -
> drivers/tty/serial/8250_boca.c | 2 -
> drivers/tty/serial/8250_exar_st16c554.c | 2 -
> drivers/tty/serial/8250_fourport.c | 2 -
> drivers/tty/serial/8250_hub6.c | 2 -
> drivers/tty/serial/8250_mca.c | 2 -
> drivers/tty/serial/8250_pci.c | 53 ++-
> drivers/tty/serial/8250_pnp.c | 2 -
> drivers/tty/serial/Kconfig | 27 +-
> drivers/tty/serial/Makefile | 1 +
> drivers/tty/serial/altera_uart.c | 26 +-
> drivers/tty/serial/amba-pl010.c | 2 -
> drivers/tty/serial/amba-pl011.c | 2 -
> drivers/tty/serial/atmel_serial.c | 2 -
> drivers/tty/serial/clps711x.c | 2 -
> drivers/tty/serial/cpm_uart/cpm_uart.h | 2 -
> drivers/tty/serial/cpm_uart/cpm_uart_core.c | 2 -
> drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c | 2 -
> drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h | 2 -
> drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c | 2 -
> drivers/tty/serial/cpm_uart/cpm_uart_cpm2.h | 2 -
> drivers/tty/serial/ifx6x60.c | 2 -
> drivers/tty/serial/imx.c | 2 -
> drivers/tty/serial/msm_serial.c | 2 +-
> drivers/tty/serial/msm_serial.h | 2 -
> drivers/tty/serial/msm_smd_tty.c | 3 +-
> drivers/tty/serial/netx-serial.c | 2 -
> drivers/tty/serial/pch_uart.c | 8 +
> drivers/tty/serial/pmac_zilog.c | 2 -
> drivers/tty/serial/pxa.c | 2 -
> drivers/tty/serial/s3c2400.c | 3 +-
> drivers/tty/serial/s3c2410.c | 3 +-
> drivers/tty/serial/s3c2412.c | 3 +-
> drivers/tty/serial/s3c2440.c | 3 +-
> drivers/tty/serial/s3c24a0.c | 3 +-
> drivers/tty/serial/s3c6400.c | 3 +-
> drivers/tty/serial/s5pv210.c | 3 +-
> drivers/tty/serial/sa1100.c | 2 -
> drivers/tty/serial/samsung.c | 3 +-
> drivers/tty/serial/samsung.h | 3 +-
> drivers/tty/serial/sb1250-duart.c | 2 -
> drivers/tty/serial/serial_core.c | 90 +--
> drivers/tty/serial/serial_ks8695.c | 2 -
> drivers/tty/serial/serial_txx9.c | 2 -
> drivers/tty/serial/sh-sci.c | 2 -
> drivers/tty/serial/vt8500_serial.c | 2 -
> drivers/tty/serial/xilinx_uartps.c | 1113 +++++++++++++++++++++++++++
> drivers/tty/synclink.c | 2 -
> drivers/tty/tty_buffer.c | 15 +-
> drivers/tty/tty_io.c | 53 +-
> drivers/tty/tty_ioctl.c | 2 -
> drivers/tty/tty_ldisc.c | 13 +
> drivers/tty/tty_mutex.c | 3 -
> drivers/tty/vt/keyboard.c | 2 -
> drivers/tty/vt/selection.c | 5 +-
> drivers/tty/vt/vc_screen.c | 2 -
> drivers/tty/vt/vt.c | 13 +-
> drivers/tty/vt/vt_ioctl.c | 25 +-
> fs/exec.c | 1 +
> include/linux/pti.h | 42 +
> include/linux/serial_core.h | 6 +-
> include/linux/serial_reg.h | 2 +
> include/linux/tty.h | 4 +
> include/linux/tty_ldisc.h | 9 +-
> sound/soc/codecs/cx20442.c | 8 +-
> 103 files changed, 3344 insertions(+), 512 deletions(-)
> create mode 100644 Documentation/pti/pti_intel_mid.txt
> create mode 100644 drivers/misc/pti.c
> create mode 100644 drivers/tty/n_tracerouter.c
> create mode 100644 drivers/tty/n_tracesink.c
> create mode 100644 drivers/tty/n_tracesink.h
> create mode 100644 drivers/tty/serial/xilinx_uartps.c
> create mode 100644 include/linux/pti.h
>
> ---------------
>
> Alan Cox (1):
> parport: Use request_muxed_region for IT87 probe and lock
>
> Andrew Morton (1):
> drivers/tty/vt/vt_ioctl.c: repair insane ?: expression
>
> Antony Pavlov (1):
> serial: 8250_pci: add support for Cronyx Omega PCI multiserial board.
>
> Arthur Taylor (1):
> vt: Add K_OFF return value to vt_ioctl KDGKBMODE
>
> Felipe Balbi (1):
> tty: make receive_buf() return the amout of bytes received
>
> Govindraj.R (1):
> Serial: Remove unused code.
>
> Herton Ronaldo Krzesinski (1):
> vt: remove uneeded retval check before tty->ops->open inside tty_open
>
> J Freyensee (4):
> export kernel call get_task_comm().
> Kernel documentation for the PTI feature.
> Intel PTI implementaiton of MIPI 1149.7.
> n_tracerouter and n_tracesink ldisc additions.
>
> Jesper Juhl (1):
> Serial: ifx6x60c: Remove duplicate includes of linux/tty.h
>
> Jiri Slaby (23):
> tty: VT, remove unused variable
> TTY: serial_core, remove unused variable
> Char: cyclades, fix unused variable
> TTY: VT, remove unused variables
> Char: moxa, remove unused variables
> TTY: rocket, remove unused variables
> TTY: unify tty_init_dev fail path handling
> TTY: unify pty_install fail path handling
> TTY: unify pty_unix98_install fail path handling
> TTY: introduce deinit helpers for proper ldisc shutdown
> TTY: plug in deinitialize_tty_struct
> TTY: fix fail path in tty_open
> Char: moxa, do not touch NORMAL_ACTIVE bit
> serial: core, move termios handling to uart_startup
> serial: core, do not set DTR/RTS twice on startup
> serial: core, remove uart_update_termios
> Char: nozomi, use GFP_KERNEL for kfifo allocation
> Char: nozomi, remove port.count checks
> Char: nozomi, remove useless tty_sem
> Char: moxa, fix locking in moxa_write
> TTY: serial_core, remove invalid test
> TTY: serial_core, remove superfluous set_task_state
> TTY: tty_io, annotate locking functions
>
> Joe Perches (1):
> n_gsm: Use print_hex_dump_bytes
>
> John Linn (1):
> tty/serial: add support for Xilinx PS UART
>
> Jovi Zhang (1):
> tty: remove invalid location line in file header
>
> Julia Lawall (1):
> drivers/tty/moxa.c: Put correct tty value
>
> Kukjin Kim (1):
> tty: Remove to support serial for S5P6442
>
> Mark Brown (1):
> ASoC: Update cx20442 for TTY API change
>
> Petr Písař (1):
> tty: Clean console safely
>
> Scott Kilau (1):
> 8250_pci: Add support for the Digi/IBM PCIe 2-port Adapter
>
> Stephen Warren (2):
> tty/serial: Add explicit PORT_TEGRA type
> tty/serial: Fix break handling for PORT_TEGRA
>
> Tobias Klauser (1):
> serial: altera_uart: Scan for a free port if platform device id is -1
>
> Tomoya MORINAGA (2):
> pch_uart: Support new device ML7223 IOH
> pch_phub: Support new device ML7223
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
On Thu, May 26, 2011 at 12:54:29PM +0200, Guennadi Liakhovetski wrote:
> On Mon, 23 May 2011, Greg KH wrote:
>
> > Here's the big tty/serial merge for .40
>
> /me confused: this patch
>
> > Felipe Balbi (1):
> > tty: make receive_buf() return the amout of bytes received
>
> is more than one year old, which I wouldn't care about, if it didn't
> introduce a regression on my mackerel
> (arch/arm/mach-shmobile/board-mackerel.c) board. With it in place printing
> a lot of text over ssh pauses the output multiple times for several
> seconds. With this patch reverted the behaviour is back to normal. To
> reproduce one can either cat a few largish files under /etc or just dmesg
> - if there have been enough messages accumulated.
I think I'll be reverting this one.
thanks,
greg k-h
Am Freitag 27 Mai 2011, 03:00:21 schrieb Greg KH:
> > > Here's the big tty/serial merge for .40
> >
> > /me confused: this patch
> >
> > > Felipe Balbi (1):
> > > tty: make receive_buf() return the amout of bytes received
> >
> > is more than one year old, which I wouldn't care about, if it didn't
> > introduce a regression on my mackerel
> > (arch/arm/mach-shmobile/board-mackerel.c) board. With it in place
> > printing a lot of text over ssh pauses the output multiple times for
> > several seconds. With this patch reverted the behaviour is back to
> > normal. To reproduce one can either cat a few largish files under /etc
> > or just dmesg - if there have been enough messages accumulated.
>
> I think I'll be reverting this one.
Hi,
maybe that's related to receive_buf returning an unsigned int, which is
obviously incompatible with -ENODEV, -EINVAL and the likes, which most of the
functions now return in case of error.
And unfortunately the return value is unfortunately not checked for errors
either - so the amount is totally screwed then ;)
See the examples in git
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=b1c43f82c5aa265442f82dba31ce985ebb7aa71c
I could create a patch if desired.
Thanks,
Peter
Am Dienstag 31 Mai 2011, 00:04:24 schrieb Peter H?we:
> Am Freitag 27 Mai 2011, 03:00:21 schrieb Greg KH:
> > > > Felipe Balbi (1):
> > > > tty: make receive_buf() return the amout of bytes received
> > I think I'll be reverting this one.
> maybe that's related to receive_buf returning an unsigned int, which is
> obviously incompatible with -ENODEV, -EINVAL and the likes, which most of
> the functions now return in case of error.
> And unfortunately the return value is unfortunately not checked for errors
> either - so the amount is totally screwed then ;)
>
> I could create a patch if desired.
@Guennadi:
Maybe you could try this patch?
I know it's far from perfect ;)
>From b73b6ad336a702f26a47f05fb60aeafb6044b029 Mon Sep 17 00:00:00 2001
From: Peter Huewe <[email protected]>
Date: Tue, 31 May 2011 00:31:01 +0200
Subject: [PATCH] tty: fix receive_buf return value for error handling
This patch converts the return value of the receive_buf callbacks from
unsigned int to int, thus enabling the use of negative values for error
handling.
Moreover checking the return code for receive_buf was added.
And while at it the receive_buf callback in drivers/net/wan/x25_asy.c was fixed.
(used to not return a value in case of error)
Signed-off-by: Peter Huewe <[email protected]>
---
Patch is against current Linus' git tree.
drivers/bluetooth/hci_ldisc.c | 2 +-
drivers/input/serio/serport.c | 2 +-
drivers/isdn/gigaset/ser-gigaset.c | 2 +-
drivers/misc/ti-st/st_core.c | 2 +-
drivers/net/caif/caif_serial.c | 2 +-
drivers/net/can/slcan.c | 2 +-
drivers/net/hamradio/6pack.c | 2 +-
drivers/net/hamradio/mkiss.c | 2 +-
drivers/net/irda/irtty-sir.c | 2 +-
drivers/net/ppp_async.c | 2 +-
drivers/net/ppp_synctty.c | 2 +-
drivers/net/slip.c | 2 +-
drivers/net/wan/x25_asy.c | 4 ++--
drivers/tty/n_gsm.c | 2 +-
drivers/tty/n_hdlc.c | 4 ++--
drivers/tty/n_r3964.c | 4 ++--
drivers/tty/n_tty.c | 2 +-
drivers/tty/tty_buffer.c | 3 +++
drivers/tty/vt/selection.c | 9 +++++++--
include/linux/tty_ldisc.h | 4 ++--
20 files changed, 32 insertions(+), 24 deletions(-)
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index b3f0199..d09b20d 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -357,7 +357,7 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty)
*
* Return Value: Number of bytes received
*/
-static unsigned int hci_uart_tty_receive(struct tty_struct *tty,
+static int hci_uart_tty_receive(struct tty_struct *tty,
const u8 *data, char *flags, int count)
{
struct hci_uart *hu = (void *)tty->disc_data;
diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c
index f369896..0f55699 100644
--- a/drivers/input/serio/serport.c
+++ b/drivers/input/serio/serport.c
@@ -120,7 +120,7 @@ static void serport_ldisc_close(struct tty_struct *tty)
* 'interrupt' routine.
*/
-static unsigned int serport_ldisc_receive(struct tty_struct *tty,
+static int serport_ldisc_receive(struct tty_struct *tty,
const unsigned char *cp, char *fp, int count)
{
struct serport *serport = (struct serport*) tty->disc_data;
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c
index 1d44d47..ed27f0f 100644
--- a/drivers/isdn/gigaset/ser-gigaset.c
+++ b/drivers/isdn/gigaset/ser-gigaset.c
@@ -674,7 +674,7 @@ gigaset_tty_ioctl(struct tty_struct *tty, struct file *file,
* cflags buffer containing error flags for received characters (ignored)
* count number of received characters
*/
-static unsigned int
+static int
gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf,
char *cflags, int count)
{
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c
index 1a05fe0..eb63cc3 100644
--- a/drivers/misc/ti-st/st_core.c
+++ b/drivers/misc/ti-st/st_core.c
@@ -747,7 +747,7 @@ static void st_tty_close(struct tty_struct *tty)
pr_debug("%s: done ", __func__);
}
-static unsigned int st_tty_receive(struct tty_struct *tty,
+static int st_tty_receive(struct tty_struct *tty,
const unsigned char *data, char *tty_flags, int count)
{
#ifdef VERBOSE
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c
index 73c7e03..51073b5 100644
--- a/drivers/net/caif/caif_serial.c
+++ b/drivers/net/caif/caif_serial.c
@@ -167,7 +167,7 @@ static inline void debugfs_tx(struct ser_device *ser, const u8 *data, int size)
#endif
-static unsigned int ldisc_receive(struct tty_struct *tty,
+static int ldisc_receive(struct tty_struct *tty,
const u8 *data, char *flags, int count)
{
struct sk_buff *skb = NULL;
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index 75622d5..89ccd90 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -425,7 +425,7 @@ static void slc_setup(struct net_device *dev)
* in parallel
*/
-static unsigned int slcan_receive_buf(struct tty_struct *tty,
+static int slcan_receive_buf(struct tty_struct *tty,
const unsigned char *cp, char *fp, int count)
{
struct slcan *sl = (struct slcan *) tty->disc_data;
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 9920896..cdd1fd8 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -456,7 +456,7 @@ out:
* a block of 6pack data has been received, which can now be decapsulated
* and sent on to some IP layer for further processing.
*/
-static unsigned int sixpack_receive_buf(struct tty_struct *tty,
+static int sixpack_receive_buf(struct tty_struct *tty,
const unsigned char *cp, char *fp, int count)
{
struct sixpack *sp;
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index 0e4f235..6a12b2d 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -923,7 +923,7 @@ static long mkiss_compat_ioctl(struct tty_struct *tty, struct file *file,
* a block of data has been received, which can now be decapsulated
* and sent on to the AX.25 layer for further processing.
*/
-static unsigned int mkiss_receive_buf(struct tty_struct *tty,
+static int mkiss_receive_buf(struct tty_struct *tty,
const unsigned char *cp, char *fp, int count)
{
struct mkiss *ax = mkiss_get(tty);
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
index 035861d..17d0dfa 100644
--- a/drivers/net/irda/irtty-sir.c
+++ b/drivers/net/irda/irtty-sir.c
@@ -216,7 +216,7 @@ static int irtty_do_write(struct sir_dev *dev, const unsigned char *ptr, size_t
* usbserial: urb-complete-interrupt / softint
*/
-static unsigned int irtty_receive_buf(struct tty_struct *tty,
+static int irtty_receive_buf(struct tty_struct *tty,
const unsigned char *cp, char *fp, int count)
{
struct sir_dev *dev;
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
index 53872d7..078ef8b 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)
}
/* May sleep, don't call from interrupt level or with interrupts disabled */
-static unsigned int
+static int
ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf,
char *cflags, int count)
{
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c
index 0815790..1a2dc65 100644
--- a/drivers/net/ppp_synctty.c
+++ b/drivers/net/ppp_synctty.c
@@ -381,7 +381,7 @@ ppp_sync_poll(struct tty_struct *tty, struct file *file, poll_table *wait)
}
/* May sleep, don't call from interrupt level or with interrupts disabled */
-static unsigned int
+static int
ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf,
char *cflags, int count)
{
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index 584809c..992dca7 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -670,7 +670,7 @@ static void sl_setup(struct net_device *dev)
* in parallel
*/
-static unsigned int slip_receive_buf(struct tty_struct *tty,
+static int slip_receive_buf(struct tty_struct *tty,
const unsigned char *cp, char *fp, int count)
{
struct slip *sl = tty->disc_data;
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
index 40398bf..33fa920 100644
--- a/drivers/net/wan/x25_asy.c
+++ b/drivers/net/wan/x25_asy.c
@@ -517,14 +517,14 @@ static int x25_asy_close(struct net_device *dev)
* and sent on to some IP layer for further processing.
*/
-static unsigned int x25_asy_receive_buf(struct tty_struct *tty,
+static 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;
+ return -ENODEV;
/* Read the characters out of the buffer */
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index a4c42a7..96ed3eb 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -2128,7 +2128,7 @@ static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)
gsm->tty = NULL;
}
-static unsigned int gsmld_receive_buf(struct tty_struct *tty,
+static int gsmld_receive_buf(struct tty_struct *tty,
const unsigned char *cp, char *fp, int count)
{
struct gsm_mux *gsm = tty->disc_data;
diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c
index cac6663..1c40879 100644
--- a/drivers/tty/n_hdlc.c
+++ b/drivers/tty/n_hdlc.c
@@ -188,7 +188,7 @@ static unsigned int n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp,
poll_table *wait);
static int n_hdlc_tty_open(struct tty_struct *tty);
static void n_hdlc_tty_close(struct tty_struct *tty);
-static unsigned int n_hdlc_tty_receive(struct tty_struct *tty,
+static int n_hdlc_tty_receive(struct tty_struct *tty,
const __u8 *cp, char *fp, int count);
static void n_hdlc_tty_wakeup(struct tty_struct *tty);
@@ -509,7 +509,7 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty)
* Called by tty low level driver when receive data is available. Data is
* interpreted as one HDLC frame.
*/
-static unsigned int n_hdlc_tty_receive(struct tty_struct *tty,
+static int n_hdlc_tty_receive(struct tty_struct *tty,
const __u8 *data, char *flags, int count)
{
register struct n_hdlc *n_hdlc = tty2n_hdlc (tty);
diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
index a4bc39c..43384b3 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
@@ -139,7 +139,7 @@ static int r3964_ioctl(struct tty_struct *tty, struct file *file,
static void r3964_set_termios(struct tty_struct *tty, struct ktermios *old);
static unsigned int r3964_poll(struct tty_struct *tty, struct file *file,
struct poll_table_struct *wait);
-static unsigned int r3964_receive_buf(struct tty_struct *tty,
+static int r3964_receive_buf(struct tty_struct *tty,
const unsigned char *cp, char *fp, int count);
static struct tty_ldisc_ops tty_ldisc_N_R3964 = {
@@ -1239,7 +1239,7 @@ static unsigned int r3964_poll(struct tty_struct *tty, struct file *file,
return result;
}
-static unsigned int r3964_receive_buf(struct tty_struct *tty,
+static int r3964_receive_buf(struct tty_struct *tty,
const unsigned char *cp, char *fp, int count)
{
struct r3964_info *pInfo = tty->disc_data;
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 95d0a9c..ced315a 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1327,7 +1327,7 @@ static void n_tty_write_wakeup(struct tty_struct *tty)
* calls one at a time and in order (or using flush_to_ldisc)
*/
-static unsigned int n_tty_receive_buf(struct tty_struct *tty,
+static int n_tty_receive_buf(struct tty_struct *tty,
const unsigned char *cp, char *fp, int count)
{
const unsigned char *p;
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 46de2e0..38d25f5 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -448,6 +448,9 @@ static void flush_to_ldisc(struct work_struct *work)
spin_unlock_irqrestore(&tty->buf.lock, flags);
copied = disc->ops->receive_buf(tty, char_buf,
flag_buf, count);
+ if (copied < 0)
+ break; //ERROR
+
spin_lock_irqsave(&tty->buf.lock, flags);
head->read += copied;
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
index 67b1d0d..67c7650 100644
--- a/drivers/tty/vt/selection.c
+++ b/drivers/tty/vt/selection.c
@@ -308,6 +308,7 @@ int paste_selection(struct tty_struct *tty)
int pasted = 0;
unsigned int count;
struct tty_ldisc *ld;
+ int retval = 0;
DECLARE_WAITQUEUE(wait, current);
/* always called with BTM from vt_ioctl */
@@ -331,14 +332,18 @@ int paste_selection(struct tty_struct *tty)
schedule();
continue;
}
- count = sel_buffer_lth - pasted;
+ count = sel_buffer_lth - pasted; // USELESS?
count = tty->ldisc->ops->receive_buf(tty, sel_buffer + pasted,
NULL, count);
+ if (count < 0) {
+ retval = count;
+ break;
+ }
pasted += count;
}
remove_wait_queue(&vc->paste_wait, &wait);
__set_current_state(TASK_RUNNING);
tty_ldisc_deref(ld);
- return 0;
+ return retval;
}
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 5b07792..e251028 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -76,7 +76,7 @@
* tty device. It is solely the responsibility of the line
* discipline to handle poll requests.
*
- * unsigned int (*receive_buf)(struct tty_struct *, const unsigned char *cp,
+ * int (*receive_buf)(struct tty_struct *, const unsigned char *cp,
* char *fp, int count);
*
* This function is called by the low-level tty driver to send
@@ -141,7 +141,7 @@ struct tty_ldisc_ops {
/*
* The following routines are called from below.
*/
- unsigned int (*receive_buf)(struct tty_struct *,
+ int (*receive_buf)(struct tty_struct *,
const unsigned char *cp, char *fp, int count);
void (*write_wakeup)(struct tty_struct *);
void (*dcd_change)(struct tty_struct *, unsigned int,
--
1.7.3.4
On Tue, 31 May 2011, Peter H?we wrote:
> Am Dienstag 31 Mai 2011, 00:04:24 schrieb Peter H?we:
> > Am Freitag 27 Mai 2011, 03:00:21 schrieb Greg KH:
> > > > > Felipe Balbi (1):
> > > > > tty: make receive_buf() return the amout of bytes received
> > > I think I'll be reverting this one.
> > maybe that's related to receive_buf returning an unsigned int, which is
> > obviously incompatible with -ENODEV, -EINVAL and the likes, which most of
> > the functions now return in case of error.
> > And unfortunately the return value is unfortunately not checked for errors
> > either - so the amount is totally screwed then ;)
> >
> > I could create a patch if desired.
>
> @Guennadi:
> Maybe you could try this patch?
Tested, doesn't help.
Thanks
Guennadi
> I know it's far from perfect ;)
>
> From b73b6ad336a702f26a47f05fb60aeafb6044b029 Mon Sep 17 00:00:00 2001
> From: Peter Huewe <[email protected]>
> Date: Tue, 31 May 2011 00:31:01 +0200
> Subject: [PATCH] tty: fix receive_buf return value for error handling
>
> This patch converts the return value of the receive_buf callbacks from
> unsigned int to int, thus enabling the use of negative values for error
> handling.
>
> Moreover checking the return code for receive_buf was added.
>
> And while at it the receive_buf callback in drivers/net/wan/x25_asy.c was fixed.
> (used to not return a value in case of error)
>
> Signed-off-by: Peter Huewe <[email protected]>
> ---
> Patch is against current Linus' git tree.
>
> drivers/bluetooth/hci_ldisc.c | 2 +-
> drivers/input/serio/serport.c | 2 +-
> drivers/isdn/gigaset/ser-gigaset.c | 2 +-
> drivers/misc/ti-st/st_core.c | 2 +-
> drivers/net/caif/caif_serial.c | 2 +-
> drivers/net/can/slcan.c | 2 +-
> drivers/net/hamradio/6pack.c | 2 +-
> drivers/net/hamradio/mkiss.c | 2 +-
> drivers/net/irda/irtty-sir.c | 2 +-
> drivers/net/ppp_async.c | 2 +-
> drivers/net/ppp_synctty.c | 2 +-
> drivers/net/slip.c | 2 +-
> drivers/net/wan/x25_asy.c | 4 ++--
> drivers/tty/n_gsm.c | 2 +-
> drivers/tty/n_hdlc.c | 4 ++--
> drivers/tty/n_r3964.c | 4 ++--
> drivers/tty/n_tty.c | 2 +-
> drivers/tty/tty_buffer.c | 3 +++
> drivers/tty/vt/selection.c | 9 +++++++--
> include/linux/tty_ldisc.h | 4 ++--
> 20 files changed, 32 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
> index b3f0199..d09b20d 100644
> --- a/drivers/bluetooth/hci_ldisc.c
> +++ b/drivers/bluetooth/hci_ldisc.c
> @@ -357,7 +357,7 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty)
> *
> * Return Value: Number of bytes received
> */
> -static unsigned int hci_uart_tty_receive(struct tty_struct *tty,
> +static int hci_uart_tty_receive(struct tty_struct *tty,
> const u8 *data, char *flags, int count)
> {
> struct hci_uart *hu = (void *)tty->disc_data;
> diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c
> index f369896..0f55699 100644
> --- a/drivers/input/serio/serport.c
> +++ b/drivers/input/serio/serport.c
> @@ -120,7 +120,7 @@ static void serport_ldisc_close(struct tty_struct *tty)
> * 'interrupt' routine.
> */
>
> -static unsigned int serport_ldisc_receive(struct tty_struct *tty,
> +static int serport_ldisc_receive(struct tty_struct *tty,
> const unsigned char *cp, char *fp, int count)
> {
> struct serport *serport = (struct serport*) tty->disc_data;
> diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c
> index 1d44d47..ed27f0f 100644
> --- a/drivers/isdn/gigaset/ser-gigaset.c
> +++ b/drivers/isdn/gigaset/ser-gigaset.c
> @@ -674,7 +674,7 @@ gigaset_tty_ioctl(struct tty_struct *tty, struct file *file,
> * cflags buffer containing error flags for received characters (ignored)
> * count number of received characters
> */
> -static unsigned int
> +static int
> gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf,
> char *cflags, int count)
> {
> diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c
> index 1a05fe0..eb63cc3 100644
> --- a/drivers/misc/ti-st/st_core.c
> +++ b/drivers/misc/ti-st/st_core.c
> @@ -747,7 +747,7 @@ static void st_tty_close(struct tty_struct *tty)
> pr_debug("%s: done ", __func__);
> }
>
> -static unsigned int st_tty_receive(struct tty_struct *tty,
> +static int st_tty_receive(struct tty_struct *tty,
> const unsigned char *data, char *tty_flags, int count)
> {
> #ifdef VERBOSE
> diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c
> index 73c7e03..51073b5 100644
> --- a/drivers/net/caif/caif_serial.c
> +++ b/drivers/net/caif/caif_serial.c
> @@ -167,7 +167,7 @@ static inline void debugfs_tx(struct ser_device *ser, const u8 *data, int size)
>
> #endif
>
> -static unsigned int ldisc_receive(struct tty_struct *tty,
> +static int ldisc_receive(struct tty_struct *tty,
> const u8 *data, char *flags, int count)
> {
> struct sk_buff *skb = NULL;
> diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
> index 75622d5..89ccd90 100644
> --- a/drivers/net/can/slcan.c
> +++ b/drivers/net/can/slcan.c
> @@ -425,7 +425,7 @@ static void slc_setup(struct net_device *dev)
> * in parallel
> */
>
> -static unsigned int slcan_receive_buf(struct tty_struct *tty,
> +static int slcan_receive_buf(struct tty_struct *tty,
> const unsigned char *cp, char *fp, int count)
> {
> struct slcan *sl = (struct slcan *) tty->disc_data;
> diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
> index 9920896..cdd1fd8 100644
> --- a/drivers/net/hamradio/6pack.c
> +++ b/drivers/net/hamradio/6pack.c
> @@ -456,7 +456,7 @@ out:
> * a block of 6pack data has been received, which can now be decapsulated
> * and sent on to some IP layer for further processing.
> */
> -static unsigned int sixpack_receive_buf(struct tty_struct *tty,
> +static int sixpack_receive_buf(struct tty_struct *tty,
> const unsigned char *cp, char *fp, int count)
> {
> struct sixpack *sp;
> diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
> index 0e4f235..6a12b2d 100644
> --- a/drivers/net/hamradio/mkiss.c
> +++ b/drivers/net/hamradio/mkiss.c
> @@ -923,7 +923,7 @@ static long mkiss_compat_ioctl(struct tty_struct *tty, struct file *file,
> * a block of data has been received, which can now be decapsulated
> * and sent on to the AX.25 layer for further processing.
> */
> -static unsigned int mkiss_receive_buf(struct tty_struct *tty,
> +static int mkiss_receive_buf(struct tty_struct *tty,
> const unsigned char *cp, char *fp, int count)
> {
> struct mkiss *ax = mkiss_get(tty);
> diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
> index 035861d..17d0dfa 100644
> --- a/drivers/net/irda/irtty-sir.c
> +++ b/drivers/net/irda/irtty-sir.c
> @@ -216,7 +216,7 @@ static int irtty_do_write(struct sir_dev *dev, const unsigned char *ptr, size_t
> * usbserial: urb-complete-interrupt / softint
> */
>
> -static unsigned int irtty_receive_buf(struct tty_struct *tty,
> +static int irtty_receive_buf(struct tty_struct *tty,
> const unsigned char *cp, char *fp, int count)
> {
> struct sir_dev *dev;
> diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
> index 53872d7..078ef8b 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)
> }
>
> /* May sleep, don't call from interrupt level or with interrupts disabled */
> -static unsigned int
> +static int
> ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf,
> char *cflags, int count)
> {
> diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c
> index 0815790..1a2dc65 100644
> --- a/drivers/net/ppp_synctty.c
> +++ b/drivers/net/ppp_synctty.c
> @@ -381,7 +381,7 @@ ppp_sync_poll(struct tty_struct *tty, struct file *file, poll_table *wait)
> }
>
> /* May sleep, don't call from interrupt level or with interrupts disabled */
> -static unsigned int
> +static int
> ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf,
> char *cflags, int count)
> {
> diff --git a/drivers/net/slip.c b/drivers/net/slip.c
> index 584809c..992dca7 100644
> --- a/drivers/net/slip.c
> +++ b/drivers/net/slip.c
> @@ -670,7 +670,7 @@ static void sl_setup(struct net_device *dev)
> * in parallel
> */
>
> -static unsigned int slip_receive_buf(struct tty_struct *tty,
> +static int slip_receive_buf(struct tty_struct *tty,
> const unsigned char *cp, char *fp, int count)
> {
> struct slip *sl = tty->disc_data;
> diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
> index 40398bf..33fa920 100644
> --- a/drivers/net/wan/x25_asy.c
> +++ b/drivers/net/wan/x25_asy.c
> @@ -517,14 +517,14 @@ static int x25_asy_close(struct net_device *dev)
> * and sent on to some IP layer for further processing.
> */
>
> -static unsigned int x25_asy_receive_buf(struct tty_struct *tty,
> +static 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;
> + return -ENODEV;
>
>
> /* Read the characters out of the buffer */
> diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
> index a4c42a7..96ed3eb 100644
> --- a/drivers/tty/n_gsm.c
> +++ b/drivers/tty/n_gsm.c
> @@ -2128,7 +2128,7 @@ static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)
> gsm->tty = NULL;
> }
>
> -static unsigned int gsmld_receive_buf(struct tty_struct *tty,
> +static int gsmld_receive_buf(struct tty_struct *tty,
> const unsigned char *cp, char *fp, int count)
> {
> struct gsm_mux *gsm = tty->disc_data;
> diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c
> index cac6663..1c40879 100644
> --- a/drivers/tty/n_hdlc.c
> +++ b/drivers/tty/n_hdlc.c
> @@ -188,7 +188,7 @@ static unsigned int n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp,
> poll_table *wait);
> static int n_hdlc_tty_open(struct tty_struct *tty);
> static void n_hdlc_tty_close(struct tty_struct *tty);
> -static unsigned int n_hdlc_tty_receive(struct tty_struct *tty,
> +static int n_hdlc_tty_receive(struct tty_struct *tty,
> const __u8 *cp, char *fp, int count);
> static void n_hdlc_tty_wakeup(struct tty_struct *tty);
>
> @@ -509,7 +509,7 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty)
> * Called by tty low level driver when receive data is available. Data is
> * interpreted as one HDLC frame.
> */
> -static unsigned int n_hdlc_tty_receive(struct tty_struct *tty,
> +static int n_hdlc_tty_receive(struct tty_struct *tty,
> const __u8 *data, char *flags, int count)
> {
> register struct n_hdlc *n_hdlc = tty2n_hdlc (tty);
> diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
> index a4bc39c..43384b3 100644
> --- a/drivers/tty/n_r3964.c
> +++ b/drivers/tty/n_r3964.c
> @@ -139,7 +139,7 @@ static int r3964_ioctl(struct tty_struct *tty, struct file *file,
> static void r3964_set_termios(struct tty_struct *tty, struct ktermios *old);
> static unsigned int r3964_poll(struct tty_struct *tty, struct file *file,
> struct poll_table_struct *wait);
> -static unsigned int r3964_receive_buf(struct tty_struct *tty,
> +static int r3964_receive_buf(struct tty_struct *tty,
> const unsigned char *cp, char *fp, int count);
>
> static struct tty_ldisc_ops tty_ldisc_N_R3964 = {
> @@ -1239,7 +1239,7 @@ static unsigned int r3964_poll(struct tty_struct *tty, struct file *file,
> return result;
> }
>
> -static unsigned int r3964_receive_buf(struct tty_struct *tty,
> +static int r3964_receive_buf(struct tty_struct *tty,
> const unsigned char *cp, char *fp, int count)
> {
> struct r3964_info *pInfo = tty->disc_data;
> diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
> index 95d0a9c..ced315a 100644
> --- a/drivers/tty/n_tty.c
> +++ b/drivers/tty/n_tty.c
> @@ -1327,7 +1327,7 @@ static void n_tty_write_wakeup(struct tty_struct *tty)
> * calls one at a time and in order (or using flush_to_ldisc)
> */
>
> -static unsigned int n_tty_receive_buf(struct tty_struct *tty,
> +static int n_tty_receive_buf(struct tty_struct *tty,
> const unsigned char *cp, char *fp, int count)
> {
> const unsigned char *p;
> diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
> index 46de2e0..38d25f5 100644
> --- a/drivers/tty/tty_buffer.c
> +++ b/drivers/tty/tty_buffer.c
> @@ -448,6 +448,9 @@ static void flush_to_ldisc(struct work_struct *work)
> spin_unlock_irqrestore(&tty->buf.lock, flags);
> copied = disc->ops->receive_buf(tty, char_buf,
> flag_buf, count);
> + if (copied < 0)
> + break; //ERROR
> +
> spin_lock_irqsave(&tty->buf.lock, flags);
>
> head->read += copied;
> diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
> index 67b1d0d..67c7650 100644
> --- a/drivers/tty/vt/selection.c
> +++ b/drivers/tty/vt/selection.c
> @@ -308,6 +308,7 @@ int paste_selection(struct tty_struct *tty)
> int pasted = 0;
> unsigned int count;
> struct tty_ldisc *ld;
> + int retval = 0;
> DECLARE_WAITQUEUE(wait, current);
>
> /* always called with BTM from vt_ioctl */
> @@ -331,14 +332,18 @@ int paste_selection(struct tty_struct *tty)
> schedule();
> continue;
> }
> - count = sel_buffer_lth - pasted;
> + count = sel_buffer_lth - pasted; // USELESS?
> count = tty->ldisc->ops->receive_buf(tty, sel_buffer + pasted,
> NULL, count);
> + if (count < 0) {
> + retval = count;
> + break;
> + }
> pasted += count;
> }
> remove_wait_queue(&vc->paste_wait, &wait);
> __set_current_state(TASK_RUNNING);
>
> tty_ldisc_deref(ld);
> - return 0;
> + return retval;
> }
> diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
> index 5b07792..e251028 100644
> --- a/include/linux/tty_ldisc.h
> +++ b/include/linux/tty_ldisc.h
> @@ -76,7 +76,7 @@
> * tty device. It is solely the responsibility of the line
> * discipline to handle poll requests.
> *
> - * unsigned int (*receive_buf)(struct tty_struct *, const unsigned char *cp,
> + * int (*receive_buf)(struct tty_struct *, const unsigned char *cp,
> * char *fp, int count);
> *
> * This function is called by the low-level tty driver to send
> @@ -141,7 +141,7 @@ struct tty_ldisc_ops {
> /*
> * The following routines are called from below.
> */
> - unsigned int (*receive_buf)(struct tty_struct *,
> + int (*receive_buf)(struct tty_struct *,
> const unsigned char *cp, char *fp, int count);
> void (*write_wakeup)(struct tty_struct *);
> void (*dcd_change)(struct tty_struct *, unsigned int,
> --
> 1.7.3.4
>
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/