TTY/serial driver patches for .40
Subsystems (24)
PATCH 1/1 TTY/serial driver patches for .40
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
PATCH 1/48 vt: remove uneeded retval check before tty->ops->open inside tty_open
From: Herton Ronaldo Krzesinski <[email protected]>
The current check is uneeded, since !retval will always returns true, as retval returned from tty_add_file is checked earlier and tty_open exits if it's not zero.
--- drivers/tty/tty_io.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-)
drivers/tty/tty_io.c +4 -6
@@ -1902,12 +1902,10 @@ got_driver:#ifdef TTY_DEBUG_HANGUP printk (KERN_DEBUG "opening %s..." , tty->name);#endif -if (!retval) { -if (tty->ops->open) - retval = tty->ops->open (tty, filp); -else - retval = -ENODEV ; - } +if (tty->ops->open) + retval = tty->ops->open (tty, filp); +else + retval = -ENODEV ; filp->f_flags = saved_flags; if (!retval && test_bit(TTY_EXCLUSIVE, &tty->flags) &&
Signature · 1 line
1.7.4.2
PATCH 2/48 vt: Add K_OFF return value to vt_ioctl KDGKBMODE
From: Arthur Taylor <[email protected]>
After adding support for K_OFF in KDSKBMODE, it was forgotten to add support for returning it in KDGKBMODE.
--- drivers/tty/vt/vt_ioctl.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/tty/vt/vt_ioctl.c +1 -0
@@ -701,6 +701,7 @@ int vt_ioctl(struct tty_struct *tty, uival = ((kbd->kbdmode ==VC_RAW ) ?K_RAW : (kbd->kbdmode ==VC_MEDIUMRAW ) ?K_MEDIUMRAW : (kbd->kbdmode ==VC_UNICODE ) ?K_UNICODE : + (kbd->kbdmode ==VC_OFF ) ?K_OFF :K_XLATE ); goto setint;
Signature · 1 line
1.7.4.2
PATCH 3/48 drivers/tty/vt/vt_ioctl.c: repair insane ?: expression
In reply to Greg Kroah-HartmanFrom: Andrew Morton <[email protected]>
--- drivers/tty/vt/vt_ioctl.c | 22 +++++++++++++++++----- 1 files changed, 17 insertions(+), 5 deletions(-)
drivers/tty/vt/vt_ioctl.c +17 -5
@@ -698,11 +698,23 @@ int vt_ioctl(struct tty_struct *tty,break ;case KDGKBMODE : - uival = ((kbd->kbdmode ==VC_RAW ) ?K_RAW : - (kbd->kbdmode ==VC_MEDIUMRAW ) ?K_MEDIUMRAW : - (kbd->kbdmode ==VC_UNICODE ) ?K_UNICODE : - (kbd->kbdmode ==VC_OFF ) ?K_OFF : -K_XLATE ); +switch (kbd->kbdmode) { +case VC_RAW : + uival =K_RAW ; +break ; +case VC_MEDIUMRAW : + uival =K_MEDIUMRAW ; +break ; +case VC_UNICODE : + uival =K_UNICODE ; +break ; +case VC_OFF : + uival =K_OFF ; +break ; +default : + uival =K_XLATE ; +break ; + } goto setint;/* this could be folded into KDSKBMODE, but for compatibility
Signature · 1 line
1.7.4.2
PATCH 4/48 tty: VT, remove unused variable
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
drivers/tty/vt/vt_ioctl.c:1525:2: warning: Value stored to 'kbd' is never read kbd = kbd_table + console;
^ ~~~~~~~~~~~~~~~~~~~
--- drivers/tty/vt/vt_ioctl.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/tty/vt/vt_ioctl.c +0 -2
@@ -1512,7 +1512,6 @@ long vt_compat_ioctl(struct tty_struct *tty, {struct vc_data *vc = tty->driver_data;struct console_font_op op;/* used in multiple places here */ -struct kbd_struct *kbd;unsigned int console;void __user *up = (void __user *)arg;int perm;
@@ -1535,7 +1534,6 @@ long vt_compat_ioctl(struct tty_struct *tty,if (current->signal->tty == tty ||capable (CAP_SYS_TTY_CONFIG )) perm =1 ; - kbd = kbd_table + console;switch (cmd) {/* * these need special handlers for incompatible data structures
Signature · 1 line
1.7.4.2
PATCH 5/48 TTY: serial_core, remove unused variable
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
drivers/tty/serial/serial_core.c:1980:2: warning: Value stored to 'tty' is never read
tty = port->tty;
^ ~~~~~~~~~--- drivers/tty/serial/serial_core.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/tty/serial/serial_core.c +0 -4
@@ -1972,13 +1972,9 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)struct tty_port *port = &state->port;struct device *tty_dev;struct uart_match match = {uport, drv}; -struct tty_struct *tty;mutex_lock (&port->mutex); -/* Must be inside the mutex lock until we convert to tty_port */ - tty = port->tty; - tty_dev =device_find_child (uport->dev, &match, serial_match_port);if (device_may_wakeup (tty_dev)) {if (!enable_irq_wake (uport->irq))
Signature · 1 line
1.7.4.2
PATCH 6/48 Char: cyclades, fix unused variable
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
drivers/tty/cyclades.c:1454:2: warning: Value stored to 'channel' is never read
channel = info->line - card->first_line; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fix it by moving it to the appropriate debug section where it is used.
--- drivers/tty/cyclades.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/tty/cyclades.c +1 -2
@@ -1445,13 +1445,11 @@ static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty) {struct cyclades_card *card;unsigned long flags; -int channel;if (!(info->port.flags &ASYNC_INITIALIZED ))return ; card = info->card; - channel = info->line - card->first_line;if (!cy_is_Z (card)) {spin_lock_irqsave (&card->card_lock, flags);
@@ -1476,6 +1474,7 @@ static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty)spin_unlock_irqrestore (&card->card_lock, flags); }else {#ifdef CY_DEBUG_OPEN +int channel = info->line - card->first_line;printk (KERN_DEBUG "cyc shutdown Z card %d, channel %d, " "base_addr %p\n" , card, channel, card->base_addr);#endif
Signature · 1 line
1.7.4.2
PATCH 7/48 TTY: VT, remove unused variables
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
drivers/tty/vt/vt.c:892:2: warning: Value stored to 'old_screen_size' is never read
old_screen_size = vc->vc_screenbuf_size;
^ ~~~~~~~~~~~~~~~~~~~~~
drivers/tty/vt/vt.c:890:2: warning: Value stored to 'old_cols' is never read
old_cols = vc->vc_cols;
^ ~~~~~~~~~~~--- drivers/tty/vt/vt.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/tty/vt/vt.c +1 -3
@@ -858,7 +858,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, {unsigned long old_origin, new_origin, new_scr_end, rlth, rrem, err =0 ;unsigned long end; -unsigned int old_cols, old_rows, old_row_size, old_screen_size; +unsigned int old_rows, old_row_size;unsigned int new_cols, new_rows, new_row_size, new_screen_size;unsigned int user;unsigned short *newscreen;
@@ -887,9 +887,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,return -ENOMEM ; old_rows = vc->vc_rows; - old_cols = vc->vc_cols; old_row_size = vc->vc_size_row; - old_screen_size = vc->vc_screenbuf_size; err =resize_screen (vc, new_cols, new_rows, user);if (err) {
Signature · 1 line
1.7.4.2
PATCH 8/48 Char: moxa, remove unused variables
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
drivers/tty/moxa.c:1287:2: warning: Value stored to 'port' is never read
port = tty->index;
^ ~~~~~~~~~~
drivers/tty/moxa.c:1763:2: warning: Value stored to 'cflag' is never read
cflag = termio->c_cflag; /* termio->c_cflag */
^ ~~~~~~~~~~~~~~~--- drivers/tty/moxa.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/tty/moxa.c +0 -4
@@ -1281,10 +1281,8 @@ static int moxa_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) {struct moxa_port *ch; -int port;int dtr, rts; - port = tty->index;mutex_lock (&moxa_openlock); ch = tty->driver_data;if (!ch) {
@@ -1756,11 +1754,9 @@ static int MoxaPortSetTermio(struct moxa_port *port, struct ktermios *termio, speed_t baud) {void __iomem *ofsAddr; -tcflag_t cflag;tcflag_t mode =0 ; ofsAddr = port->tableAddr; - cflag = termio->c_cflag;/* termio->c_cflag */ mode = termio->c_cflag &CSIZE ;if (mode ==CS5 )
Signature · 1 line
1.7.4.2
PATCH 9/48 TTY: rocket, remove unused variables
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
drivers/tty/rocket.c:1393:2: warning: Value stored to 'cp' is never read
cp = &info->channel;
^ ~~~~~~~~~~~~~~
drivers/tty/rocket.c:1412:2: warning: Value stored to 'cp' is never read
cp = &info->channel;
^ ~~~~~~~~~~~~~~
drivers/tty/rocket.c:1730:2: warning: Value stored to 'cp' is never read
cp = &info->channel;
^ ~~~~~~~~~~~~~~
drivers/tty/rocket.c:1825:3: warning: Value stored to 'str' is never read
str = "8";
^ ~~~
[many 'str' warnings stripped]
drivers/tty/rocket.c:2037:3: warning: Value stored to 'board_type' is never read
board_type = "RocketModem";
^ ~~~~~~~~~~~~~[some 'board_type' warnings stripped]
--- drivers/tty/rocket.c | 47 ----------------------------------------------- 1 files changed, 0 insertions(+), 47 deletions(-)
drivers/tty/rocket.c +0 -47
@@ -1380,7 +1380,6 @@ static void rp_send_xchar(struct tty_struct *tty, char ch)static void rp_throttle (struct tty_struct *tty) {struct r_port *info = tty->driver_data; -CHANNEL_t *cp;#ifdef ROCKET_DEBUG_THROTTLE printk(KERN_INFO "throttle %s: %d....\n", tty->name,
@@ -1390,7 +1389,6 @@ static void rp_throttle(struct tty_struct *tty)if (rocket_paranoia_check (info,"rp_throttle" ))return ; - cp = &info->channel;if (I_IXOFF (tty))rp_send_xchar (tty,STOP_CHAR (tty));
@@ -1400,7 +1398,6 @@ static void rp_throttle(struct tty_struct *tty)static void rp_unthrottle (struct tty_struct *tty) {struct r_port *info = tty->driver_data; -CHANNEL_t *cp;#ifdef ROCKET_DEBUG_THROTTLE printk (KERN_INFO "unthrottle %s: %d....\n" , tty->name, tty->ldisc.chars_in_buffer (tty));
@@ -1409,7 +1406,6 @@ static void rp_unthrottle(struct tty_struct *tty)if (rocket_paranoia_check (info,"rp_throttle" ))return ; - cp = &info->channel;if (I_IXOFF (tty))rp_send_xchar (tty,START_CHAR (tty));
@@ -1722,13 +1718,10 @@ static int rp_write_room(struct tty_struct *tty)static int rp_chars_in_buffer (struct tty_struct *tty) {struct r_port *info = tty->driver_data; -CHANNEL_t *cp;if (rocket_paranoia_check (info,"rp_chars_in_buffer" ))return 0 ; - cp = &info->channel; -#ifdef ROCKET_DEBUG_WRITE printk (KERN_INFO "rp_chars_in_buffer returns %d...\n" , info->xmit_cnt);#endif
@@ -1779,7 +1772,6 @@ static __init int register_PCI(int i, struct pci_dev *dev) {int num_aiops, aiop, max_num_aiops, num_chan, chan;unsigned int aiopio[MAX_AIOPS_PER_BOARD ]; -char *str, *board_type;CONTROLLER_t *ctlp;int fast_clock =0 ;
@@ -1800,7 +1792,6 @@ static __init int register_PCI(int i, struct pci_dev *dev)/* Depending on the model, set up some config variables */ switch (dev->device) {case PCI_DEVICE_ID_RP4QUAD : - str ="Quadcable" ; max_num_aiops =1 ; ports_per_aiop =4 ; rocketModel[i].model =MODEL_RP4QUAD ;
@@ -1808,42 +1799,36 @@ static __init int register_PCI(int i, struct pci_dev *dev) rocketModel[i].numPorts =4 ;break ;case PCI_DEVICE_ID_RP8OCTA : - str ="Octacable" ; max_num_aiops =1 ; rocketModel[i].model =MODEL_RP8OCTA ;strcpy (rocketModel[i].modelString,"RocketPort 8 port w/octa cable" ); rocketModel[i].numPorts =8 ;break ;case PCI_DEVICE_ID_URP8OCTA : - str ="Octacable" ; max_num_aiops =1 ; rocketModel[i].model =MODEL_UPCI_RP8OCTA ;strcpy (rocketModel[i].modelString,"RocketPort UPCI 8 port w/octa cable" ); rocketModel[i].numPorts =8 ;break ;case PCI_DEVICE_ID_RP8INTF : - str ="8" ; max_num_aiops =1 ; rocketModel[i].model =MODEL_RP8INTF ;strcpy (rocketModel[i].modelString,"RocketPort 8 port w/external I/F" ); rocketModel[i].numPorts =8 ;break ;case PCI_DEVICE_ID_URP8INTF : - str ="8" ; max_num_aiops =1 ; rocketModel[i].model =MODEL_UPCI_RP8INTF ;strcpy (rocketModel[i].modelString,"RocketPort UPCI 8 port w/external I/F" ); rocketModel[i].numPorts =8 ;break ;case PCI_DEVICE_ID_RP8J : - str ="8J" ; max_num_aiops =1 ; rocketModel[i].model =MODEL_RP8J ;strcpy (rocketModel[i].modelString,"RocketPort 8 port w/RJ11 connectors" ); rocketModel[i].numPorts =8 ;break ;case PCI_DEVICE_ID_RP4J : - str ="4J" ; max_num_aiops =1 ; ports_per_aiop =4 ; rocketModel[i].model =MODEL_RP4J ;
@@ -1851,56 +1836,48 @@ static __init int register_PCI(int i, struct pci_dev *dev) rocketModel[i].numPorts =4 ;break ;case PCI_DEVICE_ID_RP8SNI : - str ="8 (DB78 Custom)" ; max_num_aiops =1 ; rocketModel[i].model =MODEL_RP8SNI ;strcpy (rocketModel[i].modelString,"RocketPort 8 port w/ custom DB78" ); rocketModel[i].numPorts =8 ;break ;case PCI_DEVICE_ID_RP16SNI : - str ="16 (DB78 Custom)" ; max_num_aiops =2 ; rocketModel[i].model =MODEL_RP16SNI ;strcpy (rocketModel[i].modelString,"RocketPort 16 port w/ custom DB78" ); rocketModel[i].numPorts =16 ;break ;case PCI_DEVICE_ID_RP16INTF : - str ="16" ; max_num_aiops =2 ; rocketModel[i].model =MODEL_RP16INTF ;strcpy (rocketModel[i].modelString,"RocketPort 16 port w/external I/F" ); rocketModel[i].numPorts =16 ;break ;case PCI_DEVICE_ID_URP16INTF : - str ="16" ; max_num_aiops =2 ; rocketModel[i].model =MODEL_UPCI_RP16INTF ;strcpy (rocketModel[i].modelString,"RocketPort UPCI 16 port w/external I/F" ); rocketModel[i].numPorts =16 ;break ;case PCI_DEVICE_ID_CRP16INTF : - str ="16" ; max_num_aiops =2 ; rocketModel[i].model =MODEL_CPCI_RP16INTF ;strcpy (rocketModel[i].modelString,"RocketPort Compact PCI 16 port w/external I/F" ); rocketModel[i].numPorts =16 ;break ;case PCI_DEVICE_ID_RP32INTF : - str ="32" ; max_num_aiops =4 ; rocketModel[i].model =MODEL_RP32INTF ;strcpy (rocketModel[i].modelString,"RocketPort 32 port w/external I/F" ); rocketModel[i].numPorts =32 ;break ;case PCI_DEVICE_ID_URP32INTF : - str ="32" ; max_num_aiops =4 ; rocketModel[i].model =MODEL_UPCI_RP32INTF ;strcpy (rocketModel[i].modelString,"RocketPort UPCI 32 port w/external I/F" ); rocketModel[i].numPorts =32 ;break ;case PCI_DEVICE_ID_RPP4 : - str ="Plus Quadcable" ; max_num_aiops =1 ; ports_per_aiop =4 ; altChanRingIndicator++;
@@ -1910,7 +1887,6 @@ static __init int register_PCI(int i, struct pci_dev *dev) rocketModel[i].numPorts =4 ;break ;case PCI_DEVICE_ID_RPP8 : - str ="Plus Octacable" ; max_num_aiops =2 ; ports_per_aiop =4 ; altChanRingIndicator++;
@@ -1920,7 +1896,6 @@ static __init int register_PCI(int i, struct pci_dev *dev) rocketModel[i].numPorts =8 ;break ;case PCI_DEVICE_ID_RP2_232 : - str ="Plus 2 (RS-232)" ; max_num_aiops =1 ; ports_per_aiop =2 ; altChanRingIndicator++;
@@ -1930,7 +1905,6 @@ static __init int register_PCI(int i, struct pci_dev *dev) rocketModel[i].numPorts =2 ;break ;case PCI_DEVICE_ID_RP2_422 : - str ="Plus 2 (RS-422)" ; max_num_aiops =1 ; ports_per_aiop =2 ; altChanRingIndicator++;
@@ -1943,7 +1917,6 @@ static __init int register_PCI(int i, struct pci_dev *dev) max_num_aiops =1 ; ports_per_aiop =6 ; - str ="6-port" ;/* If revision is 1, the rocketmodem flash must be loaded. * If it is 2 it is a "socketed" version. */
@@ -1961,7 +1934,6 @@ static __init int register_PCI(int i, struct pci_dev *dev)case PCI_DEVICE_ID_RP4M : max_num_aiops =1 ; ports_per_aiop =4 ; - str ="4-port" ;if (dev->revision ==1 ) { rcktpt_type[i] =ROCKET_TYPE_MODEMII ; rocketModel[i].loadrm2 =1 ;
@@ -1974,7 +1946,6 @@ static __init int register_PCI(int i, struct pci_dev *dev) rocketModel[i].numPorts =4 ;break ;default : - str ="(unknown/unsupported)" ; max_num_aiops =0 ;break ; }
@@ -2000,14 +1971,12 @@ static __init int register_PCI(int i, struct pci_dev *dev)if (! (sInW (ConfigIO + _PCI_9030_GPIO_CTRL) &PCI_GPIO_CTRL_8PORT )) { - str ="Quadcable" ; ports_per_aiop =4 ; rocketModel[i].numPorts =4 ; } }break ;case PCI_DEVICE_ID_UPCI_RM3_8PORT : - str ="8 ports" ; max_num_aiops =1 ; rocketModel[i].model =MODEL_UPCI_RM3_8PORT ;strcpy (rocketModel[i].modelString,"RocketModem III 8 port" );
@@ -2018,7 +1987,6 @@ static __init int register_PCI(int i, struct pci_dev *dev) rcktpt_type[i] =ROCKET_TYPE_MODEMIII ;break ;case PCI_DEVICE_ID_UPCI_RM3_4PORT : - str ="4 ports" ; max_num_aiops =1 ; rocketModel[i].model =MODEL_UPCI_RM3_4PORT ;strcpy (rocketModel[i].modelString,"RocketModem III 4 port" );
@@ -2032,21 +2000,6 @@ static __init int register_PCI(int i, struct pci_dev *dev)break ; } -switch (rcktpt_type[i]) { -case ROCKET_TYPE_MODEM : - board_type ="RocketModem" ; -break ; -case ROCKET_TYPE_MODEMII : - board_type ="RocketModem II" ; -break ; -case ROCKET_TYPE_MODEMIII : - board_type ="RocketModem III" ; -break ; -default : - board_type ="RocketPort" ; -break ; - } -if (fast_clock) { sClockPrescale =0x12 ;/* mod 2 (divide by 3) */ rp_baud_base[i] =921600 ;
Signature · 1 line
1.7.4.2
PATCH 10/48 TTY: unify tty_init_dev fail path handling
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
Change it so that we call the deinit functions at one place at the end of the function (by gotos). And while at it use some sane label names.
This is a preparation for the deinitialization of tty in the next patch.
--- drivers/tty/tty_io.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-)
drivers/tty/tty_io.c +12 -11
@@ -1391,16 +1391,15 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,return ERR_PTR (-ENODEV ); tty =alloc_tty_struct (); -if (!tty) - goto fail_no_mem; +if (!tty) { + retval = -ENOMEM ; + goto err_module_put; + }initialize_tty_struct (tty, driver, idx); retval =tty_driver_install_tty (driver, tty); -if (retval <0 ) { -free_tty_struct (tty); -module_put (driver->owner); -return ERR_PTR (retval); - } +if (retval <0 ) + goto err_free_tty;/* * Structures all installed ... call the ldisc open routines.
@@ -1409,15 +1408,17 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,*/ retval =tty_ldisc_setup (tty, tty->link);if (retval) - goto release_mem_out; + goto err_release_tty;return tty; -fail_no_mem: +err_free_tty: +free_tty_struct (tty); +err_module_put:module_put (driver->owner); -return ERR_PTR (-ENOMEM ); +return ERR_PTR (retval);/* call the tty release_tty routine to clean out this slot */ -release_mem_out: +err_release_tty:if (printk_ratelimit ())printk (KERN_INFO "tty_init_dev: ldisc open failed, " "clearing slot %d\n" , idx);
Signature · 1 line
1.7.4.2
PATCH 11/48 TTY: unify pty_install fail path handling
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
Change it so that we call the deinit functions at one place at the end of the function (by gotos). And while at it use some sane label names.
This is a preparation for the deinitialization of tty in the next patch.
--- drivers/tty/pty.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-)
drivers/tty/pty.c +10 -9
@@ -295,8 +295,8 @@ static int pty_install(struct tty_driver *driver, struct tty_struct *tty)return -ENOMEM ;if (!try_module_get (driver->other->owner)) {/* This cannot in fact currently happen */ -free_tty_struct (o_tty); -return -ENOMEM ; + retval = -ENOMEM ; + goto err_free_tty; }initialize_tty_struct (o_tty, driver->other, idx);
@@ -304,13 +304,11 @@ static int pty_install(struct tty_driver *driver, struct tty_struct *tty)the easy way .. */ retval =tty_init_termios (tty);if (retval) - goto free_mem_out; + goto err_module_put; retval =tty_init_termios (o_tty); -if (retval) { -tty_free_termios (tty); - goto free_mem_out; - } +if (retval) + goto err_free_termios;/* * Everything allocated ... set up the o_tty structure.
@@ -327,10 +325,13 @@ static int pty_install(struct tty_driver *driver, struct tty_struct *tty) tty->count++; driver->ttys[idx] = tty;return 0 ; -free_mem_out: +err_free_termios: +tty_free_termios (tty); +err_module_put:module_put (o_tty->driver->owner); +err_free_tty:free_tty_struct (o_tty); -return -ENOMEM ; +return retval; } static int pty_bsd_ioctl(struct tty_struct *tty,
Signature · 1 line
1.7.4.2
PATCH 12/48 TTY: unify pty_unix98_install fail path handling
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
Change it so that we call the deinit functions at one place at the end of the function (by gotos). And while at it use some sane label names.
This is a preparation for the deinitialization of tty in the next patch.
--- drivers/tty/pty.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/tty/pty.c +6 -6
@@ -560,20 +560,19 @@ static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty)return -ENOMEM ;if (!try_module_get (driver->other->owner)) {/* This cannot in fact currently happen */ -free_tty_struct (o_tty); -return -ENOMEM ; + goto err_free_tty; }initialize_tty_struct (o_tty, driver->other, idx); tty->termios =kzalloc (sizeof (struct ktermios [2 ]),GFP_KERNEL );if (tty->termios ==NULL ) - goto free_mem_out; + goto err_free_mem; *tty->termios = driver->init_termios; tty->termios_locked = tty->termios +1 ; o_tty->termios =kzalloc (sizeof (struct ktermios [2 ]),GFP_KERNEL );if (o_tty->termios ==NULL ) - goto free_mem_out; + goto err_free_mem; *o_tty->termios = driver->other->init_termios; o_tty->termios_locked = o_tty->termios +1 ;
@@ -592,11 +591,12 @@ static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty) tty->count++; pty_count++;return 0 ; -free_mem_out: +err_free_mem:kfree (o_tty->termios); +kfree (tty->termios);module_put (o_tty->driver->owner); +err_free_tty:free_tty_struct (o_tty); -kfree (tty->termios);return -ENOMEM ; }
Signature · 1 line
1.7.4.2
PATCH 13/48 TTY: introduce deinit helpers for proper ldisc shutdown
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
Introduce deinitialize_tty_struct which should be called after initialize_tty_struct and before successfull tty_ldisc_setup.
It calls tty_ldisc_deinit which is opposite of tty_ldisc_init. It only puts a reference to ldisc and assigns NULL to tty->ldisc.
It will be used to shut down ldisc when tty_release cannot be called yet.
--- drivers/tty/tty_io.c | 14 ++++++++++++++ drivers/tty/tty_ldisc.c | 13 +++++++++++++ include/linux/tty.h | 2 ++ 3 files changed, 29 insertions(+), 0 deletions(-)
drivers/tty/tty_io.c +14 -0
@@ -2887,6 +2887,20 @@ void initialize_tty_struct(struct tty_struct *tty, }/** +* deinitialize_tty_struct +* @tty: tty to deinitialize +* +* This subroutine deinitializes a tty structure that has been newly +* allocated but tty_release cannot be called on that yet. +* +* Locking: none - tty in question must not be exposed at this point +*/ +void deinitialize_tty_struct (struct tty_struct *tty) +{ +tty_ldisc_deinit (tty); +} + +/** * tty_put_char - write one character to a tty * @tty: tty * @ch: character
drivers/tty/tty_ldisc.c +13 -0
@@ -956,6 +956,19 @@ void tty_ldisc_init(struct tty_struct *tty)tty_ldisc_assign (tty, ld); } +/** +* tty_ldisc_init - ldisc cleanup for new tty +* @tty: tty that was allocated recently +* +* The tty structure must not becompletely set up (tty_ldisc_setup) when +* this call is made. +*/ +void tty_ldisc_deinit (struct tty_struct *tty) +{ +put_ldisc (tty->ldisc); +tty_ldisc_assign (tty,NULL ); +} +void tty_ldisc_begin (void ) {/* Setup the default TTY line discipline. */
include/linux/tty.h +2 -0
@@ -472,6 +472,7 @@ extern int tty_add_file(struct tty_struct *tty, struct file *file);extern void free_tty_struct (struct tty_struct *tty);extern void initialize_tty_struct (struct tty_struct *tty,struct tty_driver *driver,int idx); +extern void deinitialize_tty_struct (struct tty_struct *tty);extern struct tty_struct *tty_init_dev (struct tty_driver *driver,int idx,int first_ok);extern int tty_release (struct inode *inode,struct file *filp);
@@ -525,6 +526,7 @@ extern int tty_set_ldisc(struct tty_struct *tty, int ldisc);extern int tty_ldisc_setup (struct tty_struct *tty,struct tty_struct *o_tty);extern void tty_ldisc_release (struct tty_struct *tty,struct tty_struct *o_tty);extern void tty_ldisc_init (struct tty_struct *tty); +extern void tty_ldisc_deinit (struct tty_struct *tty);extern void tty_ldisc_begin (void );/* This last one is just for the tty layer internals and shouldn't be used elsewhere */ extern void tty_ldisc_enable (struct tty_struct *tty);
Signature · 1 line
1.7.4.2
PATCH 14/48 TTY: plug in deinitialize_tty_struct
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
Used the newly introduced deinitialize_tty_struct to properly shut down ldisc.
It is intended to fix the Julian's reported problem. He reports that kmemleak checker warns about memory leak:
unreferenced object 0xc0e19860 (size 8):
comm cat, pid 1226, jiffies 4294919464 (age 287.476s)
hex dump (first 8 bytes):
44 de 2d c1 01 00 00 00 D.-.....
backtrace:
[<c1065a74>] create_object+0x109/0x1ad [<c1063d2b>] kmem_cache_alloc+0x60/0x68 [<c113505c>] tty_ldisc_get+0x54/0x76 [<c11358c9>] tty_ldisc_init+0xa/0x20 [<c1130ab4>] initialize_tty_struct+0x2d/0x1ac [<c1130c8c>] tty_init_dev+0x59/0x10d [<c113136d>] tty_open+0x24a/0x3a2
...
--- drivers/tty/pty.c | 6 ++++-- drivers/tty/tty_io.c | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/tty/pty.c +4 -2
@@ -304,7 +304,7 @@ static int pty_install(struct tty_driver *driver, struct tty_struct *tty)the easy way .. */ retval =tty_init_termios (tty);if (retval) - goto err_module_put; + goto err_deinit_tty; retval =tty_init_termios (o_tty);if (retval)
@@ -327,7 +327,8 @@ static int pty_install(struct tty_driver *driver, struct tty_struct *tty)return 0 ; err_free_termios:tty_free_termios (tty); -err_module_put: +err_deinit_tty: +deinitialize_tty_struct (o_tty);module_put (o_tty->driver->owner); err_free_tty:free_tty_struct (o_tty);
@@ -592,6 +593,7 @@ static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty) pty_count++;return 0 ; err_free_mem: +deinitialize_tty_struct (o_tty);kfree (o_tty->termios);kfree (tty->termios);module_put (o_tty->driver->owner);
drivers/tty/tty_io.c +3 -2
@@ -1399,7 +1399,7 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, retval =tty_driver_install_tty (driver, tty);if (retval <0 ) - goto err_free_tty; + goto err_deinit_tty;/* * Structures all installed ... call the ldisc open routines.
@@ -1411,7 +1411,8 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, goto err_release_tty;return tty; -err_free_tty: +err_deinit_tty: +deinitialize_tty_struct (tty);free_tty_struct (tty); err_module_put:module_put (driver->owner);
Signature · 1 line
1.7.4.2
PATCH 15/48 TTY: fix fail path in tty_open
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
When tty_add_file fails we omit to clean up. Fix that by calling tty_release appropriatelly.
--- drivers/tty/tty_io.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/tty/tty_io.c +1 -0
@@ -1894,6 +1894,7 @@ got_driver: retval =tty_add_file (tty, filp);if (retval) {tty_unlock (); +tty_release (inode, filp);return retval; }
Signature · 1 line
1.7.4.2
PATCH 16/48 serial: altera_uart: Scan for a free port if platform device id is -1
In reply to Greg Kroah-HartmanFrom: Tobias Klauser <[email protected]>
Devices extracted from device tree all seem to have pdev->id set to -1. Up until now we mapped all devices with id -1 to the first device. This behaviour could lead to problems when using more than one Altera UART in a system.
This patch changes the behaviour of the driver to scan for the next free id in case the id is -1.
Because we cannot refer back to the assigned id in altera_uart_remove, the port instance needs to be stored in device drvdata.
--- drivers/tty/serial/altera_uart.c | 26 +++++++++++++++----------- 1 files changed, 15 insertions(+), 11 deletions(-)
drivers/tty/serial/altera_uart.c +15 -11
@@ -540,11 +540,14 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)int i = pdev->id;int ret; -/* -1 emphasizes that the platform must have one port, no .N suffix */ -if (i ==-1 ) - i =0 ; +/* if id is -1 scan for a free id and use that one */ +if (i ==-1 ) { +for (i =0 ; i <CONFIG_SERIAL_ALTERA_UART_MAXPORTS ; i++) +if (altera_uart_ports[i].port.mapbase ==0 ) +break ; + } -if (i >=CONFIG_SERIAL_ALTERA_UART_MAXPORTS ) +if (i <0 || i >=CONFIG_SERIAL_ALTERA_UART_MAXPORTS )return -EINVAL ; port = &altera_uart_ports[i].port;
@@ -587,6 +590,8 @@ static int __devinit altera_uart_probe(struct platform_device *pdev) port->ops = &altera_uart_ops; port->flags =UPF_BOOT_AUTOCONF ; +dev_set_drvdata (&pdev->dev, port); +uart_add_one_port (&altera_uart_driver, port);return 0 ;
@@ -594,14 +599,13 @@ static int __devinit altera_uart_probe(struct platform_device *pdev) static int __devexit altera_uart_remove(struct platform_device *pdev) { -struct uart_port *port; -int i = pdev->id; +struct uart_port *port =dev_get_drvdata (&pdev->dev); -if (i ==-1 ) - i =0 ; - - port = &altera_uart_ports[i].port; -uart_remove_one_port (&altera_uart_driver, port); +if (port) { +uart_remove_one_port (&altera_uart_driver, port); +dev_set_drvdata (&pdev->dev,NULL ); + port->mapbase =0 ; + }return 0 ; }
Signature · 1 line
1.7.4.2
PATCH 17/48 Char: moxa, do not touch NORMAL_ACTIVE bit
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
The bit is set in tty_port_block_til_ready (via moxa_open) and unset in tty_port_close (via moxa_close). No need to pin it in the driver.
--- drivers/tty/moxa.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/tty/moxa.c +1 -6
@@ -1129,7 +1129,6 @@ static void moxa_shutdown(struct tty_port *port) struct moxa_port *ch = container_of(port, struct moxa_port, port);MoxaPortDisable (ch);MoxaPortFlushData (ch,2 ); -clear_bit (ASYNCB_NORMAL_ACTIVE , &port->flags); }static int moxa_carrier_raised (struct tty_port *port)
@@ -1155,7 +1154,6 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)struct moxa_board_conf *brd;struct moxa_port *ch;int port; -int retval; port = tty->index;if (port ==MAX_PORTS ) {
@@ -1190,10 +1188,7 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)mutex_unlock (&ch->port.mutex);mutex_unlock (&moxa_openlock); - retval =tty_port_block_til_ready (&ch->port, tty, filp); -if (retval ==0 ) -set_bit (ASYNCB_NORMAL_ACTIVE , &ch->port.flags); -return retval; +return tty_port_block_til_ready (&ch->port, tty, filp); }static void moxa_close (struct tty_struct *tty,struct file *filp)
Signature · 1 line
1.7.4.2
PATCH 18/48 serial: core, move termios handling to uart_startup
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
We should not fiddle with speed and cflags in .dtr_rts hook. Actually we might not have tty at that moment already.
So move the console cflag copy and speed setup into uart_startup. Actually the speed setup is already there, but we need to call it unconditionally (uart_startup is called from uart_open with hw_init = 0).
This means we move uart_change_speed before dtr/rts setup in .dtr_rts. But this should not matter as the setup should be called after uart_change_speed anyway.
Before: After: dtr/rts setup (dtr_rts) uart_change_speed (startup) uart_change_speed (update_termios) dtr/rts setup (dtr_rts) dtr/rts setup (update_termios) dtr/rts setup (update_termios)
The second setup will dismiss with the next patch.
--- drivers/tty/serial/serial_core.c | 24 +++++++++--------------- 1 files changed, 9 insertions(+), 15 deletions(-)
drivers/tty/serial/serial_core.c +9 -15
@@ -172,12 +172,16 @@ static int uart_startup(struct tty_struct *tty, struct uart_state *state, int in retval = uport->ops->startup (uport);if (retval ==0 ) { -if (init_hw) { -/* -* Initialise the hardware port settings. -*/ -uart_change_speed (tty, state,NULL ); +if (uart_console (uport) && uport->cons->cflag) { + tty->termios->c_cflag = uport->cons->cflag; + uport->cons->cflag =0 ; + } +/* +* Initialise the hardware port settings. +*/ +uart_change_speed (tty, state,NULL ); +if (init_hw) {/* * Setup the RTS and DTR signals once the * port is open and ready to respond.
@@ -1481,11 +1485,6 @@ static void uart_update_termios(struct tty_struct *tty, {struct uart_port *port = state->uart_port; -if (uart_console (port) && port->cons->cflag) { - tty->termios->c_cflag = port->cons->cflag; - port->cons->cflag =0 ; - } -/* * If the device failed to grab its irq resources, * or some other error occurred, don't try to talk
@@ -1493,11 +1492,6 @@ static void uart_update_termios(struct tty_struct *tty,*/ if (!(tty->flags & (1 <<TTY_IO_ERROR ))) {/* -* Make termios settings take effect. -*/ -uart_change_speed (tty, state,NULL ); - -/* * And finally enable the RTS and DTR signals. */ if (tty->termios->c_cflag &CBAUD )
Signature · 1 line
1.7.4.2
PATCH 19/48 serial: core, do not set DTR/RTS twice on startup
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
In .dtr_rts we do:
uart_set_mctrl(uport, TIOCM_DTR | TIOCM_RTS)
and call uart_update_termios. It does:
uart_set_mctrl(port, TIOCM_DTR | TIOCM_RTS)
once again. As the only callsite of uart_update_termios is .dtr_rts, remove the uart_set_mctrl from uart_update_termios to not set it twice.
--- drivers/tty/serial/serial_core.c | 14 -------------- 1 files changed, 0 insertions(+), 14 deletions(-)
drivers/tty/serial/serial_core.c +0 -14
@@ -1483,20 +1483,6 @@ static void uart_hangup(struct tty_struct *tty)static void uart_update_termios (struct tty_struct *tty,struct uart_state *state) { -struct uart_port *port = state->uart_port; - -/* -* If the device failed to grab its irq resources, -* or some other error occurred, don't try to talk -* to the port hardware. -*/ -if (!(tty->flags & (1 <<TTY_IO_ERROR ))) { -/* -* And finally enable the RTS and DTR signals. -*/ -if (tty->termios->c_cflag &CBAUD ) -uart_set_mctrl (port,TIOCM_DTR |TIOCM_RTS ); - } }static int uart_carrier_raised (struct tty_port *port)
Signature · 1 line
1.7.4.2
PATCH 20/48 serial: core, remove uart_update_termios
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
Now, uart_update_termios is empty, so it's time to remove it. We no longer need a live tty in .dtr_rts. So this should prune all the bugs where tty is zeroed in port->tty during tty_port_block_til_ready.
There is one thing to note. We don't set ASYNC_NORMAL_ACTIVE now. It's because this is done already in tty_port_block_til_ready.
--- drivers/tty/serial/serial_core.c | 25 +------------------------ 1 files changed, 1 insertions(+), 24 deletions(-)
drivers/tty/serial/serial_core.c +1 -24
@@ -1470,21 +1470,6 @@ static void uart_hangup(struct tty_struct *tty)mutex_unlock (&port->mutex); } -/** -* uart_update_termios - update the terminal hw settings -* @tty: tty associated with UART -* @state: UART to update -* -* Copy across the serial console cflag setting into the termios settings -* for the initial open of the port. This allows continuity between the -* kernel settings, and the settings init adopts when it opens the port -* for the first time. -*/ -static void uart_update_termios (struct tty_struct *tty, -struct uart_state *state) -{ -} -static int uart_carrier_raised (struct tty_port *port) { struct uart_state *state = container_of(port, struct uart_state, port);
@@ -1504,16 +1489,8 @@ static void uart_dtr_rts(struct tty_port *port, int onoff) struct uart_state *state = container_of(port, struct uart_state, port);struct uart_port *uport = state->uart_port; -if (onoff) { +if (onoff)uart_set_mctrl (uport,TIOCM_DTR |TIOCM_RTS ); - -/* -* If this is the first open to succeed, -* adjust things to suit. -*/ -if (!test_and_set_bit (ASYNCB_NORMAL_ACTIVE , &port->flags)) -uart_update_termios (port->tty, state); - }else uart_clear_mctrl (uport,TIOCM_DTR |TIOCM_RTS ); }
Signature · 1 line
1.7.4.2
PATCH 21/48 tty: remove invalid location line in file header
In reply to Greg Kroah-HartmanFrom: Jovi Zhang <[email protected]>
remove invalid location line in each file header after location moved from driver/char to driver/tty
--- drivers/tty/amiserial.c | 2 -- drivers/tty/cyclades.c | 2 -- drivers/tty/ipwireless/Makefile | 2 -- drivers/tty/pty.c | 2 -- drivers/tty/serial/21285.c | 2 -- drivers/tty/serial/8250.c | 2 -- drivers/tty/serial/8250.h | 2 -- 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 | 2 -- drivers/tty/serial/8250_pnp.c | 2 -- 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/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/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 | 2 -- 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/synclink.c | 2 -- drivers/tty/tty_io.c | 2 -- drivers/tty/tty_ioctl.c | 2 -- drivers/tty/tty_mutex.c | 3 --- drivers/tty/vt/keyboard.c | 2 -- drivers/tty/vt/selection.c | 2 -- drivers/tty/vt/vc_screen.c | 2 -- drivers/tty/vt/vt.c | 2 -- drivers/tty/vt/vt_ioctl.c | 2 -- 57 files changed, 11 insertions(+), 114 deletions(-)
drivers/tty/amiserial.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/amiserial.c -* * Serial driver for the amiga builtin port. * * This code was created by taking serial.c version 4.30 from kernel
drivers/tty/cyclades.c +0 -2
@@ -3,8 +3,6 @@#undef Z_EXT_CHARS_IN_BUFFER/* -* linux/drivers/char/cyclades.c -* * This file contains the driver for the Cyclades async multiport * serial boards. *
drivers/tty/ipwireless/Makefile +0 -2
@@ -1,6 +1,4 @@ # -# drivers/char/pcmcia/ipwireless/Makefile -# # Makefile for the IPWireless driver #
drivers/tty/pty.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/pty.c -* * Copyright (C) 1991, 1992 Linus Torvalds * * Added support for a Unix98-style ptmx device.
drivers/tty/serial/21285.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/serial/21285.c -* * Driver for the serial port on the 21285 StrongArm-110 core logic chip. * * Based on drivers/char/serial.c
drivers/tty/serial/8250.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/8250.c -* * Driver for 8250/16550-type serial ports * * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
drivers/tty/serial/8250.h +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/8250.h -* * Driver for 8250/16550-type serial ports * * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
drivers/tty/serial/8250_accent.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/serial/8250_accent.c -* * Copyright (C) 2005 Russell King. * Data taken from include/asm-i386/serial.h *
drivers/tty/serial/8250_boca.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/serial/8250_boca.c -* * Copyright (C) 2005 Russell King. * Data taken from include/asm-i386/serial.h *
drivers/tty/serial/8250_exar_st16c554.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/serial/8250_exar.c -* * Written by Paul B Schroeder < pschroeder "at" uplogix "dot" com > * Based on 8250_boca. *
drivers/tty/serial/8250_fourport.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/serial/8250_fourport.c -* * Copyright (C) 2005 Russell King. * Data taken from include/asm-i386/serial.h *
drivers/tty/serial/8250_hub6.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/serial/8250_hub6.c -* * Copyright (C) 2005 Russell King. * Data taken from include/asm-i386/serial.h *
drivers/tty/serial/8250_mca.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/serial/8250_mca.c -* * Copyright (C) 2005 Russell King. * Data taken from include/asm-i386/serial.h *
drivers/tty/serial/8250_pci.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/8250_pci.c -* * Probe module for 8250/16550-type PCI serial ports. * * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
drivers/tty/serial/8250_pnp.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/8250_pnp.c -* * Probe module for 8250/16550-type ISAPNP serial ports. * * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
drivers/tty/serial/amba-pl010.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/amba.c -* * Driver for AMBA serial ports * * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
drivers/tty/serial/amba-pl011.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/amba.c -* * Driver for AMBA serial ports * * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
drivers/tty/serial/atmel_serial.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/atmel_serial.c -* * Driver for Atmel AT91 / AT32 Serial ports * Copyright (C) 2003 Rick Bronson *
drivers/tty/serial/clps711x.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/clps711x.c -* * Driver for CLPS711x serial ports * * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
drivers/tty/serial/cpm_uart/cpm_uart.h +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/serial/cpm_uart.h -* * Driver for CPM (SCC/SMC) serial ports * * Copyright (C) 2004 Freescale Semiconductor, Inc.
drivers/tty/serial/cpm_uart/cpm_uart_core.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/serial/cpm_uart.c -* * Driver for CPM (SCC/SMC) serial ports; core driver * * Based on arch/ppc/cpm2_io/uart.c by Dan Malek
drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/serial/cpm_uart.c -* * Driver for CPM (SCC/SMC) serial ports; CPM1 definitions * * Maintainer: Kumar Gala ([email protected]) (CPM2)
drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/serial/cpm_uart/cpm_uart_cpm1.h -* * Driver for CPM (SCC/SMC) serial ports * * definitions for cpm1
drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/serial/cpm_uart_cpm2.c -* * Driver for CPM (SCC/SMC) serial ports; CPM2 definitions * * Maintainer: Kumar Gala ([email protected]) (CPM2)
drivers/tty/serial/cpm_uart/cpm_uart_cpm2.h +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/serial/cpm_uart/cpm_uart_cpm2.h -* * Driver for CPM (SCC/SMC) serial ports * * definitions for cpm2
drivers/tty/serial/imx.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/serial/imx.c -* * Driver for Motorola IMX serial ports * * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
drivers/tty/serial/msm_serial.c +1 -1
@@ -1,5 +1,5 @@/* -* drivers/serial/msm_serial.c - driver for msm7k serial device and console +* Driver for msm7k serial device and console * * Copyright (C) 2007 Google, Inc. * Author: Robert Love <[email protected]>
drivers/tty/serial/msm_serial.h +0 -2
@@ -1,6 +1,4 @@/* -* drivers/serial/msm_serial.h -* * Copyright (C) 2007 Google, Inc. * Author: Robert Love <[email protected]> * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
drivers/tty/serial/msm_smd_tty.c +1 -2
@@ -1,5 +1,4 @@ -/* drivers/tty/serial/msm_smd_tty.c -* +/* * Copyright (C) 2007 Google, Inc. * Copyright (c) 2011, Code Aurora Forum. All rights reserved. * Author: Brian Swetland <[email protected]>
drivers/tty/serial/netx-serial.c +0 -2
@@ -1,6 +1,4 @@/* -* drivers/serial/netx-serial.c -* * Copyright (c) 2005 Sascha Hauer <[email protected]>, Pengutronix * * This program is free software; you can redistribute it and/or modify
drivers/tty/serial/pmac_zilog.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/serial/pmac_zilog.c -* * Driver for PowerMac Z85c30 based ESCC cell found in the * "macio" ASICs of various PowerMac models *
drivers/tty/serial/pxa.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/serial/pxa.c -* * Based on drivers/serial/8250.c by Russell King. * * Author: Nicolas Pitre
drivers/tty/serial/s3c2400.c +1 -2
@@ -1,5 +1,4 @@ -/* linux/drivers/serial/s3c240.c -* +/* * Driver for Samsung SoC onboard UARTs. * * Ben Dooks, Copyright (c) 2003-2005 Simtec Electronics
drivers/tty/serial/s3c2410.c +1 -2
@@ -1,5 +1,4 @@ -/* linux/drivers/serial/s3c2410.c -* +/* * Driver for Samsung S3C2410 SoC onboard UARTs. * * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics
drivers/tty/serial/s3c2412.c +1 -2
@@ -1,5 +1,4 @@ -/* linux/drivers/serial/s3c2412.c -* +/* * Driver for Samsung S3C2412 and S3C2413 SoC onboard UARTs. * * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics
drivers/tty/serial/s3c2440.c +1 -2
@@ -1,5 +1,4 @@ -/* linux/drivers/serial/s3c2440.c -* +/* * Driver for Samsung S3C2440 and S3C2442 SoC onboard UARTs. * * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics
drivers/tty/serial/s3c24a0.c +1 -2
@@ -1,5 +1,4 @@ -/* linux/drivers/serial/s3c24a0.c -* +/* * Driver for Samsung S3C24A0 SoC onboard UARTs. * * Based on drivers/serial/s3c2410.c
drivers/tty/serial/s3c6400.c +1 -2
@@ -1,5 +1,4 @@ -/* linux/drivers/serial/s3c6400.c -* +/* * Driver for Samsung S3C6400 and S3C6410 SoC onboard UARTs. * * Copyright 2008 Openmoko, Inc.
drivers/tty/serial/s5pv210.c +1 -2
@@ -1,5 +1,4 @@ -/* linux/drivers/serial/s5pv210.c -* +/* * Copyright (c) 2010 Samsung Electronics Co., Ltd. * http://www.samsung.com/ *
drivers/tty/serial/sa1100.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/sa1100.c -* * Driver for SA11x0 serial ports * * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
drivers/tty/serial/samsung.c +1 -2
@@ -1,5 +1,4 @@ -/* linux/drivers/serial/samsuing.c -* +/* * Driver core for Samsung SoC onboard UARTs. * * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics
drivers/tty/serial/samsung.h +1 -2
@@ -1,5 +1,4 @@ -/* linux/drivers/serial/samsung.h -* +/* * Driver for Samsung SoC onboard UARTs. * * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics
drivers/tty/serial/sb1250-duart.c +0 -2
@@ -1,6 +1,4 @@/* -* drivers/serial/sb1250-duart.c -* * Support for the asynchronous serial interface (DUART) included * in the BCM1250 and derived System-On-a-Chip (SOC) devices. *
drivers/tty/serial/serial_core.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/core.c -* * Driver core for serial ports * * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
drivers/tty/serial/serial_ks8695.c +0 -2
@@ -1,6 +1,4 @@/* -* drivers/serial/serial_ks8695.c -* * Driver for KS8695 serial ports * * Based on drivers/serial/serial_amba.c, by Kam Lee.
drivers/tty/serial/serial_txx9.c +0 -2
@@ -1,6 +1,4 @@/* -* drivers/serial/serial_txx9.c -* * Derived from many drivers using generic_serial interface, * especially serial_tx3912.c by Steven J. Hill and r39xx_serial.c * (was in Linux/VR tree) by Jim Pick.
drivers/tty/serial/sh-sci.c +0 -2
@@ -1,6 +1,4 @@/* -* drivers/serial/sh-sci.c -* * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO) * * Copyright (C) 2002 - 2011 Paul Mundt
drivers/tty/serial/vt8500_serial.c +0 -2
@@ -1,6 +1,4 @@/* -* drivers/serial/vt8500_serial.c -* * Copyright (C) 2010 Alexey Charkov <[email protected]> * * Based on msm_serial.c, which is:
drivers/tty/synclink.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/synclink.c -* * $Id: synclink.c,v 4.38 2005/11/07 16:30:34 paulkf Exp $ * * Device driver for Microgate SyncLink ISA and PCI
drivers/tty/tty_io.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/tty_io.c -* * Copyright (C) 1991, 1992 Linus Torvalds */
drivers/tty/tty_ioctl.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/tty_ioctl.c -* * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds * * Modified by Fred N. van Kempen, 01/29/93, to add line disciplines
drivers/tty/tty_mutex.c +0 -3
@@ -1,6 +1,3 @@ -/* -* drivers/char/tty_lock.c -*/ #include <linux/tty.h> #include <linux/module.h> #include <linux/kallsyms.h>
drivers/tty/vt/keyboard.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/keyboard.c -* * Written for linux by Johan Myreen as a translation from * the assembly version by Linus (with diacriticals added) *
drivers/tty/vt/selection.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/selection.c -* * This module exports the functions: * * 'int set_selection(struct tiocl_selection __user *, struct tty_struct *)'
drivers/tty/vt/vc_screen.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/vc_screen.c -* * Provide access to virtual console memory. * /dev/vcs0: the screen as it is being viewed right now (possibly scrolled) * /dev/vcsN: the screen of /dev/ttyN (1 <= N <= 63)
drivers/tty/vt/vt.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/vt.c -* * Copyright (C) 1991, 1992 Linus Torvalds */
drivers/tty/vt/vt_ioctl.c +0 -2
@@ -1,6 +1,4 @@/* -* linux/drivers/char/vt_ioctl.c -* * Copyright (C) 1992 obz under the linux copyright * * Dynamic diacritical handling - [email protected] - Dec 1993
Signature · 1 line
1.7.4.2
PATCH 22/48 Serial: ifx6x60c: Remove duplicate includes of linux/tty.h
In reply to Greg Kroah-HartmanFrom: Jesper Juhl <[email protected]>
Including linux/tty.h 3 times is a little over the top - once will do.
--- drivers/tty/serial/ifx6x60.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/tty/serial/ifx6x60.c +0 -2
@@ -41,7 +41,6 @@#include <linux/tty.h> #include <linux/device.h> #include <linux/spi/spi.h> -#include <linux/tty.h> #include <linux/kfifo.h> #include <linux/tty_flip.h> #include <linux/timer.h>
@@ -56,7 +55,6 @@#include <linux/sched.h> #include <linux/time.h> #include <linux/wait.h> -#include <linux/tty.h> #include <linux/pm.h> #include <linux/pm_runtime.h> #include <linux/spi/ifx_modem.h>
Signature · 1 line
1.7.4.2
PATCH 23/48 tty: Clean console safely
In reply to Greg Kroah-HartmanFrom: Petr Písař <[email protected]>
Traditional \E[2J sequence erases console display but scroll-back buffer and underlying device (frame) buffer keep data that can be accessed by scrolling console back.
This patch introduce new \E[J parameter 3 that allows to scramble scroll-back buffer explicitly. Session locking programs (screen, vlock) can use it to prevent attacker to browse locked console history.
--- drivers/tty/vt/vt.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/tty/vt/vt.c +7 -0
@@ -1193,6 +1193,13 @@ static void csi_J(struct vc_data *vc, int vpar) vc->vc_x + 1); }break ; +case 3 :/* erase scroll-back buffer (and whole display) */ +scr_memsetw (vc->vc_screenbuf, vc->vc_video_erase_char, + vc->vc_screenbuf_size >>1 ); +set_origin (vc); +if (CON_IS_VISIBLE (vc)) +update_screen (vc); +/* fall through */ case 2 :/* erase whole display */ count = vc->vc_cols * vc->vc_rows; start = (unsigned short *)vc->vc_origin;
Signature · 6 lines
1.7.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 24/48 Serial: Remove unused code.
In reply to Greg Kroah-HartmanFrom: Govindraj.R <[email protected]>
Remove stale code in serial_core layer.
--- drivers/tty/serial/serial_core.c | 11 ----------- 1 files changed, 0 insertions(+), 11 deletions(-)
drivers/tty/serial/serial_core.c +0 -11
@@ -1242,17 +1242,6 @@ static void uart_set_termios(struct tty_struct *tty, }spin_unlock_irqrestore (&state->uart_port->lock, flags); } -#if 0 -/* -* No need to wake up processes in open wait, since they -* sample the CLOCAL flag once, and don't recheck it. -* XXX It's not clear whether the current behavior is correct -* or not. Hence, this may change..... -*/ -if (!(old_termios->c_cflag &CLOCAL ) && - (tty->termios->c_cflag &CLOCAL )) -wake_up_interruptible (&state->uart_port.open_wait); -#endif }/*
Signature · 1 line
1.7.4.2
PATCH 25/48 tty: make receive_buf() return the amout of bytes received
In reply to Greg Kroah-HartmanFrom: Felipe Balbi <[email protected]>
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.
--- drivers/bluetooth/hci_ldisc.c | 12 +++++-- drivers/input/serio/serport.c | 10 +++++- drivers/isdn/gigaset/ser-gigaset.c | 8 +++-- 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/tty/n_gsm.c | 6 ++- drivers/tty/n_hdlc.c | 18 ++++++----- drivers/tty/n_r3964.c | 10 +++-- drivers/tty/n_tty.c | 61 ++++++++--------------------------- drivers/tty/tty_buffer.c | 15 +++++--- drivers/tty/vt/selection.c | 3 +- include/linux/tty_ldisc.h | 9 +++-- 20 files changed, 125 insertions(+), 113 deletions(-)
drivers/bluetooth/hci_ldisc.c +8 -4
@@ -357,22 +357,26 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty)* * Return Value: None */ -static void hci_uart_tty_receive (struct tty_struct *tty,const u8 *data,char *flags,int count) +static unsigned int hci_uart_tty_receive (struct tty_struct *tty, +const u8 *data,char *flags,int count) {struct hci_uart *hu = (void *)tty->disc_data; +int received;if (!hu || tty != hu->tty) -return ; +return -ENODEV ;if (!test_bit (HCI_UART_PROTO_SET , &hu->flags)) -return ; +return -EINVAL ;spin_lock (&hu->rx_lock); - hu->proto->recv (hu, (void *) data, count); + received = hu->proto->recv (hu, (void *) data, count); hu->hdev->stat.byte_rx += count;spin_unlock (&hu->rx_lock);tty_unthrottle (tty); + +return received; }static int hci_uart_register_dev (struct hci_uart *hu)
drivers/input/serio/serport.c +8 -2
@@ -120,17 +120,21 @@ static void serport_ldisc_close(struct tty_struct *tty)* 'interrupt' routine. */ -static void serport_ldisc_receive (struct tty_struct *tty,const unsigned char *cp,char *fp,int count) +static unsigned int serport_ldisc_receive (struct tty_struct *tty, +const unsigned char *cp,char *fp,int count) {struct serport *serport = (struct serport *) tty->disc_data;unsigned long flags;unsigned int ch_flags; +int ret =0 ;int i;spin_lock_irqsave (&serport->lock, flags); -if (!test_bit (SERPORT_ACTIVE , &serport->flags)) +if (!test_bit (SERPORT_ACTIVE , &serport->flags)) { + ret = -EINVAL ; goto out; + }for (i =0 ; i < count; i++) {switch (fp[i]) {
@@ -152,6 +156,8 @@ static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *c out:spin_unlock_irqrestore (&serport->lock, flags); + +return ret ==0 ? count : ret; }/*
drivers/isdn/gigaset/ser-gigaset.c +5 -3
@@ -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 void +static unsigned int gigaset_tty_receive (struct tty_struct *tty,const unsigned char *buf,char *cflags,int count) {
@@ -683,12 +683,12 @@ gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf,struct inbuf_t *inbuf;if (!cs) -return ; +return -ENODEV ; inbuf = cs->inbuf;if (!inbuf) {dev_err (cs->dev,"%s: no inbuf\n" , __func__);cs_put (cs); -return ; +return -EINVAL ; } tail = inbuf->tail;
@@ -725,6 +725,8 @@ gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf,gig_dbg (DEBUG_INTR ,"%s-->BH" , __func__);gigaset_schedule_event (cs);cs_put (cs); + +return count; }/*
drivers/misc/ti-st/st_core.c +4 -2
@@ -744,8 +744,8 @@ static void st_tty_close(struct tty_struct *tty)pr_debug ("%s: done " , __func__); } -static void st_tty_receive (struct tty_struct *tty,const unsigned char *data, -char *tty_flags,int count) +static unsigned int st_tty_receive (struct tty_struct *tty, +const unsigned char *data,char *tty_flags,int count) {#ifdef VERBOSE print_hex_dump(KERN_DEBUG, ">in>", DUMP_PREFIX_NONE,
@@ -758,6 +758,8 @@ static void st_tty_receive(struct tty_struct *tty, const unsigned char *data,*/ st_recv (tty->disc_data, data, count);pr_debug ("done %s" , __func__); + +return count; }/* wake-up function called in from the TTY layer
drivers/net/caif/caif_serial.c +4 -2
@@ -167,8 +167,8 @@ static inline void debugfs_tx(struct ser_device *ser, const u8 *data, int size)#endif -static void ldisc_receive (struct tty_struct *tty,const u8 *data, -char *flags,int count) +static unsigned int ldisc_receive (struct tty_struct *tty, +const u8 *data,char *flags,int count) {struct sk_buff *skb =NULL ;struct ser_device *ser;
@@ -215,6 +215,8 @@ static void ldisc_receive(struct tty_struct *tty, const u8 *data, }else ++ser->dev->stats.rx_dropped;update_tty_status (ser); + +return count; }static int handle_tx (struct ser_device *ser)
drivers/net/can/slcan.c +6 -3
@@ -425,16 +425,17 @@ static void slc_setup(struct net_device *dev)* in parallel */ -static void slcan_receive_buf (struct tty_struct *tty, +static unsigned int slcan_receive_buf (struct tty_struct *tty,const unsigned char *cp,char *fp,int count) {struct slcan *sl = (struct slcan *) tty->disc_data; +int bytes = count;if (!sl || sl->magic !=SLCAN_MAGIC || !netif_running (sl->dev)) -return ; +return -ENODEV ;/* 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++;
@@ -443,6 +444,8 @@ static void slcan_receive_buf(struct tty_struct *tty, }slcan_unesc (sl, *cp++); } + +return count; }/************************************
drivers/net/hamradio/6pack.c +5 -3
@@ -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 void sixpack_receive_buf (struct tty_struct *tty, +static unsigned int sixpack_receive_buf (struct tty_struct *tty,const unsigned char *cp,char *fp,int count) {struct sixpack *sp;
@@ -464,11 +464,11 @@ static void sixpack_receive_buf(struct tty_struct *tty,int count1;if (!count) -return ; +return 0 ; sp =sp_get (tty);if (!sp) -return ; +return -ENODEV ;memcpy (buf, cp, count <sizeof (buf) ? count :sizeof (buf));
@@ -487,6 +487,8 @@ static void sixpack_receive_buf(struct tty_struct *tty,sp_put (sp);tty_unthrottle (tty); + +return count1; }/*
drivers/net/hamradio/mkiss.c +7 -4
@@ -923,13 +923,14 @@ 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 void mkiss_receive_buf (struct tty_struct *tty,const unsigned char *cp, -char *fp,int count) +static unsigned int mkiss_receive_buf (struct tty_struct *tty, +const unsigned char *cp,char *fp,int count) {struct mkiss *ax =mkiss_get (tty); +int bytes = count;if (!ax) -return ; +return -ENODEV ;/* * Argh! mtu change time! - costs us the packet part received
@@ -939,7 +940,7 @@ static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp,ax_changedmtu (ax);/* Read the characters out of the buffer */ -while (count--) { +while (bytes--) {if (fp !=NULL && *fp++) {if (!test_and_set_bit (AXF_ERROR , &ax->flags)) ax->dev->stats.rx_errors++;
@@ -952,6 +953,8 @@ static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp,mkiss_put (ax);tty_unthrottle (tty); + +return count; }/*
drivers/net/irda/irtty-sir.c +9 -7
@@ -216,23 +216,23 @@ static int irtty_do_write(struct sir_dev *dev, const unsigned char *ptr, size_t* usbserial: urb-complete-interrupt / softint */ -static void irtty_receive_buf (struct tty_struct *tty,const unsigned char *cp, -char *fp,int count) +static unsigned int irtty_receive_buf (struct tty_struct *tty, +const unsigned char *cp,char *fp,int count) {struct sir_dev *dev;struct sirtty_cb *priv = tty->disc_data;int i; - IRDA_ASSERT(priv != NULL, return;); - IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return;); + IRDA_ASSERT(priv != NULL, return -ENODEV;); + IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return -EINVAL;);if (unlikely (count==0 ))/* yes, this happens */ -return ; +return 0 ; dev = priv->dev;if (!dev) {IRDA_WARNING ("%s(), not ready yet!\n" , __func__); -return ; +return -ENODEV ; }for (i =0 ; i < count; i++) {
@@ -242,11 +242,13 @@ static void irtty_receive_buf(struct tty_struct *tty, const unsigned char *cp,if (fp && *fp++) {IRDA_DEBUG (0 ,"Framing or parity error!\n" );sirdev_receive (dev,NULL ,0 );/* notify sir_dev (updating stats) */ -return ; +return -EINVAL ; } }sirdev_receive (dev, cp, count); + +return count; }/*
drivers/net/ppp_async.c +4 -2
@@ -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 void +static unsigned int ppp_asynctty_receive (struct tty_struct *tty,const unsigned char *buf,char *cflags,int count) {
@@ -348,7 +348,7 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf,unsigned long flags;if (!ap) -return ; +return -ENODEV ;spin_lock_irqsave (&ap->recv_lock, flags);ppp_async_input (ap, buf, cflags, count);spin_unlock_irqrestore (&ap->recv_lock, flags);
@@ -356,6 +356,8 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf,tasklet_schedule (&ap->tsk);ap_put (ap);tty_unthrottle (tty); + +return count; } static void
drivers/net/ppp_synctty.c +4 -2
@@ -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 void +static unsigned int ppp_sync_receive (struct tty_struct *tty,const unsigned char *buf,char *cflags,int count) {
@@ -389,7 +389,7 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf,unsigned long flags;if (!ap) -return ; +return -ENODEV ;spin_lock_irqsave (&ap->recv_lock, flags);ppp_sync_input (ap, buf, cflags, count);spin_unlock_irqrestore (&ap->recv_lock, flags);
@@ -397,6 +397,8 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf,tasklet_schedule (&ap->tsk);sp_put (ap);tty_unthrottle (tty); + +return count; } static void
drivers/net/slip.c +7 -4
@@ -670,16 +670,17 @@ static void sl_setup(struct net_device *dev)* in parallel */ -static void slip_receive_buf (struct tty_struct *tty,const unsigned char *cp, -char *fp,int count) +static unsigned int slip_receive_buf (struct tty_struct *tty, +const unsigned char *cp,char *fp,int count) {struct slip *sl = tty->disc_data; +int bytes = count;if (!sl || sl->magic !=SLIP_MAGIC || !netif_running (sl->dev)) -return ; +return -ENODEV ;/* 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++;
@@ -693,6 +694,8 @@ static void slip_receive_buf(struct tty_struct *tty, const unsigned char *cp,#endif slip_unesc (sl, *cp++); } + +return count; }/************************************
drivers/net/wan/x25_asy.c +5 -2
@@ -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; }/*
drivers/tty/n_gsm.c +4 -2
@@ -2138,8 +2138,8 @@ static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) gsm->tty =NULL ; } -static void gsmld_receive_buf (struct tty_struct *tty,const unsigned char *cp, -char *fp,int count) +static unsigned int gsmld_receive_buf (struct tty_struct *tty, +const unsigned char *cp,char *fp,int count) {struct gsm_mux *gsm = tty->disc_data;const unsigned char *dp;
@@ -2173,6 +2173,8 @@ static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp, }/* FASYNC if needed ? */ /* If clogged call tty_throttle(tty); */ + +return count; }/**
drivers/tty/n_hdlc.c +10 -8
@@ -188,8 +188,8 @@ 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 void n_hdlc_tty_receive (struct tty_struct *tty,const __u8 *cp, -char *fp,int count); +static unsigned 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);#define bset (p,b) ((p)[(b) >> 5] |= (1 << ((b) & 0x1f)))
@@ -509,8 +509,8 @@ 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 void n_hdlc_tty_receive (struct tty_struct *tty,const __u8 *data, -char *flags,int count) +static unsigned int n_hdlc_tty_receive (struct tty_struct *tty, +const __u8 *data,char *flags,int count) { registerstruct n_hdlc *n_hdlc =tty2n_hdlc (tty); registerstruct n_hdlc_buf *buf;
@@ -521,20 +521,20 @@ static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data,/* This can happen if stuff comes in on the backup tty */ if (!n_hdlc || tty != n_hdlc->tty) -return ; +return -ENODEV ;/* verify line is using HDLC discipline */ if (n_hdlc->magic !=HDLC_MAGIC ) {printk ("%s(%d) line not using HDLC discipline\n" , __FILE__,__LINE__); -return ; +return -EINVAL ; }if ( count>maxframe ) {if (debuglevel >=DEBUG_LEVEL_INFO )printk ("%s(%d) rx count>maxframesize, data discarded\n" , __FILE__,__LINE__); -return ; +return -EINVAL ; }/* get a free HDLC buffer */
@@ -550,7 +550,7 @@ static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data,if (debuglevel >=DEBUG_LEVEL_INFO )printk ("%s(%d) no more rx buffers, data discarded\n" , __FILE__,__LINE__); -return ; +return -EINVAL ; }/* copy received data to HDLC buffer */
@@ -565,6 +565,8 @@ static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data,if (n_hdlc->tty->fasync !=NULL )kill_fasync (&n_hdlc->tty->fasync,SIGIO ,POLL_IN ); +return count; + }/* end of n_hdlc_tty_receive() */ /**
drivers/tty/n_r3964.c +6 -4
@@ -139,8 +139,8 @@ 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 void r3964_receive_buf (struct tty_struct *tty,const unsigned char *cp, -char *fp,int count); +static unsigned 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 = { .owner =THIS_MODULE ,
@@ -1239,8 +1239,8 @@ static unsigned int r3964_poll(struct tty_struct *tty, struct file *file,return result; } -static void r3964_receive_buf (struct tty_struct *tty,const unsigned char *cp, -char *fp,int count) +static unsigned int r3964_receive_buf (struct tty_struct *tty, +const unsigned char *cp,char *fp,int count) {struct r3964_info *pInfo = tty->disc_data;const unsigned char *p;
@@ -1257,6 +1257,8 @@ static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp, } } + +return count; }MODULE_LICENSE ("GPL" );
drivers/tty/n_tty.c +14 -47
145 lines not on this page · raw message
drivers/tty/tty_buffer.c +9 -6
@@ -416,6 +416,7 @@ static void flush_to_ldisc(struct work_struct *work)struct tty_buffer *head, *tail = tty->buf.tail;int seen_tail =0 ;while ((head = tty->buf.head) !=NULL ) { +int copied;int count;char *char_buf;unsigned char *flag_buf;
@@ -442,17 +443,19 @@ static void flush_to_ldisc(struct work_struct *work)line discipline as we want to empty the queue */ if (test_bit (TTY_FLUSHPENDING , &tty->flags))break ; -if (!tty->receive_room || seen_tail) -break ; -if (count > tty->receive_room) - count = tty->receive_room; char_buf = head->char_buf_ptr + head->read; flag_buf = head->flag_buf_ptr + head->read; - head->read += count;spin_unlock_irqrestore (&tty->buf.lock, flags); - disc->ops->receive_buf (tty, char_buf, + copied = disc->ops->receive_buf (tty, char_buf, flag_buf, count);spin_lock_irqsave (&tty->buf.lock, flags); + + head->read += copied; + +if (copied ==0 || seen_tail) { +schedule_work (&tty->buf.work); +break ; + } }clear_bit (TTY_FLUSHING , &tty->flags); }
drivers/tty/vt/selection.c +1 -2
@@ -332,8 +332,7 @@ int paste_selection(struct tty_struct *tty)continue ; } count = sel_buffer_lth - pasted; - count =min (count, tty->receive_room); - tty->ldisc->ops->receive_buf (tty, sel_buffer + pasted, + count = tty->ldisc->ops->receive_buf (tty, sel_buffer + pasted,NULL , count); pasted += count; }
include/linux/tty_ldisc.h +5 -4
@@ -76,7 +76,7 @@* tty device. It is solely the responsibility of the line * discipline to handle poll requests. * -* void (*receive_buf)(struct tty_struct *, const unsigned char *cp, +* unsigned 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
@@ -84,7 +84,8 @@* processing. <cp> is a pointer to the buffer of input * character received by the device. <fp> is a pointer to a * pointer of flag bytes which indicate whether a character was -* received with a parity error, etc. +* received with a parity error, etc. Returns the amount of bytes +* received. * * void (*write_wakeup)(struct tty_struct *); *
@@ -140,8 +141,8 @@ struct tty_ldisc_ops {/* * The following routines are called from below. */ -void (*receive_buf)(struct tty_struct *,const unsigned char *cp, -char *fp,int count); +unsigned 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 ,struct pps_event_time *);
Signature · 1 line
1.7.4.2
PATCH 26/48 Char: nozomi, use GFP_KERNEL for kfifo allocation
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
The allocation was moved to probe function in 9842c38e9176. And we can sleep there. So allocate the 4*8192 bytes as GFP_KERNEL to mitigate the allocation failure.
--- drivers/tty/nozomi.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/tty/nozomi.c +2 -2
@@ -1431,8 +1431,8 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev, }for (i =PORT_MDM ; i <MAX_PORT ; i++) { -if (kfifo_alloc (&dc->port[i].fifo_ul, -FIFO_BUFFER_SIZE_UL ,GFP_ATOMIC )) { +if (kfifo_alloc (&dc->port[i].fifo_ul,FIFO_BUFFER_SIZE_UL , +GFP_KERNEL )) {dev_err (&pdev->dev,"Could not allocate kfifo buffer\n" ); ret = -ENOMEM ;
Signature · 1 line
1.7.4.2
PATCH 27/48 Char: nozomi, remove port.count checks
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
Before 33dd474a, these were some kind of protection against race with HUP. They were protected with port->tty_sem at the same time.
By that commit, the counting was switched to tty_port's one, but the locking remained the old one. So the count was not protected by any lock anymore.
The driver should not test whether it raced with HUP or not anyways. With the new refcounted tty model, it just should proceed as nothing happened because all needed info is still there. In respect to this, let's drop the useless and unprotected tests (tty_port->count is protected by tty_port->lock).
--- drivers/tty/nozomi.c | 13 +------------ 1 files changed, 1 insertions(+), 12 deletions(-)
drivers/tty/nozomi.c +1 -12
@@ -1690,11 +1690,6 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer,mutex_lock (&port->tty_sem); -if (unlikely (!port->port.count)) { -DBG1 (" " ); - goto exit; - } - rval =kfifo_in (&port->fifo_ul, (unsigned char *)buffer, count);/* notify card */
@@ -1740,8 +1735,7 @@ static int ntty_write_room(struct tty_struct *tty)if (dc) {mutex_lock (&port->tty_sem); -if (port->port.count) - room =kfifo_avail (&port->fifo_ul); + room =kfifo_avail (&port->fifo_ul);mutex_unlock (&port->tty_sem); }return room;
@@ -1889,11 +1883,6 @@ static s32 ntty_chars_in_buffer(struct tty_struct *tty) goto exit_in_buffer; } -if (unlikely (!port->port.count)) { -dev_err (&dc->pdev->dev,"No tty open?\n" ); - goto exit_in_buffer; - } - rval =kfifo_len (&port->fifo_ul); exit_in_buffer:
Signature · 1 line
1.7.4.2
PATCH 28/48 Char: nozomi, remove useless tty_sem
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
tty_sem used to protect tty open count. This was removed in 33dd474a but the lock remained in place.
So remove it completely as it protects nothing now.
Also this solves Mac's problem with inatomic operation called from atomic context (ppp):
BUG: scheduling while atomic: firefox-bin/1992/0x10000800 Modules linked in: ... Pid: 1992, comm: firefox-bin Not tainted 2.6.38 #1 Call Trace:
...
[] ? mutex_lock+0xe/0x21
[] ? ntty_write+0x5d/0x192 [nozomi]
[] ? __mod_timer.clone.30+0xbe/0xcc
[] ? check_preempt_curr+0x60/0x6d
[] ? __nf_ct_refresh_acct+0x75/0xbe
[] ? ppp_async_push+0xa9/0x3bd [ppp_async]
[] ? ppp_async_send+0x34/0x40 [ppp_async]
[] ? ppp_push+0x6c/0x4f9 [ppp_generic]
...
--- drivers/tty/nozomi.c | 12 ++---------- 1 files changed, 2 insertions(+), 10 deletions(-)
drivers/tty/nozomi.c +2 -10
@@ -364,8 +364,6 @@ struct port {u8 toggle_ul;u16 token_dl; -/* mutex to ensure one access patch to this port */ -struct mutex tty_sem;wait_queue_head_t tty_wait;struct async_icount tty_icount;
@@ -1474,7 +1472,6 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev,struct device *tty_dev;struct port *port = &dc->port[i]; port->dc = dc; -mutex_init (&port->tty_sem);tty_port_init (&port->port); port->port.ops = &noz_tty_port_ops; tty_dev = tty_register_device(ntty_driver, dc->index_start + i,
@@ -1688,8 +1685,6 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer,if (!dc || !port)return -ENODEV ; -mutex_lock (&port->tty_sem); - rval =kfifo_in (&port->fifo_ul, (unsigned char *)buffer, count);/* notify card */
@@ -1714,7 +1709,6 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer,spin_unlock_irqrestore (&dc->spin_mutex, flags); exit: -mutex_unlock (&port->tty_sem);return rval; }
@@ -1733,11 +1727,9 @@ static int ntty_write_room(struct tty_struct *tty)int room =4096 ;const struct nozomi *dc =get_dc_by_tty (tty); -if (dc) { -mutex_lock (&port->tty_sem); +if (dc) room =kfifo_avail (&port->fifo_ul); -mutex_unlock (&port->tty_sem); - } +return room; }
Signature · 1 line
1.7.4.2
PATCH 29/48 Char: moxa, fix locking in moxa_write
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
moxa_write can be called from atomic context with irqs disabled (from ppp_async_push). Don't enable interrupts by spin_unlock_bh as this might cause deadlocks in the ppp layer.
Instead, use irqsave/irqrestore spin_lock functions.
--- drivers/tty/moxa.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/tty/moxa.c +3 -2
@@ -1202,14 +1202,15 @@ static int moxa_write(struct tty_struct *tty, const unsigned char *buf, int count) {struct moxa_port *ch = tty->driver_data; +unsigned long flags;int len;if (ch ==NULL )return 0 ; -spin_lock_bh (&moxa_lock); +spin_lock_irqsave (&moxa_lock, flags); len =MoxaPortWriteData (tty, buf, count); -spin_unlock_bh (&moxa_lock); +spin_unlock_irqrestore (&moxa_lock, flags);set_bit (LOWWAIT , &ch->statusflags);return len;
Signature · 1 line
1.7.4.2
PATCH 30/48 TTY: serial_core, remove invalid test
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
tty->index (named here as line) is set up in initialize_tty_struct. The value is checked in get_tty_driver for the found driver as:
if (device < base || device >= base + p->num) continue; *index = device - base;
So index/line can never be more than driver->num. Hence remove this test from uart_open.
--- drivers/tty/serial/serial_core.c | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-)
drivers/tty/serial/serial_core.c +0 -9
@@ -1530,15 +1530,6 @@ static int uart_open(struct tty_struct *tty, struct file *filp)pr_debug ("uart_open(%d) called\n" , line);/* -* tty->driver->num won't change, so we won't fail here with -* tty->driver_data set to something non-NULL (and therefore -* we won't get caught by uart_close()). -*/ - retval = -ENODEV ; -if (line >= tty->driver->num) - goto fail; - -/* * We take the semaphore inside uart_get to guarantee that we won't * be re-entered while allocating the state structure, or while we * request any IRQs that the driver may need. This also has the nice
Signature · 1 line
1.7.4.2
PATCH 31/48 TTY: serial_core, remove superfluous set_task_state
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
msleep* is guaranteed to return with TASK_RUNNING task state. And since there is no other set_task_state in the paths of uart_wait_until_sent, we need not to set_task_state to TASK_RUNNING.
--- drivers/tty/serial/serial_core.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/tty/serial/serial_core.c +0 -1
@@ -1414,7 +1414,6 @@ static void __uart_wait_until_sent(struct uart_port *port, int timeout)if (time_after (jiffies, expire))break ; } -set_current_state (TASK_RUNNING );/* might not be needed */ }static void uart_wait_until_sent (struct tty_struct *tty,int timeout)
Signature · 1 line
1.7.4.2
PATCH 32/48 TTY: tty_io, annotate locking functions
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
tty_write_lock and tty_write_unlock contain imbalanced locking. But this is intentional, so mark them appropriately by __acquires/__releases.
--- drivers/tty/tty_io.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/tty/tty_io.c +2 -0
@@ -962,12 +962,14 @@ static ssize_t tty_read(struct file *file, char __user *buf, size_t count, }void tty_write_unlock (struct tty_struct *tty) + __releases(&tty->atomic_write_lock) {mutex_unlock (&tty->atomic_write_lock);wake_up_interruptible_poll (&tty->write_wait,POLLOUT ); }int tty_write_lock (struct tty_struct *tty,int ndelay) + __acquires(&tty->atomic_write_lock) {if (!mutex_trylock (&tty->atomic_write_lock)) {if (ndelay)
Signature · 1 line
1.7.4.2
PATCH 33/48 drivers/tty/moxa.c: Put correct tty value
In reply to Greg Kroah-HartmanFrom: Julia Lawall <[email protected]>
The tty value that should be put is the one that was just gotten by tty_port_tty_get, not the one that is the argument to the enclosing function.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@exists@
local idexpression struct tty_struct *x;
expression ra,rr;
statement S1,S2;
@@
x = tty_port_tty_get(...)
... when != x = rr
when any
when != tty_kref_put(x,...)
when != if (...) { ... tty_kref_put(x,...) ...}(
if(<+...x...+>) S1 else S2
|
if(...) { ... when != x = ra
when forall
when != tty_kref_put(x,...)*return...;
}
)
// </smpl>
--- drivers/tty/moxa.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/tty/moxa.c +1 -1
@@ -371,7 +371,7 @@ static int moxa_ioctl(struct tty_struct *tty, tmp.cflag = p->cflag; else tmp.cflag = ttyp->termios->c_cflag; -tty_kref_put (tty); +tty_kref_put (ttyp); copy:if (copy_to_user (argm, &tmp,sizeof (tmp)))return -EFAULT ;
Signature · 1 line
1.7.4.2
PATCH 34/48 n_gsm: Use print_hex_dump_bytes
In reply to Greg Kroah-HartmanFrom: Joe Perches <[email protected]>
Use the standard mechanism to print a hex buffer to eliminate empty printf warning.
A couple % smaller text and data too.
$ size drivers/tty/n_gsm.o* text data bss dec hex filename 23543 312 6376 30231 7617 drivers/tty/n_gsm.o.new 24051 408 6496 30955 78eb drivers/tty/n_gsm.o.old
--- drivers/tty/n_gsm.c | 35 ++++++++++------------------------- 1 files changed, 10 insertions(+), 25 deletions(-)
drivers/tty/n_gsm.c +10 -25
@@ -526,19 +526,6 @@ static int gsm_stuff_frame(const u8 *input, u8 *output, int len)return olen; } -static void hex_packet (const unsigned char *p,int len) -{ -int i; -for (i =0 ; i < len; i++) { -if (i && (i %16 ) ==0 ) { -pr_cont ("\n" ); -pr_debug ("" ); - } -pr_cont ("%02X " , *p++); - } -pr_cont ("\n" ); -} -/** * gsm_send - send a control frame * @gsm: our GSM mux
@@ -685,10 +672,10 @@ static void gsm_data_kick(struct gsm_mux *gsm) len = msg->len +2 ; } -if (debug &4 ) { -pr_debug ("gsm_data_kick:\n" ); -hex_packet (gsm->txframe, len); - } +if (debug &4 ) +print_hex_dump_bytes ("gsm_data_kick: " , +DUMP_PREFIX_OFFSET , + gsm->txframe, len);if (gsm->output (gsm, gsm->txframe + skip_sof, len - skip_sof) <0 )
@@ -2091,10 +2078,9 @@ static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len)set_bit (TTY_DO_WRITE_WAKEUP , &gsm->tty->flags);return -ENOSPC ; } -if (debug &4 ) { -pr_debug ("-->%d bytes out\n" , len); -hex_packet (data, len); - } +if (debug &4 ) +print_hex_dump_bytes ("gsmld_output: " ,DUMP_PREFIX_OFFSET , + data, len); gsm->tty->ops->write (gsm->tty, data, len);return len; }
@@ -2148,10 +2134,9 @@ static unsigned int gsmld_receive_buf(struct tty_struct *tty,char buf[64 ];char flags; -if (debug &4 ) { -pr_debug ("Inbytes %dd\n" , count); -hex_packet (cp, count); - } +if (debug &4 ) +print_hex_dump_bytes ("gsmld_receive: " ,DUMP_PREFIX_OFFSET , + cp, count);for (i = count, dp = cp, f = fp; i; i--, dp++) { flags = *f++;
Signature · 1 line
1.7.4.2
PATCH 35/48 tty/serial: add support for Xilinx PS UART
In reply to Greg Kroah-HartmanFrom: John Linn <[email protected]>
The Xilinx PS Uart is used on the new ARM based SoC. This UART is not compatible with others such that a seperate driver is required.
--- drivers/tty/serial/Kconfig | 13 + drivers/tty/serial/Makefile | 1 + drivers/tty/serial/xilinx_uartps.c | 1113 ++++++++++++++++++++++++++++++++++++ include/linux/serial_core.h | 3 + 4 files changed, 1130 insertions(+), 0 deletions(-) create mode 100644 drivers/tty/serial/xilinx_uartps.c
drivers/tty/serial/Kconfig +13 -0
@@ -1612,4 +1612,17 @@ config SERIAL_MXS_AUART_CONSOLE help Enable a MXS AUART port to be the system console. +config SERIAL_XILINX_PS_UART + tristate "Xilinx PS UART support" + select SERIAL_CORE + help + This driver supports the Xilinx PS UART port. + +config SERIAL_XILINX_PS_UART_CONSOLE + bool "Xilinx PS UART console support" + depends on SERIAL_XILINX_PS_UART=y + select SERIAL_CORE_CONSOLE + help + Enable a Xilinx PS UART port to be the system console. + endmenu
drivers/tty/serial/Makefile +1 -0
@@ -94,3 +94,4 @@ obj-$(CONFIG_SERIAL_IFX6X60) += ifx6x60.o obj-$(CONFIG_SERIAL_PCH_UART) += pch_uart.o obj-$(CONFIG_SERIAL_MSM_SMD) += msm_smd_tty.o obj-$(CONFIG_SERIAL_MXS_AUART) += mxs-auart.o +obj-$(CONFIG_SERIAL_XILINX_PS_UART) += xilinx_uartps.o
drivers/tty/serial/xilinx_uartps.c new file +1113 -0
1,113 lines not on this page · raw message
include/linux/serial_core.h +3 -0
@@ -202,6 +202,9 @@/* VIA VT8500 SoC */ #define PORT_VT8500 97 +/* Xilinx PSS UART */ +#define PORT_XUARTPS 98 +#ifdef __KERNEL__#include <linux/compiler.h>
Signature · 1 line
1.7.4.2
PATCH 36/48 parport: Use request_muxed_region for IT87 probe and lock
In reply to Greg Kroah-HartmanFrom: Alan Cox <[email protected]>
This is needed as part of making the various IT87 drivers actually co-exist politely with each other, and with other superio devices that may be muxed on 0x2E/0x2F.
It can be applied before or after the other patches by Nat Gurumoorthy without problem.
--- drivers/parport/parport_pc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/parport/parport_pc.c +1 -1
@@ -1621,7 +1621,7 @@ static void __devinit detect_and_report_it87(void)u8 origval, r;if (verbose_probing)printk (KERN_DEBUG "IT8705 Super-IO detection, now testing port 2E ...\n" ); -if (!request_region (0x2e ,2 , __func__)) +if (!request_muxed_region (0x2e ,2 , __func__))return ; origval =inb (0x2e );/* Save original value */ outb (0x87 ,0x2e );
Signature · 1 line
1.7.4.2
PATCH 37/48 pch_uart: Support new device ML7223 IOH
In reply to Greg Kroah-HartmanFrom: Tomoya MORINAGA <[email protected]>
Support new device OKI SEMICONDUCTOR ML7223 IOH(Input/Output Hub). The ML7223 IOH is for MP(Media Phone) use.
The ML7223 is companion chip for Intel Atom E6xx series. The ML7223 is completely compatible for Intel EG20T PCH.
--- drivers/tty/serial/Kconfig | 12 +++++++----- drivers/tty/serial/pch_uart.c | 8 ++++++++ 2 files changed, 15 insertions(+), 5 deletions(-)
drivers/tty/serial/Kconfig +7 -5
@@ -1577,7 +1577,7 @@ config SERIAL_IFX6X60 Support for the IFX6x60 modem devices on Intel MID platforms. config SERIAL_PCH_UART - tristate "Intel EG20T PCH UART/OKI SEMICONDUCTOR ML7213 IOH" + tristate "Intel EG20T PCH / OKI SEMICONDUCTOR IOH(ML7213/ML7223) UART" depends on PCI select SERIAL_CORE help
@@ -1585,10 +1585,12 @@ config SERIAL_PCH_UART which is an IOH(Input/Output Hub) for x86 embedded processor. Enabling PCH_DMA, this PCH UART works as DMA mode. - This driver also can be used for OKI SEMICONDUCTOR ML7213 IOH(Input/ - Output Hub) which is for IVI(In-Vehicle Infotainment) use. - ML7213 is companion chip for Intel Atom E6xx series. - ML7213 is completely compatible for Intel EG20T PCH. + This driver also can be used for OKI SEMICONDUCTOR IOH(Input/ + Output Hub), ML7213 and ML7223. + ML7213 IOH is for IVI(In-Vehicle Infotainment) use and ML7223 IOH is + for MP(Media Phone) use. + ML7213/ML7223 is companion chip for Intel Atom E6xx series. + ML7213/ML7223 is completely compatible for Intel EG20T PCH. config SERIAL_MSM_SMD bool "Enable tty device interface for some SMD ports"
drivers/tty/serial/pch_uart.c +8 -0
@@ -253,6 +253,8 @@ enum pch_uart_num_t { pch_ml7213_uart0, pch_ml7213_uart1, pch_ml7213_uart2, + pch_ml7223_uart0, + pch_ml7223_uart1, }; static struct pch_uart_driver_data drv_dat[] = {
@@ -263,6 +265,8 @@ static struct pch_uart_driver_data drv_dat[] = { [pch_ml7213_uart0] = {PCH_UART_8LINE, 0}, [pch_ml7213_uart1] = {PCH_UART_2LINE, 1}, [pch_ml7213_uart2] = {PCH_UART_2LINE, 2}, + [pch_ml7223_uart0] = {PCH_UART_8LINE, 0}, + [pch_ml7223_uart1] = {PCH_UART_2LINE, 1}, };static unsigned int default_baud =9600 ;
@@ -1534,6 +1538,10 @@ static DEFINE_PCI_DEVICE_TABLE(pch_uart_pci_id) = { .driver_data = pch_ml7213_uart1}, {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8029), .driver_data = pch_ml7213_uart2}, + {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x800C), + .driver_data = pch_ml7223_uart0}, + {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x800D), + .driver_data = pch_ml7223_uart1}, {0,}, };
Signature · 1 line
1.7.4.2
PATCH 38/48 ASoC: Update cx20442 for TTY API change
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
receive_buf() was recently changed to return the number of bytes received but the cx20442 driver wasn't updated to match the new API. I don't have any hardware but since we don't actually appears to be listening to the data at all just report that we accepted all the data that was offered to us.
--- sound/soc/codecs/cx20442.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
sound/soc/codecs/cx20442.c +5 -3
@@ -274,14 +274,14 @@ static int v253_hangup(struct tty_struct *tty) }/* Line discipline .receive_buf() */ -static void v253_receive (struct tty_struct *tty, -const unsigned char *cp,char *fp,int count) +static unsigned int v253_receive (struct tty_struct *tty, +const unsigned char *cp,char *fp,int count) {struct snd_soc_codec *codec = tty->disc_data;struct cx20442_priv *cx20442;if (!codec) -return ; +return count; cx20442 =snd_soc_codec_get_drvdata (codec);
@@ -293,6 +293,8 @@ static void v253_receive(struct tty_struct *tty, codec->hw_write = (hw_write_t )tty->ops->write; codec->card->pop_time =1 ; } + +return count; }/* Line discipline .write_wakeup() */
Signature · 1 line
1.7.4.2
PATCH 39/48 8250_pci: Add support for the Digi/IBM PCIe 2-port Adapter
In reply to Greg Kroah-HartmanFrom: Scott Kilau <[email protected]>
Add support to the 8250 PCI serial driver for the Digi/IBM PCIe 2-port Async EIA-232 Adapter.
Oxford Semiconductor produces a 2/4/8 port UART (OXPCIe952/OXPCIe954/OXPCIe958) chip called the Tornado, that can be used to create a very simple serial board product. The kernel sources currently have just 2 vendors using this chip, which is Oxford and Mainpipe. This new Digi/IBM serial product now uses it as well.
Rather than create a long running comment of vendors using the chip, the one changed comment in the patch below now just lists "For Oxford Semiconductor Tornado based devices" to be a more generic comment for all vendors that end up using the Oxford Tornado chip.
--- drivers/tty/serial/8250_pci.c | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-)
drivers/tty/serial/8250_pci.c +18 -1
@@ -1010,6 +1010,7 @@ static int skip_tx_en_setup(struct serial_private *priv,#define PCI_DEVICE_ID_TITAN_200EI 0xA016#define PCI_DEVICE_ID_TITAN_200EISI 0xA017#define PCI_DEVICE_ID_OXSEMI_16PCI958 0x9538 +#define PCIE_DEVICE_ID_NEO_2_OX_IBM 0x00F6/* Unknown vendors/cards - this should not be in linux/pci_ids.h */ #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584
@@ -1410,7 +1411,7 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { .setup = pci_default_setup, },/* -* For Oxford Semiconductor and Mainpine +* For Oxford Semiconductor Tornado based devices */ { .vendor = PCI_VENDOR_ID_OXSEMI,
@@ -1428,6 +1429,14 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { .init = pci_oxsemi_tornado_init, .setup = pci_default_setup, }, + { + .vendor = PCI_VENDOR_ID_DIGI, + .device = PCIE_DEVICE_ID_NEO_2_OX_IBM, + .subvendor = PCI_SUBVENDOR_ID_IBM, + .subdevice = PCI_ANY_ID, + .init = pci_oxsemi_tornado_init, + .setup = pci_default_setup, + },/* * Default "match everything" terminator entry */
@@ -3073,6 +3082,14 @@ static struct pci_device_id serial_pci_tbl[] = { {PCI_VENDOR_ID_MAINPINE ,0x4000 ,/* IQ Express 8 Port V.34 Super-G3 Fax */ PCI_VENDOR_ID_MAINPINE ,0x4008 ,0 ,0 , pbn_oxsemi_8_4000000 }, + +/* +* Digi/IBM PCIe 2-port Async EIA-232 Adapter utilizing OxSemi Tornado +*/ + { PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_2_OX_IBM, +PCI_SUBVENDOR_ID_IBM ,PCI_ANY_ID ,0 ,0 , + pbn_oxsemi_2_4000000 }, +/* * SBS Technologies, Inc. P-Octal and PMC-OCTPRO cards, * from [email protected]
Signature · 1 line
1.7.4.2
PATCH 40/48 pch_phub: Support new device ML7223
In reply to Greg Kroah-HartmanFrom: Tomoya MORINAGA <[email protected]>
Support new device OKI SEMICONDUCTOR ML7223 IOH(Input/Output Hub). The ML7223 IOH is for MP(Media Phone) use.
The ML7223 is companion chip for Intel Atom E6xx series. The ML7223 is completely compatible for Intel EG20T PCH.
--- drivers/misc/Kconfig | 12 ++-- drivers/misc/pch_phub.c | 153 +++++++++++++++++++++++++++++++++++++++------- 2 files changed, 136 insertions(+), 29 deletions(-)
drivers/misc/Kconfig +7 -5
@@ -459,7 +459,7 @@ config BMP085 module will be called bmp085. config PCH_PHUB - tristate "PCH Packet Hub of Intel Topcliff / OKI SEMICONDUCTOR ML7213" + tristate "Intel EG20T PCH / OKI SEMICONDUCTOR IOH(ML7213/ML7223) PHUB" depends on PCI help This driver is for PCH(Platform controller Hub) PHUB(Packet Hub) of
@@ -467,10 +467,12 @@ config PCH_PHUB processor. The Topcliff has MAC address and Option ROM data in SROM. This driver can access MAC address and Option ROM data in SROM. - This driver also can be used for OKI SEMICONDUCTOR's ML7213 which is - for IVI(In-Vehicle Infotainment) use. - ML7213 is companion chip for Intel Atom E6xx series. - ML7213 is completely compatible for Intel EG20T PCH. + This driver also can be used for OKI SEMICONDUCTOR IOH(Input/ + Output Hub), ML7213 and ML7223. + ML7213 IOH is for IVI(In-Vehicle Infotainment) use and ML7223 IOH is + for MP(Media Phone) use. + ML7213/ML7223 is companion chip for Intel Atom E6xx series. + ML7213/ML7223 is completely compatible for Intel EG20T PCH. To compile this driver as a module, choose M here: the module will be called pch_phub.
drivers/misc/pch_phub.c +129 -24
258 lines not on this page · raw message
Signature · 1 line
1.7.4.2
PATCH 41/48 tty: Remove to support serial for S5P6442
In reply to Greg Kroah-HartmanFrom: Kukjin Kim <[email protected]>
According to removing ARCH_S5P6442, we don't need to support serial for S5P6442.
--- drivers/tty/serial/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/tty/serial/Kconfig +1 -1
@@ -537,7 +537,7 @@ config SERIAL_S3C6400 config SERIAL_S5PV210 tristate "Samsung S5PV210 Serial port support" - depends on SERIAL_SAMSUNG && (CPU_S5PV210 || CPU_S5P6442 || CPU_EXYNOS4210) + depends on SERIAL_SAMSUNG && (CPU_S5PV210 || CPU_EXYNOS4210) select SERIAL_SAMSUNG_UARTS_4 if (CPU_S5PV210 || CPU_EXYNOS4210) default y help
Signature · 1 line
1.7.4.2
PATCH 42/48 export kernel call get_task_comm().
In reply to Greg Kroah-HartmanFrom: J Freyensee <[email protected]>
This allows drivers who call this function to be compiled modularly. Otherwise, a driver who is interested in this type of functionality has to implement their own get_task_comm() call, causing code duplication in the Linux source tree.
--- fs/exec.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
fs/exec.c +1 -0
@@ -1004,6 +1004,7 @@ char *get_task_comm(char *buf, struct task_struct *tsk)task_unlock (tsk);return buf; } +EXPORT_SYMBOL_GPL (get_task_comm);void set_task_comm (struct task_struct *tsk,char *buf) {
Signature · 1 line
1.7.4.2
PATCH 43/48 Kernel documentation for the PTI feature.
In reply to Greg Kroah-HartmanFrom: J Freyensee <[email protected]>
This provides Kernel documentation for the PTI
feature and setting line discipline drivers
on top of tty's for Linux mobile solutions.
--- Documentation/pti/pti_intel_mid.txt | 99 +++++++++++++++++++++++++++++++++++ 1 files changed, 99 insertions(+), 0 deletions(-) create mode 100644 Documentation/pti/pti_intel_mid.txt
Documentation/pti/pti_intel_mid.txt new file +99 -0
@@ -0,0 +1,99 @@ +The Intel MID PTI project is HW implemented in Intel Atom +system-on-a-chip designs based on the Parallel Trace +Interface for MIPI P1149.7 cJTAG standard. The kernel solution +for this platform involves the following files: + +./include/linux/pti.h +./drivers/.../n_tracesink.h +./drivers/.../n_tracerouter.c +./drivers/.../n_tracesink.c +./drivers/.../pti.c + +pti.c is the driver that enables various debugging features +popular on platforms from certain mobile manufacturers. +n_tracerouter.c and n_tracesink.c allow extra system information to +be collected and routed to the pti driver, such as trace +debugging data from a modem. Although n_tracerouter +and n_tracesink are a part of the complete PTI solution, +these two line disciplines can work separately from +pti.c and route any data stream from one /dev/tty node +to another /dev/tty node via kernel-space. This provides +a stable, reliable connection that will not break unless +the user-space application shuts down (plus avoids +kernel->user->kernel context switch overheads of routing +data). + +An example debugging usage for this driver system: + *Hook /dev/ttyPTI0 to syslogd. Opening this port will also start + a console device to further capture debugging messages to PTI. + *Hook /dev/ttyPTI1 to modem debugging data to write to PTI HW. + This is where n_tracerouter and n_tracesink are used. + *Hook /dev/pti to a user-level debugging application for writing + to PTI HW. + *Use mipi_* Kernel Driver API in other device drivers for + debugging to PTI by first requesting a PTI write address via + mipi_request_masterchannel(1). + +Below is example pseudo-code on how a 'privileged' application +can hook up n_tracerouter and n_tracesink to any tty on +a system. 'Privileged' means the application has enough +privileges to successfully manipulate the ldisc drivers +but is not just blindly executing as 'root'. Keep in mind +the use of ioctl(,TIOCSETD,) is not specific to the n_tracerouter +and n_tracesink line discpline drivers but is a generic +operation for a program to use a line discpline driver +on a tty port other than the default n_tty. + +/////////// To hook up n_tracerouter and n_tracesink ///////// + +// Note that n_tracerouter depends on n_tracesink. +#include <errno.h> +#define ONE_TTY "/dev/ttyOne" +#define TWO_TTY "/dev/ttyTwo" + +// needed global to hand onto ldisc connection +static int g_fd_source = -1; +static int g_fd_sink = -1; + +// these two vars used to grab LDISC values from loaded ldisc drivers +// in OS. Look at /proc/tty/ldiscs to get the right numbers from +// the ldiscs loaded in the system. +int source_ldisc_num, sink_ldisc_num = -1; +int retval; + +g_fd_source = open(ONE_TTY, O_RDWR); // must be R/W +g_fd_sink = open(TWO_TTY, O_RDWR); // must be R/W + +if (g_fd_source <= 0) || (g_fd_sink <= 0) { + // doubt you'll want to use these exact error lines of code + printf("Error on open(). errno: %d\n",errno); + return errno; +} + +retval = ioctl(g_fd_sink, TIOCSETD, &sink_ldisc_num); +if (retval < 0) { + printf("Error on ioctl(). errno: %d\n", errno); + return errno; +} + +retval = ioctl(g_fd_source, TIOCSETD, &source_ldisc_num); +if (retval < 0) { + printf("Error on ioctl(). errno: %d\n", errno); + return errno; +} + +/////////// To disconnect n_tracerouter and n_tracesink //////// + +// First make sure data through the ldiscs has stopped. + +// Second, disconnect ldiscs. This provides a +// little cleaner shutdown on tty stack. +sink_ldisc_num = 0; +source_ldisc_num = 0; +ioctl(g_fd_uart, TIOCSETD, &sink_ldisc_num); +ioctl(g_fd_gadget, TIOCSETD, &source_ldisc_num); + +// Three, program closes connection, and cleanup: +close(g_fd_uart); +close(g_fd_gadget); +g_fd_uart = g_fd_gadget = NULL;
Signature · 1 line
1.7.4.2
PATCH 44/48 Intel PTI implementaiton of MIPI 1149.7.
In reply to Greg Kroah-HartmanFrom: J Freyensee <[email protected]>
The PTI (Parallel Trace Interface) driver directs trace data routed from various parts in the system out through an Intel Penwell PTI port and out of the mobile device for analysis with a debugging tool (Lauterbach or Fido). Though n_tracesink and n_tracerouter line discipline drivers are used to extract modem tracing data to the PTI driver and other parts of an Intel mobile solution, the PTI driver can be used independent of n_tracesink and n_tracerouter.
You should select this driver if the target kernel is meant for an Intel Atom (non-netbook) mobile device containing a MIPI P1149.7 standard implementation.
--- drivers/misc/Kconfig | 13 + drivers/misc/Makefile | 1 + drivers/misc/pti.c | 980 +++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/pti.h | 42 +++ 4 files changed, 1036 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/pti.c create mode 100644 include/linux/pti.h
drivers/misc/Kconfig +13 -0
@@ -144,6 +144,19 @@ config PHANTOM If you choose to build module, its name will be phantom. If unsure, say N here. +config INTEL_MID_PTI + tristate "Parallel Trace Interface for MIPI P1149.7 cJTAG standard" + default n + help + The PTI (Parallel Trace Interface) driver directs + trace data routed from various parts in the system out + through an Intel Penwell PTI port and out of the mobile + device for analysis with a debugging tool (Lauterbach or Fido). + + You should select this driver if the target kernel is meant for + an Intel Atom (non-netbook) mobile device containing a MIPI + P1149.7 standard implementation. + config SGI_IOC4 tristate "SGI IOC4 Base IO support" depends on PCI
drivers/misc/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_IBM_ASM) += ibmasm/ obj-$(CONFIG_AD525X_DPOT) += ad525x_dpot.o obj-$(CONFIG_AD525X_DPOT_I2C) += ad525x_dpot-i2c.o obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o +0bj-$(CONFIG_INTEL_MID_PTI) += pti.o obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o
drivers/misc/pti.c new file +980 -0
980 lines not on this page · raw message
include/linux/pti.h new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
1.7.4.2
PATCH 45/48 n_tracerouter and n_tracesink ldisc additions.
In reply to Greg Kroah-HartmanFrom: J Freyensee <[email protected]>
The n_tracerouter and n_tracesink line discpline drivers use the Linux tty line discpline framework to route trace data coming from a tty port (say UART for example) to the trace sink line discipline driver and to another tty port(say USB). Those these two line discipline drivers can be used together, independently from pti.c, they are part of the original implementation solution of the MIPI P1149.7, compact JTAG, PTI solution for Intel mobile platforms starting with the Medfield platform.
--- drivers/tty/Kconfig | 31 ++++++ drivers/tty/Makefile | 2 + drivers/tty/n_tracerouter.c | 243 +++++++++++++++++++++++++++++++++++++++++++ drivers/tty/n_tracesink.c | 238 ++++++++++++++++++++++++++++++++++++++++++ drivers/tty/n_tracesink.h | 36 +++++++ include/linux/tty.h | 2 + 6 files changed, 552 insertions(+), 0 deletions(-) create mode 100644 drivers/tty/n_tracerouter.c create mode 100644 drivers/tty/n_tracesink.c create mode 100644 drivers/tty/n_tracesink.h
drivers/tty/Kconfig +31 -0
@@ -319,3 +319,34 @@ config N_GSM This line discipline provides support for the GSM MUX protocol and presents the mux as a set of 61 individual tty devices. +config TRACE_ROUTER + tristate "Trace data router for MIPI P1149.7 cJTAG standard" + depends on TRACE_SINK + default n + help + The trace router uses the Linux tty line discipline framework to + route trace data coming from a tty port (say UART for example) to + the trace sink line discipline driver and to another tty port (say + USB). This is part of a solution for the MIPI P1149.7, compact JTAG, + standard, which is for debugging mobile devices. The PTI driver in + drivers/misc/pti.c defines the majority of this MIPI solution. + + You should select this driver if the target kernel is meant for + a mobile device containing a modem. Then you will need to select + "Trace data sink for MIPI P1149.7 cJTAG standard" line discipline + driver. + +config TRACE_SINK + tristate "Trace data sink for MIPI P1149.7 cJTAG standard" + default n + help + The trace sink uses the Linux line discipline framework to receive + trace data coming from the trace router line discipline driver + to a user-defined tty port target, like USB. + This is to provide a way to extract modem trace data on + devices that do not have a PTI HW module, or just need modem + trace data to come out of a different HW output port. + This is part of a solution for the P1149.7, compact JTAG, standard. + + If you select this option, you need to select + "Trace data router for MIPI P1149.7 cJTAG standard".
drivers/tty/Makefile +2 -0
@@ -6,6 +6,8 @@ obj-$(CONFIG_AUDIT) += tty_audit.o obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o obj-$(CONFIG_N_HDLC) += n_hdlc.o obj-$(CONFIG_N_GSM) += n_gsm.o +obj-$(CONFIG_TRACE_ROUTER) += n_tracerouter.o +obj-$(CONFIG_TRACE_SINK) += n_tracesink.o obj-$(CONFIG_R3964) += n_r3964.o obj-y += vt/
drivers/tty/n_tracerouter.c new file +243 -0
243 lines not on this page · raw message
drivers/tty/n_tracesink.c new file +238 -0
238 lines not on this page · raw message
drivers/tty/n_tracesink.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* n_tracesink.h - Kernel driver API to route trace data in kernel space. +* +* Copyright (C) Intel 2011 +* +* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* +* The PTI (Parallel Trace Interface) driver directs trace data routed from +* various parts in the system out through the Intel Penwell PTI port and +* out of the mobile device for analysis with a debugging tool +* (Lauterbach, Fido). This is part of a solution for the MIPI P1149.7, +* compact JTAG, standard. +* +* This header file is used by n_tracerouter to be able to send the +* data of it's tty port to the tty port this module sits. This +* mechanism can also be used independent of the PTI module. +* +*/ + +#ifndef N_TRACESINK_H_ +#define N_TRACESINK_H_ + +void n_tracesink_datadrain (u8 *buf,int count); + +#endif
include/linux/tty.h +2 -0
@@ -50,6 +50,8 @@#define N_CAIF 20/* CAIF protocol for talking to modems */ #define N_GSM0710 21/* GSM 0710 Mux */ #define N_TI_WL 22/* for TI's WL BT, FM, GPS combo chips */ +#define N_TRACESINK 23/* Trace data routing for MIPI P1149.7 */ +#define N_TRACEROUTER 24/* Trace data routing for MIPI P1149.7 */ /* * This character is the same as _POSIX_VDISABLE: it cannot be used as
Signature · 1 line
1.7.4.2
PATCH 46/48 tty/serial: Add explicit PORT_TEGRA type
In reply to Greg Kroah-HartmanFrom: Stephen Warren <[email protected]>
Tegra's UART is currently auto-detected as PORT_XSCALE due to register bit UART_IER.UUE being writable. However, the Tegra documentation states that this register bit is reserved. Hence, we should not program it.
Instead, the documentation specifies that the UART is 16550 compatible. However, Tegra does need register bit UART_IER.RTOIE set, which is not enabled by any 16550 port type. This was not noticed before, since PORT_XSCALE enables CAP_UUE, which conflates both UUE and RTOIE bit programming.
This change defines PORT_TEGRA that doesn't set UART_CAP_UUE, but does set UART_CAP_RTOIE, which is a new capability indicating that the RTOIE bit needs to be enabled.
--- drivers/tty/serial/8250.c | 14 ++++++++++++-- drivers/tty/serial/8250.h | 1 + include/linux/serial_core.h | 3 ++- include/linux/serial_reg.h | 1 + 4 files changed, 16 insertions(+), 3 deletions(-)
drivers/tty/serial/8250.c +12 -2
@@ -271,7 +271,7 @@ static const struct serial8250_config uart_config[] = { .fifo_size = 32, .tx_loadsz = 32, .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, - .flags = UART_CAP_FIFO | UART_CAP_UUE, + .flags = UART_CAP_FIFO | UART_CAP_UUE | UART_CAP_RTOIE, }, [PORT_RM9000] = { .name = "RM9000",
@@ -301,6 +301,14 @@ static const struct serial8250_config uart_config[] = { .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, .flags = UART_CAP_FIFO | UART_CAP_AFE, }, + [PORT_TEGRA] = { + .name = "Tegra", + .fifo_size = 32, + .tx_loadsz = 8, + .fcr =UART_FCR_ENABLE_FIFO |UART_FCR_R_TRIG_01 | + UART_FCR_T_TRIG_01, + .flags = UART_CAP_FIFO | UART_CAP_RTOIE, + }, };#if defined(CONFIG_MIPS_ALCHEMY )
@@ -2403,7 +2411,9 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, UART_ENABLE_MS(&up->port, termios->c_cflag)) up->ier |= UART_IER_MSI;if (up->capabilities &UART_CAP_UUE ) - up->ier |=UART_IER_UUE |UART_IER_RTOIE ; + up->ier |=UART_IER_UUE ; +if (up->capabilities &UART_CAP_RTOIE ) + up->ier |=UART_IER_RTOIE ;serial_out (up,UART_IER , up->ier);
drivers/tty/serial/8250.h +1 -0
@@ -42,6 +42,7 @@ struct serial8250_config {#define UART_CAP_SLEEP (1 << 10)/* UART has IER sleep */ #define UART_CAP_AFE (1 << 11)/* MCR-based hw flow control */ #define UART_CAP_UUE (1 << 12)/* UART needs IER bit 6 set (Xscale) */ +#define UART_CAP_RTOIE (1 << 13)/* UART needs IER bit 4 set (Xscale, Tegra) */ #define UART_BUG_QUOT (1 << 0)/* UART has buggy quot LSB */ #define UART_BUG_TXEN (1 << 1)/* UART has buggy TX IIR status */
include/linux/serial_core.h +2 -1
@@ -45,7 +45,8 @@#define PORT_OCTEON 17/* Cavium OCTEON internal UART */ #define PORT_AR7 18/* Texas Instruments AR7 internal UART */ #define PORT_U6_16550A 19/* ST-Ericsson U6xxx internal UART */ -#define PORT_MAX_8250 19/* max port ID */ +#define PORT_TEGRA 20/* NVIDIA Tegra internal UART */ +#define PORT_MAX_8250 20/* max port ID */ /* * ARM specific type numbers. These are not currently guaranteed
include/linux/serial_reg.h +1 -0
@@ -57,6 +57,7 @@* ST16C654: 8 16 56 60 8 16 32 56 PORT_16654 * TI16C750: 1 16 32 56 xx xx xx xx PORT_16750 * TI16C752: 8 16 56 60 8 16 32 56 +* Tegra: 1 4 8 14 16 8 4 1 PORT_TEGRA */ #define UART_FCR_R_TRIG_00 0x00#define UART_FCR_R_TRIG_01 0x40
Signature · 1 line
1.7.4.2
PATCH 47/48 tty/serial: Fix break handling for PORT_TEGRA
In reply to Greg Kroah-HartmanFrom: Stephen Warren <[email protected]>
When a break is received, Tegra's UART apparently fills the FIFO with 0 bytes. These must be drained so that they aren't interpreted as actual data received. This allows e.g. MAGIC_SYSRQ to work on Tegra's UARTs.
v2: Added FIXME comment to clear_rx_fifo
--- drivers/tty/serial/8250.c | 28 ++++++++++++++++++++++++++++ include/linux/serial_reg.h | 1 + 2 files changed, 29 insertions(+), 0 deletions(-)
drivers/tty/serial/8250.c +28 -0
@@ -1433,6 +1433,27 @@ static void serial8250_enable_ms(struct uart_port *port)serial_out (up,UART_IER , up->ier); } +/* +* Clear the Tegra rx fifo after a break +* +* FIXME: This needs to become a port specific callback once we have a +* framework for this +*/ +static void clear_rx_fifo (struct uart_8250_port *up) +{ +unsigned int status, tmout =10000 ; +do { + status =serial_in (up,UART_LSR ); +if (status & (UART_LSR_FIFOE |UART_LSR_BRK_ERROR_BITS )) + status =serial_in (up,UART_RX ); +else +break ; +if (--tmout ==0 ) +break ; +udelay (1 ); + }while (1 ); +} +static void receive_chars (struct uart_8250_port *up,unsigned int *status) {
@@ -1468,6 +1489,13 @@ receive_chars(struct uart_8250_port *up, unsigned int *status) lsr &= ~(UART_LSR_FE |UART_LSR_PE ); up->port.icount.brk++;/* +* If tegra port then clear the rx fifo to +* accept another break/character. +*/ +if (up->port.type ==PORT_TEGRA ) +clear_rx_fifo (up); + +/* * We do the SysRQ and SAK checking * here because otherwise the break * may get masked by ignore_status_mask
include/linux/serial_reg.h +1 -0
@@ -119,6 +119,7 @@#define UART_MCR_DTR 0x01/* DTR complement */ #define UART_LSR 5/* In: Line Status Register */ +#define UART_LSR_FIFOE 0x80/* Fifo error */ #define UART_LSR_TEMT 0x40/* Transmitter empty */ #define UART_LSR_THRE 0x20/* Transmit-hold-register empty */ #define UART_LSR_BI 0x10/* Break interrupt indicator */
Signature · 1 line
1.7.4.2
PATCH 48/48 serial: 8250_pci: add support for Cronyx Omega PCI multiserial board.
In reply to Greg Kroah-HartmanFrom: Antony Pavlov <[email protected]>
This patch adds support for the Omega-PCI, an 8-port asynchronous multiport adapter for computers with PCI bus [1].
[1] http://www.cronyx.ru/hardware/ompci.html
--- drivers/tty/serial/8250_pci.c | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-)
drivers/tty/serial/8250_pci.c +32 -0
@@ -971,6 +971,14 @@ ce4100_serial_setup(struct serial_private *priv,return ret; } +static int +pci_omegapci_setup (struct serial_private *priv, +struct pciserial_board *board, +struct uart_port *port,int idx) +{ +return setup_port (priv, port,2 , idx *8 ,0 ); +} +static int skip_tx_en_setup (struct serial_private *priv,const struct pciserial_board *board,struct uart_port *port,int idx)
@@ -1011,6 +1019,7 @@ static int skip_tx_en_setup(struct serial_private *priv,#define PCI_DEVICE_ID_TITAN_200EISI 0xA017#define PCI_DEVICE_ID_OXSEMI_16PCI958 0x9538#define PCIE_DEVICE_ID_NEO_2_OX_IBM 0x00F6 +#define PCI_DEVICE_ID_PLX_CRONYX_OMEGA 0xc001/* Unknown vendors/cards - this should not be in linux/pci_ids.h */ #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584
@@ -1438,6 +1447,16 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { .setup = pci_default_setup, },/* +* Cronyx Omega PCI (PLX-chip based) +*/ + { + .vendor = PCI_VENDOR_ID_PLX, + .device = PCI_DEVICE_ID_PLX_CRONYX_OMEGA, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_omegapci_setup, + }, +/* * Default "match everything" terminator entry */ {
@@ -1624,6 +1643,7 @@ enum pci_board_num_t { pbn_ADDIDATA_PCIe_4_3906250, pbn_ADDIDATA_PCIe_8_3906250, pbn_ce4100_1_115200, + pbn_omegapci, };/*
@@ -2319,6 +2339,12 @@ static struct pciserial_board pci_boards[] __devinitdata = { .base_baud = 921600, .reg_shift = 2, }, + [pbn_omegapci] = { + .flags = FL_BASE0, + .num_ports = 8, + .base_baud = 115200, + .uart_offset = 0x200, + }, }; static const struct pci_device_id softmodem_blacklist[] = {
@@ -3816,6 +3842,12 @@ static struct pci_device_id serial_pci_tbl[] = {PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , pbn_ce4100_1_115200 }, +/* +* Cronyx Omega PCI +*/ + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_CRONYX_OMEGA, +PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , + pbn_omegapci },/* * These entries match devices with class COMMUNICATION_SERIAL,
Signature · 1 line
1.7.4.2
PATCH 2/48 vt: Add K_OFF return value to vt_ioctl KDGKBMODE
In reply to Greg Kroah-HartmanFrom: Arthur Taylor <[email protected]>
After adding support for K_OFF in KDSKBMODE, it was forgotten to add support for returning it in KDGKBMODE.
--- drivers/tty/vt/vt_ioctl.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/tty/vt/vt_ioctl.c +1 -0
@@ -701,6 +701,7 @@ int vt_ioctl(struct tty_struct *tty, uival = ((kbd->kbdmode ==VC_RAW ) ?K_RAW : (kbd->kbdmode ==VC_MEDIUMRAW ) ?K_MEDIUMRAW : (kbd->kbdmode ==VC_UNICODE ) ?K_UNICODE : + (kbd->kbdmode ==VC_OFF ) ?K_OFF :K_XLATE ); goto setint;
Signature · 1 line
1.7.4.2
PATCH 4/48 tty: VT, remove unused variable
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
drivers/tty/vt/vt_ioctl.c:1525:2: warning: Value stored to 'kbd' is never read kbd = kbd_table + console;
^ ~~~~~~~~~~~~~~~~~~~
--- drivers/tty/vt/vt_ioctl.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/tty/vt/vt_ioctl.c +0 -2
@@ -1512,7 +1512,6 @@ long vt_compat_ioctl(struct tty_struct *tty, {struct vc_data *vc = tty->driver_data;struct console_font_op op;/* used in multiple places here */ -struct kbd_struct *kbd;unsigned int console;void __user *up = (void __user *)arg;int perm;
@@ -1535,7 +1534,6 @@ long vt_compat_ioctl(struct tty_struct *tty,if (current->signal->tty == tty ||capable (CAP_SYS_TTY_CONFIG )) perm =1 ; - kbd = kbd_table + console;switch (cmd) {/* * these need special handlers for incompatible data structures
Signature · 1 line
1.7.4.2
PATCH 5/48 TTY: serial_core, remove unused variable
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
drivers/tty/serial/serial_core.c:1980:2: warning: Value stored to 'tty' is never read
tty = port->tty;
^ ~~~~~~~~~--- drivers/tty/serial/serial_core.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/tty/serial/serial_core.c +0 -4
@@ -1972,13 +1972,9 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)struct tty_port *port = &state->port;struct device *tty_dev;struct uart_match match = {uport, drv}; -struct tty_struct *tty;mutex_lock (&port->mutex); -/* Must be inside the mutex lock until we convert to tty_port */ - tty = port->tty; - tty_dev =device_find_child (uport->dev, &match, serial_match_port);if (device_may_wakeup (tty_dev)) {if (!enable_irq_wake (uport->irq))
Signature · 1 line
1.7.4.2
PATCH 6/48 Char: cyclades, fix unused variable
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
drivers/tty/cyclades.c:1454:2: warning: Value stored to 'channel' is never read
channel = info->line - card->first_line; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fix it by moving it to the appropriate debug section where it is used.
--- drivers/tty/cyclades.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/tty/cyclades.c +1 -2
@@ -1445,13 +1445,11 @@ static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty) {struct cyclades_card *card;unsigned long flags; -int channel;if (!(info->port.flags &ASYNC_INITIALIZED ))return ; card = info->card; - channel = info->line - card->first_line;if (!cy_is_Z (card)) {spin_lock_irqsave (&card->card_lock, flags);
@@ -1476,6 +1474,7 @@ static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty)spin_unlock_irqrestore (&card->card_lock, flags); }else {#ifdef CY_DEBUG_OPEN +int channel = info->line - card->first_line;printk (KERN_DEBUG "cyc shutdown Z card %d, channel %d, " "base_addr %p\n" , card, channel, card->base_addr);#endif
Signature · 1 line
1.7.4.2
PATCH 10/48 TTY: unify tty_init_dev fail path handling
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
Change it so that we call the deinit functions at one place at the end of the function (by gotos). And while at it use some sane label names.
This is a preparation for the deinitialization of tty in the next patch.
--- drivers/tty/tty_io.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-)
drivers/tty/tty_io.c +12 -11
@@ -1391,16 +1391,15 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,return ERR_PTR (-ENODEV ); tty =alloc_tty_struct (); -if (!tty) - goto fail_no_mem; +if (!tty) { + retval = -ENOMEM ; + goto err_module_put; + }initialize_tty_struct (tty, driver, idx); retval =tty_driver_install_tty (driver, tty); -if (retval <0 ) { -free_tty_struct (tty); -module_put (driver->owner); -return ERR_PTR (retval); - } +if (retval <0 ) + goto err_free_tty;/* * Structures all installed ... call the ldisc open routines.
@@ -1409,15 +1408,17 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,*/ retval =tty_ldisc_setup (tty, tty->link);if (retval) - goto release_mem_out; + goto err_release_tty;return tty; -fail_no_mem: +err_free_tty: +free_tty_struct (tty); +err_module_put:module_put (driver->owner); -return ERR_PTR (-ENOMEM ); +return ERR_PTR (retval);/* call the tty release_tty routine to clean out this slot */ -release_mem_out: +err_release_tty:if (printk_ratelimit ())printk (KERN_INFO "tty_init_dev: ldisc open failed, " "clearing slot %d\n" , idx);
Signature · 1 line
1.7.4.2
PATCH 12/48 TTY: unify pty_unix98_install fail path handling
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
Change it so that we call the deinit functions at one place at the end of the function (by gotos). And while at it use some sane label names.
This is a preparation for the deinitialization of tty in the next patch.
--- drivers/tty/pty.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/tty/pty.c +6 -6
@@ -560,20 +560,19 @@ static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty)return -ENOMEM ;if (!try_module_get (driver->other->owner)) {/* This cannot in fact currently happen */ -free_tty_struct (o_tty); -return -ENOMEM ; + goto err_free_tty; }initialize_tty_struct (o_tty, driver->other, idx); tty->termios =kzalloc (sizeof (struct ktermios [2 ]),GFP_KERNEL );if (tty->termios ==NULL ) - goto free_mem_out; + goto err_free_mem; *tty->termios = driver->init_termios; tty->termios_locked = tty->termios +1 ; o_tty->termios =kzalloc (sizeof (struct ktermios [2 ]),GFP_KERNEL );if (o_tty->termios ==NULL ) - goto free_mem_out; + goto err_free_mem; *o_tty->termios = driver->other->init_termios; o_tty->termios_locked = o_tty->termios +1 ;
@@ -592,11 +591,12 @@ static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty) tty->count++; pty_count++;return 0 ; -free_mem_out: +err_free_mem:kfree (o_tty->termios); +kfree (tty->termios);module_put (o_tty->driver->owner); +err_free_tty:free_tty_struct (o_tty); -kfree (tty->termios);return -ENOMEM ; }
Signature · 1 line
1.7.4.2
PATCH 1/48 vt: remove uneeded retval check before tty->ops->open inside tty_open
In reply to Greg KHFrom: Herton Ronaldo Krzesinski <[email protected]>
The current check is uneeded, since !retval will always returns true, as retval returned from tty_add_file is checked earlier and tty_open exits if it's not zero.
--- drivers/tty/tty_io.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-)
drivers/tty/tty_io.c +4 -6
@@ -1902,12 +1902,10 @@ got_driver:#ifdef TTY_DEBUG_HANGUP printk (KERN_DEBUG "opening %s..." , tty->name);#endif -if (!retval) { -if (tty->ops->open) - retval = tty->ops->open (tty, filp); -else - retval = -ENODEV ; - } +if (tty->ops->open) + retval = tty->ops->open (tty, filp); +else + retval = -ENODEV ; filp->f_flags = saved_flags; if (!retval && test_bit(TTY_EXCLUSIVE, &tty->flags) &&
Signature · 1 line
1.7.4.2
PATCH 3/48 drivers/tty/vt/vt_ioctl.c: repair insane ?: expression
From: Andrew Morton <[email protected]>
--- drivers/tty/vt/vt_ioctl.c | 22 +++++++++++++++++----- 1 files changed, 17 insertions(+), 5 deletions(-)
drivers/tty/vt/vt_ioctl.c +17 -5
@@ -698,11 +698,23 @@ int vt_ioctl(struct tty_struct *tty,break ;case KDGKBMODE : - uival = ((kbd->kbdmode ==VC_RAW ) ?K_RAW : - (kbd->kbdmode ==VC_MEDIUMRAW ) ?K_MEDIUMRAW : - (kbd->kbdmode ==VC_UNICODE ) ?K_UNICODE : - (kbd->kbdmode ==VC_OFF ) ?K_OFF : -K_XLATE ); +switch (kbd->kbdmode) { +case VC_RAW : + uival =K_RAW ; +break ; +case VC_MEDIUMRAW : + uival =K_MEDIUMRAW ; +break ; +case VC_UNICODE : + uival =K_UNICODE ; +break ; +case VC_OFF : + uival =K_OFF ; +break ; +default : + uival =K_XLATE ; +break ; + } goto setint;/* this could be folded into KDSKBMODE, but for compatibility
Signature · 1 line
1.7.4.2
PATCH 7/48 TTY: VT, remove unused variables
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
drivers/tty/vt/vt.c:892:2: warning: Value stored to 'old_screen_size' is never read
old_screen_size = vc->vc_screenbuf_size;
^ ~~~~~~~~~~~~~~~~~~~~~
drivers/tty/vt/vt.c:890:2: warning: Value stored to 'old_cols' is never read
old_cols = vc->vc_cols;
^ ~~~~~~~~~~~--- drivers/tty/vt/vt.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/tty/vt/vt.c +1 -3
@@ -858,7 +858,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, {unsigned long old_origin, new_origin, new_scr_end, rlth, rrem, err =0 ;unsigned long end; -unsigned int old_cols, old_rows, old_row_size, old_screen_size; +unsigned int old_rows, old_row_size;unsigned int new_cols, new_rows, new_row_size, new_screen_size;unsigned int user;unsigned short *newscreen;
@@ -887,9 +887,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,return -ENOMEM ; old_rows = vc->vc_rows; - old_cols = vc->vc_cols; old_row_size = vc->vc_size_row; - old_screen_size = vc->vc_screenbuf_size; err =resize_screen (vc, new_cols, new_rows, user);if (err) {
Signature · 1 line
1.7.4.2
PATCH 8/48 Char: moxa, remove unused variables
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
drivers/tty/moxa.c:1287:2: warning: Value stored to 'port' is never read
port = tty->index;
^ ~~~~~~~~~~
drivers/tty/moxa.c:1763:2: warning: Value stored to 'cflag' is never read
cflag = termio->c_cflag; /* termio->c_cflag */
^ ~~~~~~~~~~~~~~~--- drivers/tty/moxa.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/tty/moxa.c +0 -4
@@ -1281,10 +1281,8 @@ static int moxa_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) {struct moxa_port *ch; -int port;int dtr, rts; - port = tty->index;mutex_lock (&moxa_openlock); ch = tty->driver_data;if (!ch) {
@@ -1756,11 +1754,9 @@ static int MoxaPortSetTermio(struct moxa_port *port, struct ktermios *termio, speed_t baud) {void __iomem *ofsAddr; -tcflag_t cflag;tcflag_t mode =0 ; ofsAddr = port->tableAddr; - cflag = termio->c_cflag;/* termio->c_cflag */ mode = termio->c_cflag &CSIZE ;if (mode ==CS5 )
Signature · 1 line
1.7.4.2
PATCH 9/48 TTY: rocket, remove unused variables
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
drivers/tty/rocket.c:1393:2: warning: Value stored to 'cp' is never read
cp = &info->channel;
^ ~~~~~~~~~~~~~~
drivers/tty/rocket.c:1412:2: warning: Value stored to 'cp' is never read
cp = &info->channel;
^ ~~~~~~~~~~~~~~
drivers/tty/rocket.c:1730:2: warning: Value stored to 'cp' is never read
cp = &info->channel;
^ ~~~~~~~~~~~~~~
drivers/tty/rocket.c:1825:3: warning: Value stored to 'str' is never read
str = "8";
^ ~~~
[many 'str' warnings stripped]
drivers/tty/rocket.c:2037:3: warning: Value stored to 'board_type' is never read
board_type = "RocketModem";
^ ~~~~~~~~~~~~~[some 'board_type' warnings stripped]
--- drivers/tty/rocket.c | 47 ----------------------------------------------- 1 files changed, 0 insertions(+), 47 deletions(-)
drivers/tty/rocket.c +0 -47
@@ -1380,7 +1380,6 @@ static void rp_send_xchar(struct tty_struct *tty, char ch)static void rp_throttle (struct tty_struct *tty) {struct r_port *info = tty->driver_data; -CHANNEL_t *cp;#ifdef ROCKET_DEBUG_THROTTLE printk(KERN_INFO "throttle %s: %d....\n", tty->name,
@@ -1390,7 +1389,6 @@ static void rp_throttle(struct tty_struct *tty)if (rocket_paranoia_check (info,"rp_throttle" ))return ; - cp = &info->channel;if (I_IXOFF (tty))rp_send_xchar (tty,STOP_CHAR (tty));
@@ -1400,7 +1398,6 @@ static void rp_throttle(struct tty_struct *tty)static void rp_unthrottle (struct tty_struct *tty) {struct r_port *info = tty->driver_data; -CHANNEL_t *cp;#ifdef ROCKET_DEBUG_THROTTLE printk (KERN_INFO "unthrottle %s: %d....\n" , tty->name, tty->ldisc.chars_in_buffer (tty));
@@ -1409,7 +1406,6 @@ static void rp_unthrottle(struct tty_struct *tty)if (rocket_paranoia_check (info,"rp_throttle" ))return ; - cp = &info->channel;if (I_IXOFF (tty))rp_send_xchar (tty,START_CHAR (tty));
@@ -1722,13 +1718,10 @@ static int rp_write_room(struct tty_struct *tty)static int rp_chars_in_buffer (struct tty_struct *tty) {struct r_port *info = tty->driver_data; -CHANNEL_t *cp;if (rocket_paranoia_check (info,"rp_chars_in_buffer" ))return 0 ; - cp = &info->channel; -#ifdef ROCKET_DEBUG_WRITE printk (KERN_INFO "rp_chars_in_buffer returns %d...\n" , info->xmit_cnt);#endif
@@ -1779,7 +1772,6 @@ static __init int register_PCI(int i, struct pci_dev *dev) {int num_aiops, aiop, max_num_aiops, num_chan, chan;unsigned int aiopio[MAX_AIOPS_PER_BOARD ]; -char *str, *board_type;CONTROLLER_t *ctlp;int fast_clock =0 ;
@@ -1800,7 +1792,6 @@ static __init int register_PCI(int i, struct pci_dev *dev)/* Depending on the model, set up some config variables */ switch (dev->device) {case PCI_DEVICE_ID_RP4QUAD : - str ="Quadcable" ; max_num_aiops =1 ; ports_per_aiop =4 ; rocketModel[i].model =MODEL_RP4QUAD ;
@@ -1808,42 +1799,36 @@ static __init int register_PCI(int i, struct pci_dev *dev) rocketModel[i].numPorts =4 ;break ;case PCI_DEVICE_ID_RP8OCTA : - str ="Octacable" ; max_num_aiops =1 ; rocketModel[i].model =MODEL_RP8OCTA ;strcpy (rocketModel[i].modelString,"RocketPort 8 port w/octa cable" ); rocketModel[i].numPorts =8 ;break ;case PCI_DEVICE_ID_URP8OCTA : - str ="Octacable" ; max_num_aiops =1 ; rocketModel[i].model =MODEL_UPCI_RP8OCTA ;strcpy (rocketModel[i].modelString,"RocketPort UPCI 8 port w/octa cable" ); rocketModel[i].numPorts =8 ;break ;case PCI_DEVICE_ID_RP8INTF : - str ="8" ; max_num_aiops =1 ; rocketModel[i].model =MODEL_RP8INTF ;strcpy (rocketModel[i].modelString,"RocketPort 8 port w/external I/F" ); rocketModel[i].numPorts =8 ;break ;case PCI_DEVICE_ID_URP8INTF : - str ="8" ; max_num_aiops =1 ; rocketModel[i].model =MODEL_UPCI_RP8INTF ;strcpy (rocketModel[i].modelString,"RocketPort UPCI 8 port w/external I/F" ); rocketModel[i].numPorts =8 ;break ;case PCI_DEVICE_ID_RP8J : - str ="8J" ; max_num_aiops =1 ; rocketModel[i].model =MODEL_RP8J ;strcpy (rocketModel[i].modelString,"RocketPort 8 port w/RJ11 connectors" ); rocketModel[i].numPorts =8 ;break ;case PCI_DEVICE_ID_RP4J : - str ="4J" ; max_num_aiops =1 ; ports_per_aiop =4 ; rocketModel[i].model =MODEL_RP4J ;
@@ -1851,56 +1836,48 @@ static __init int register_PCI(int i, struct pci_dev *dev) rocketModel[i].numPorts =4 ;break ;case PCI_DEVICE_ID_RP8SNI : - str ="8 (DB78 Custom)" ; max_num_aiops =1 ; rocketModel[i].model =MODEL_RP8SNI ;strcpy (rocketModel[i].modelString,"RocketPort 8 port w/ custom DB78" ); rocketModel[i].numPorts =8 ;break ;case PCI_DEVICE_ID_RP16SNI : - str ="16 (DB78 Custom)" ; max_num_aiops =2 ; rocketModel[i].model =MODEL_RP16SNI ;strcpy (rocketModel[i].modelString,"RocketPort 16 port w/ custom DB78" ); rocketModel[i].numPorts =16 ;break ;case PCI_DEVICE_ID_RP16INTF : - str ="16" ; max_num_aiops =2 ; rocketModel[i].model =MODEL_RP16INTF ;strcpy (rocketModel[i].modelString,"RocketPort 16 port w/external I/F" ); rocketModel[i].numPorts =16 ;break ;case PCI_DEVICE_ID_URP16INTF : - str ="16" ; max_num_aiops =2 ; rocketModel[i].model =MODEL_UPCI_RP16INTF ;strcpy (rocketModel[i].modelString,"RocketPort UPCI 16 port w/external I/F" ); rocketModel[i].numPorts =16 ;break ;case PCI_DEVICE_ID_CRP16INTF : - str ="16" ; max_num_aiops =2 ; rocketModel[i].model =MODEL_CPCI_RP16INTF ;strcpy (rocketModel[i].modelString,"RocketPort Compact PCI 16 port w/external I/F" ); rocketModel[i].numPorts =16 ;break ;case PCI_DEVICE_ID_RP32INTF : - str ="32" ; max_num_aiops =4 ; rocketModel[i].model =MODEL_RP32INTF ;strcpy (rocketModel[i].modelString,"RocketPort 32 port w/external I/F" ); rocketModel[i].numPorts =32 ;break ;case PCI_DEVICE_ID_URP32INTF : - str ="32" ; max_num_aiops =4 ; rocketModel[i].model =MODEL_UPCI_RP32INTF ;strcpy (rocketModel[i].modelString,"RocketPort UPCI 32 port w/external I/F" ); rocketModel[i].numPorts =32 ;break ;case PCI_DEVICE_ID_RPP4 : - str ="Plus Quadcable" ; max_num_aiops =1 ; ports_per_aiop =4 ; altChanRingIndicator++;
@@ -1910,7 +1887,6 @@ static __init int register_PCI(int i, struct pci_dev *dev) rocketModel[i].numPorts =4 ;break ;case PCI_DEVICE_ID_RPP8 : - str ="Plus Octacable" ; max_num_aiops =2 ; ports_per_aiop =4 ; altChanRingIndicator++;
@@ -1920,7 +1896,6 @@ static __init int register_PCI(int i, struct pci_dev *dev) rocketModel[i].numPorts =8 ;break ;case PCI_DEVICE_ID_RP2_232 : - str ="Plus 2 (RS-232)" ; max_num_aiops =1 ; ports_per_aiop =2 ; altChanRingIndicator++;
@@ -1930,7 +1905,6 @@ static __init int register_PCI(int i, struct pci_dev *dev) rocketModel[i].numPorts =2 ;break ;case PCI_DEVICE_ID_RP2_422 : - str ="Plus 2 (RS-422)" ; max_num_aiops =1 ; ports_per_aiop =2 ; altChanRingIndicator++;
@@ -1943,7 +1917,6 @@ static __init int register_PCI(int i, struct pci_dev *dev) max_num_aiops =1 ; ports_per_aiop =6 ; - str ="6-port" ;/* If revision is 1, the rocketmodem flash must be loaded. * If it is 2 it is a "socketed" version. */
@@ -1961,7 +1934,6 @@ static __init int register_PCI(int i, struct pci_dev *dev)case PCI_DEVICE_ID_RP4M : max_num_aiops =1 ; ports_per_aiop =4 ; - str ="4-port" ;if (dev->revision ==1 ) { rcktpt_type[i] =ROCKET_TYPE_MODEMII ; rocketModel[i].loadrm2 =1 ;
@@ -1974,7 +1946,6 @@ static __init int register_PCI(int i, struct pci_dev *dev) rocketModel[i].numPorts =4 ;break ;default : - str ="(unknown/unsupported)" ; max_num_aiops =0 ;break ; }
@@ -2000,14 +1971,12 @@ static __init int register_PCI(int i, struct pci_dev *dev)if (! (sInW (ConfigIO + _PCI_9030_GPIO_CTRL) &PCI_GPIO_CTRL_8PORT )) { - str ="Quadcable" ; ports_per_aiop =4 ; rocketModel[i].numPorts =4 ; } }break ;case PCI_DEVICE_ID_UPCI_RM3_8PORT : - str ="8 ports" ; max_num_aiops =1 ; rocketModel[i].model =MODEL_UPCI_RM3_8PORT ;strcpy (rocketModel[i].modelString,"RocketModem III 8 port" );
@@ -2018,7 +1987,6 @@ static __init int register_PCI(int i, struct pci_dev *dev) rcktpt_type[i] =ROCKET_TYPE_MODEMIII ;break ;case PCI_DEVICE_ID_UPCI_RM3_4PORT : - str ="4 ports" ; max_num_aiops =1 ; rocketModel[i].model =MODEL_UPCI_RM3_4PORT ;strcpy (rocketModel[i].modelString,"RocketModem III 4 port" );
@@ -2032,21 +2000,6 @@ static __init int register_PCI(int i, struct pci_dev *dev)break ; } -switch (rcktpt_type[i]) { -case ROCKET_TYPE_MODEM : - board_type ="RocketModem" ; -break ; -case ROCKET_TYPE_MODEMII : - board_type ="RocketModem II" ; -break ; -case ROCKET_TYPE_MODEMIII : - board_type ="RocketModem III" ; -break ; -default : - board_type ="RocketPort" ; -break ; - } -if (fast_clock) { sClockPrescale =0x12 ;/* mod 2 (divide by 3) */ rp_baud_base[i] =921600 ;
Signature · 1 line
1.7.4.2
PATCH 11/48 TTY: unify pty_install fail path handling
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
Change it so that we call the deinit functions at one place at the end of the function (by gotos). And while at it use some sane label names.
This is a preparation for the deinitialization of tty in the next patch.
--- drivers/tty/pty.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-)
drivers/tty/pty.c +10 -9
@@ -295,8 +295,8 @@ static int pty_install(struct tty_driver *driver, struct tty_struct *tty)return -ENOMEM ;if (!try_module_get (driver->other->owner)) {/* This cannot in fact currently happen */ -free_tty_struct (o_tty); -return -ENOMEM ; + retval = -ENOMEM ; + goto err_free_tty; }initialize_tty_struct (o_tty, driver->other, idx);
@@ -304,13 +304,11 @@ static int pty_install(struct tty_driver *driver, struct tty_struct *tty)the easy way .. */ retval =tty_init_termios (tty);if (retval) - goto free_mem_out; + goto err_module_put; retval =tty_init_termios (o_tty); -if (retval) { -tty_free_termios (tty); - goto free_mem_out; - } +if (retval) + goto err_free_termios;/* * Everything allocated ... set up the o_tty structure.
@@ -327,10 +325,13 @@ static int pty_install(struct tty_driver *driver, struct tty_struct *tty) tty->count++; driver->ttys[idx] = tty;return 0 ; -free_mem_out: +err_free_termios: +tty_free_termios (tty); +err_module_put:module_put (o_tty->driver->owner); +err_free_tty:free_tty_struct (o_tty); -return -ENOMEM ; +return retval; } static int pty_bsd_ioctl(struct tty_struct *tty,
Signature · 1 line
1.7.4.2
PATCH 13/48 TTY: introduce deinit helpers for proper ldisc shutdown
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
Introduce deinitialize_tty_struct which should be called after initialize_tty_struct and before successfull tty_ldisc_setup.
It calls tty_ldisc_deinit which is opposite of tty_ldisc_init. It only puts a reference to ldisc and assigns NULL to tty->ldisc.
It will be used to shut down ldisc when tty_release cannot be called yet.
--- drivers/tty/tty_io.c | 14 ++++++++++++++ drivers/tty/tty_ldisc.c | 13 +++++++++++++ include/linux/tty.h | 2 ++ 3 files changed, 29 insertions(+), 0 deletions(-)
drivers/tty/tty_io.c +14 -0
@@ -2887,6 +2887,20 @@ void initialize_tty_struct(struct tty_struct *tty, }/** +* deinitialize_tty_struct +* @tty: tty to deinitialize +* +* This subroutine deinitializes a tty structure that has been newly +* allocated but tty_release cannot be called on that yet. +* +* Locking: none - tty in question must not be exposed at this point +*/ +void deinitialize_tty_struct (struct tty_struct *tty) +{ +tty_ldisc_deinit (tty); +} + +/** * tty_put_char - write one character to a tty * @tty: tty * @ch: character
drivers/tty/tty_ldisc.c +13 -0
@@ -956,6 +956,19 @@ void tty_ldisc_init(struct tty_struct *tty)tty_ldisc_assign (tty, ld); } +/** +* tty_ldisc_init - ldisc cleanup for new tty +* @tty: tty that was allocated recently +* +* The tty structure must not becompletely set up (tty_ldisc_setup) when +* this call is made. +*/ +void tty_ldisc_deinit (struct tty_struct *tty) +{ +put_ldisc (tty->ldisc); +tty_ldisc_assign (tty,NULL ); +} +void tty_ldisc_begin (void ) {/* Setup the default TTY line discipline. */
include/linux/tty.h +2 -0
@@ -472,6 +472,7 @@ extern int tty_add_file(struct tty_struct *tty, struct file *file);extern void free_tty_struct (struct tty_struct *tty);extern void initialize_tty_struct (struct tty_struct *tty,struct tty_driver *driver,int idx); +extern void deinitialize_tty_struct (struct tty_struct *tty);extern struct tty_struct *tty_init_dev (struct tty_driver *driver,int idx,int first_ok);extern int tty_release (struct inode *inode,struct file *filp);
@@ -525,6 +526,7 @@ extern int tty_set_ldisc(struct tty_struct *tty, int ldisc);extern int tty_ldisc_setup (struct tty_struct *tty,struct tty_struct *o_tty);extern void tty_ldisc_release (struct tty_struct *tty,struct tty_struct *o_tty);extern void tty_ldisc_init (struct tty_struct *tty); +extern void tty_ldisc_deinit (struct tty_struct *tty);extern void tty_ldisc_begin (void );/* This last one is just for the tty layer internals and shouldn't be used elsewhere */ extern void tty_ldisc_enable (struct tty_struct *tty);
Signature · 1 line
1.7.4.2
Quoted 5 lines · Greg KH
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
Makefileand 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
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Linus Torvalds
Quoted 5 lines · Greg KH
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
Makefileand 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:
Quoted 6 lines
- 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
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line · Greg KH
Here's the big tty/serial merge for .40
/me confused: this patch
Quoted 2 lines
Felipe Balbi (1):
tty: makereceive_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
Quoted 225 lines
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
Makefileand 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-nextAll 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: Userequest_muxed_regionfor IT87 probe and lockAndrew Morton (1):
drivers/tty/vt/vt_ioctl.c: repair insane ?: expressionAntony Pavlov (1):
serial: 8250_pci: add support for Cronyx Omega PCI multiserial board.Arthur Taylor (1):
vt: AddK_OFFreturn value tovt_ioctlKDGKBMODEFelipe Balbi (1):
tty: makereceive_buf()return the amout of bytes receivedGovindraj.R (1):
Serial: Remove unused code.Herton Ronaldo Krzesinski (1):
vt: remove uneeded retval check before tty->ops->open inside tty_openJ Freyensee (4):
export kernel callget_task_comm(). Kernel documentation for the PTI feature. Intel PTI implementaiton of MIPI 1149.7.n_tracerouterandn_tracesinkldisc additions.Jesper Juhl (1):
Serial: ifx6x60c: Remove duplicate includes oflinux/tty.hJiri 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: unifytty_init_devfail path handling
TTY: unifypty_installfail path handling
TTY: unifypty_unix98_installfail path handling
TTY: introduce deinit helpers for proper ldisc shutdown
TTY: plug indeinitialize_tty_struct
TTY: fix fail path intty_open
Char: moxa, do not touchNORMAL_ACTIVEbit
serial: core, move termios handling touart_startup
serial: core, do not set DTR/RTS twice on startup
serial: core, removeuart_update_termios
Char: nozomi, useGFP_KERNELfor kfifo allocation
Char: nozomi, remove port.count checks
Char: nozomi, remove uselesstty_sem
Char: moxa, fix locking inmoxa_write
TTY:serial_core, remove invalid test
TTY:serial_core, remove superfluousset_task_state
TTY:tty_io, annotate locking functionsJoe Perches (1):
n_gsm: Useprint_hex_dump_bytesJohn Linn (1):
tty/serial: add support for Xilinx PS UARTJovi Zhang (1):
tty: remove invalid location line in file headerJulia Lawall (1):
drivers/tty/moxa.c: Put correct tty valueKukjin Kim (1):
tty: Remove to support serial for S5P6442Mark Brown (1):
ASoC: Update cx20442 for TTY API changePetr Písař (1):
tty: Clean console safelyScott Kilau (1):
8250_pci: Add support for the Digi/IBM PCIe 2-port AdapterStephen Warren (2):
tty/serial: Add explicitPORT_TEGRAtype tty/serial: Fix break handling forPORT_TEGRATobias Klauser (1):
serial:altera_uart: Scan for a free port if platform device id is -1Tomoya MORINAGA (2):
pch_uart: Support new device ML7223 IOH
pch_phub: Support new device ML7223
Quoted 6 lines
--
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/
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Guennadi Liakhovetski
Quoted 1 line · Greg KH
Here's the big tty/serial merge for .40
/me confused: this patch
Quoted 2 lines
Felipe Balbi (1):
tty: makereceive_buf()return the amout of bytes received
Quoted 7 lines
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:
Quoted 15 lines
Quoted 7 lines
Quoted 1 line
Here's the big tty/serial merge for .40
/me confused: this patch
Quoted 2 lines
Felipe Balbi (1):
tty: makereceive_buf()return the amout of bytes receivedQuoted 7 lines
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.
Quoted 1 line
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:
Quoted 11 lines
Am Freitag 27 Mai 2011, 03:00:21 schrieb Greg KH:
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Felipe Balbi (1):
tty: makereceive_buf()return the amout of bytes receivedI think I'll be reverting this one.
maybe that's related to
receive_bufreturning an unsigned int, which is obviously incompatible with-ENODEV,-EINVALand 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)
---
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(-)
drivers/bluetooth/hci_ldisc.c +1 -1
@@ -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;
drivers/input/serio/serport.c +1 -1
@@ -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;
drivers/isdn/gigaset/ser-gigaset.c +1 -1
@@ -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) {
drivers/misc/ti-st/st_core.c +1 -1
@@ -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
drivers/net/caif/caif_serial.c +1 -1
@@ -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 ;
drivers/net/can/slcan.c +1 -1
@@ -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;
drivers/net/hamradio/6pack.c +1 -1
@@ -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;
drivers/net/hamradio/mkiss.c +1 -1
@@ -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);
drivers/net/irda/irtty-sir.c +1 -1
@@ -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;
drivers/net/ppp_async.c +1 -1
@@ -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) {
drivers/net/ppp_synctty.c +1 -1
@@ -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) {
drivers/net/slip.c +1 -1
@@ -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;
drivers/net/wan/x25_asy.c +2 -2
@@ -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 */
drivers/tty/n_gsm.c +1 -1
@@ -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;
drivers/tty/n_hdlc.c +2 -2
@@ -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) { registerstruct n_hdlc *n_hdlc =tty2n_hdlc (tty);
drivers/tty/n_r3964.c +2 -2
@@ -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;
drivers/tty/n_tty.c +1 -1
@@ -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;
drivers/tty/tty_buffer.c +3 -0
@@ -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;
drivers/tty/vt/selection.c +7 -2
@@ -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; }
include/linux/tty_ldisc.h +2 -2
@@ -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,
Signature · 6 lines
1.7.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · Peter Hüwe
Am Dienstag 31 Mai 2011, 00:04:24 schrieb Peter Hüwe:
Quoted 10 lines
Am Freitag 27 Mai 2011, 03:00:21 schrieb Greg KH:
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Felipe Balbi (1):
tty: makereceive_buf()return the amout of bytes receivedI think I'll be reverting this one.
maybe that's related to
receive_bufreturning an unsigned int, which is obviously incompatible with-ENODEV,-EINVALand 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 ;)
Quoted 4 lines
Quoted 1 line
I could create a patch if desired.
@Guennadi:
Maybe you could try this patch?
Tested, doesn't help.
Thanks
Guennadi
Quoted 361 lines
I know it's far from perfect ;)
From
b73b6ad336a702f26a47f05fb60aeafb6044b029Mon Sep 17 00:00:00 2001
From: Peter Huewe <[email protected]>
Date: Tue, 31 May 2011 00:31:01 +0200
Subject: [PATCH] tty: fixreceive_bufreturn value for error handlingThis patch converts the return value of the
receive_bufcallbacks from unsigned int to int, thus enabling the use of negative values for error handling.Moreover checking the return code for
receive_bufwas added.And while at it the
receive_bufcallback indrivers/net/wan/x25_asy.cwas 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(-)drivers/bluetooth/hci_ldisc.c +1
-1@@ -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;drivers/input/serio/serport.c +1
-1@@ -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;drivers/isdn/gigaset/ser-gigaset.c +1
-1@@ -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) {drivers/misc/ti-st/st_core.c +1
-1@@ -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 drivers/net/caif/caif_serial.c +1
-1@@ -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 ;drivers/net/can/slcan.c +1
-1@@ -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;drivers/net/hamradio/6pack.c +1
-1@@ -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;drivers/net/hamradio/mkiss.c +1
-1@@ -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);drivers/net/irda/irtty-sir.c +1
-1@@ -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;drivers/net/ppp_async.c +1
-1@@ -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) {drivers/net/ppp_synctty.c +1
-1@@ -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) {drivers/net/slip.c +1
-1@@ -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;drivers/net/wan/x25_asy.c +2
-2@@ -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 */ drivers/tty/n_gsm.c +1
-1@@ -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;drivers/tty/n_hdlc.c +2
-2@@ -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) { registerstruct n_hdlc *n_hdlc =tty2n_hdlc (tty);drivers/tty/n_r3964.c +2
-2@@ -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;drivers/tty/n_tty.c +1
-1@@ -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;drivers/tty/tty_buffer.c +3
-0@@ -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;drivers/tty/vt/selection.c +7
-2@@ -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; }include/linux/tty_ldisc.h +2
-2@@ -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,Signature · 1 line
1.7.3.4
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html