TTY patches for 2.6.33-git
Subsystems (9)
PATCH 1/1 TTY patches for 2.6.33-git
Here is the big tty patchset for the .34 merge window.
Please pull from:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/tty-2.6.git/
These patches have been in the linux-next and -mm releases for a number of weeks now.
Patches will be sent to the linux-kernel mailing list, if anyone wants to see them.
thanks,
greg k-h
------------
drivers/char/cyclades.c | 16 +- drivers/char/hvc_console.c | 2 +- drivers/char/ip2/ip2main.c | 26 ++- drivers/char/isicom.c | 54 ++-- drivers/char/moxa.c | 20 +- drivers/char/mxser.c | 3 +- drivers/char/nozomi.c | 157 +++++---- drivers/char/serial167.c | 3 +- drivers/char/specialix.c | 2 - drivers/char/synclink.c | 4 +- drivers/char/synclink_gt.c | 186 ++++++----- drivers/char/tty_buffer.c | 6 +- drivers/char/tty_ldisc.c | 50 ++-- drivers/char/vt_ioctl.c | 39 ++- drivers/mmc/card/sdio_uart.c | 93 ++---- drivers/parport/parport_pc.c | 6 + drivers/serial/68328serial.c | 8 +- drivers/serial/8250.c | 21 +- drivers/serial/8250_pci.c | 31 ++- drivers/serial/Kconfig | 53 ++-- drivers/serial/atmel_serial.c | 22 ++ drivers/serial/bcm63xx_uart.c | 7 +- drivers/serial/bfin_5xx.c | 22 +- drivers/serial/bfin_sport_uart.c | 701 +++++++++++++++++++++++++------------- drivers/serial/bfin_sport_uart.h | 38 +-- drivers/serial/icom.c | 5 +- drivers/serial/imx.c | 6 +- drivers/serial/ioc3_serial.c | 3 +- drivers/serial/jsm/jsm_driver.c | 1 + drivers/serial/jsm/jsm_tty.c | 9 +- drivers/serial/msm_serial.c | 6 +- drivers/serial/timbuart.c | 7 +- drivers/usb/serial/keyspan_pda.c | 7 + include/linux/pci_ids.h | 3 + include/linux/tty.h | 10 + include/linux/vt.h | 3 +- 36 files changed, 978 insertions(+), 652 deletions(-)
---------------
Alan Cox (8):
sdio_uart: Use kfifo instead of the messy circ stuff
nozomi: Add tty_port usage
nozomi: Fix mutex handling
nozomi: Tidy up the PCI table
serial: timberdale: Remove dependancies
tty: Fix the ldisc hangup race
tty: Fix up char drivers request_room usage
tty: Keep the default buffering to sub-page units
Albin Tonnerre (1):
serial: atmel_serial: add poll_get_char and poll_put_char uart_ops
Ari Entlich (1):
tty: Add a new VT mode which is like VT_PROCESS but doesn't require a VT_RELDISP ioctl call
Bartlomiej Zolnierkiewicz (1):
serial: cyclades: allow overriding ISA defaults also when the driver is built-in
Baruch Siach (1):
serial: imx: fix NULL dereference Oops when pdata == NULL
Ben Hutchings (1):
tty: declare MODULE_FIRMWARE in various drivers
Breno Leitao (2):
jsm: removing the uart structure and filename on error
jsm: fixing error if the driver fails to load
Graf Yang (1):
serial: bfin_5xx: need to disable DMA TX interrupt too
Ira W. Snyder (1):
serial: 8250_pci: add support for MCS9865 / SYBA 6x Serial Port Card
Jiri Slaby (3):
serial: Char: cyclades, fix compiler warning
tty: char: mxser, remove unnecessary tty test
Char: synclink, remove unnecessary checks
Joe Perches (1):
serial: isicom.c: use pr_fmt and pr_<level>
Kiros Yeh (1):
serial: add support for Korenix JetCard
Maxime Bizon (2):
serial: bcm63xx_uart: don't use kfree() on non kmalloced area.
serial: bcm63xx_uart: allow more than one uart to be registered.
Mike Frysinger (1):
serial: bfin_5xx: pull in linux/io.h for ioremap prototypes
Paul Fulghum (1):
serial: synclink_gt: dropped transmit data bugfix
Rakib Mullick (3):
tty: moxa: remove #ifdef MODULE completely.
ip2: remove #ifdef MODULE from ip2main.c
ip2: Add module parameter.
Roel Kluin (2):
serial: fix test of unsigned
hvc_console: fix test on unsigned in hvc_console_print()
Shmulik Ladkani (1):
serial: copy UART properties of UPF_FIXED_TYPE ports provisioned using early_serial_setup
Sonic Zhang (2):
serial: bfin_5xx: remove useless gpio handling with hard flow control
serial: bfin_5xx: kgdboc should accept gdb break only when it is active
Thiago Farina (1):
serial: 68328serial.c: remove BAUD_TABLE_SIZE macro
sonic zhang (1):
serial: fit blackfin uart over sport driver into common uart infrastructure
PATCH 1/36 serial: fit blackfin uart over sport driver into common uart infrastructure
From: sonic zhang <[email protected]>
Fit blackfin uart over sport driver into common uart inftrastructure. It is based on the early platform interfaces to get the platform data early when the console is initilized.
1. Enable sport uart driver to change uart baud, data bit, stop bit at runtime. Bind the index of uart device nodes to physical index of sports.
2. Move all platform data into arch specific board files. Register and probe platform device data in both early and normal stages.
3. Console is registered in sport uart driver as well.
4. Remove 500 us block waiting in sport tx stop code by putting a dummy data into tx fifo to make sure the sport tx stops when all bytes are shifted out except for the dummy data.
5. clean up a bit and fix up coding style.
--- drivers/serial/Kconfig | 52 ++-- drivers/serial/bfin_sport_uart.c | 701 +++++++++++++++++++++++++------------- drivers/serial/bfin_sport_uart.h | 38 +-- 3 files changed, 511 insertions(+), 280 deletions(-)
drivers/serial/Kconfig +24 -28
@@ -1418,38 +1418,34 @@ config SERIAL_BFIN_SPORT To compile this driver as a module, choose M here: the module will be called bfin_sport_uart. -choice - prompt "Baud rate for Blackfin SPORT UART" - depends on SERIAL_BFIN_SPORT - default SERIAL_SPORT_BAUD_RATE_57600 - help - Choose a baud rate for the SPORT UART, other uart settings are - 8 bit, 1 stop bit, no parity, no flow control. - -config SERIAL_SPORT_BAUD_RATE_115200 - bool "115200" - -config SERIAL_SPORT_BAUD_RATE_57600 - bool "57600" +config SERIAL_BFIN_SPORT_CONSOLE + bool "Console on Blackfin sport emulated uart" + depends on SERIAL_BFIN_SPORT=y + select SERIAL_CORE_CONSOLE -config SERIAL_SPORT_BAUD_RATE_38400 - bool "38400" +config SERIAL_BFIN_SPORT0_UART + bool "Enable UART over SPORT0" + depends on SERIAL_BFIN_SPORT && !(BF542 || BF542M || BF544 || BF544M) + help + Enable UART over SPORT0 -config SERIAL_SPORT_BAUD_RATE_19200 - bool "19200" +config SERIAL_BFIN_SPORT1_UART + bool "Enable UART over SPORT1" + depends on SERIAL_BFIN_SPORT + help + Enable UART over SPORT1 -config SERIAL_SPORT_BAUD_RATE_9600 - bool "9600" -endchoice +config SERIAL_BFIN_SPORT2_UART + bool "Enable UART over SPORT2" + depends on SERIAL_BFIN_SPORT && (BF54x || BF538 || BF539) + help + Enable UART over SPORT2 -config SPORT_BAUD_RATE - int - depends on SERIAL_BFIN_SPORT - default 115200 if (SERIAL_SPORT_BAUD_RATE_115200) - default 57600 if (SERIAL_SPORT_BAUD_RATE_57600) - default 38400 if (SERIAL_SPORT_BAUD_RATE_38400) - default 19200 if (SERIAL_SPORT_BAUD_RATE_19200) - default 9600 if (SERIAL_SPORT_BAUD_RATE_9600) +config SERIAL_BFIN_SPORT3_UART + bool "Enable UART over SPORT3" + depends on SERIAL_BFIN_SPORT && (BF54x || BF538 || BF539) + help + Enable UART over SPORT3 config SERIAL_TIMBERDALE tristate "Support for timberdale UART"
drivers/serial/bfin_sport_uart.c +469 -232
943 lines not on this page · raw message
drivers/serial/bfin_sport_uart.h +18 -20
@@ -1,29 +1,23 @@/* -* File: linux/drivers/serial/bfin_sport_uart.h +* Blackfin On-Chip Sport Emulated UART Driver * -* Based on: include/asm-blackfin/mach-533/bfin_serial_5xx.h -* Author: Roy Huang <roy.huang>analog.com> +* Copyright 2006-2008 Analog Devices Inc. * -* Created: Nov 22, 2006 -* Copyright: (C) Analog Device Inc. -* Description: this driver enable SPORTs on Blackfin emulate UART. +* Enter bugs at http://blackfin.uclinux.org/ * -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* 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. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, see the file COPYING, or write -* to the Free Software Foundation, Inc., -* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +* Licensed under the GPL-2 or later. */ +/* +* This driver and the hardware supported are in term of EE-191 of ADI. +* http://www.analog.com/UploadedFiles/Application_Notes/399447663EE191.pdf +* This application note describe how to implement a UART on a Sharc DSP, +* but this driver is implemented on Blackfin Processor. +* Transmit Frame Sync is not used by this driver to transfer data out. +*/ + +#ifndef _BFIN_SPORT_UART_H +#define _BFIN_SPORT_UART_H#define OFFSET_TCR1 0x00/* Transmit Configuration 1 Register */ #define OFFSET_TCR2 0x04/* Transmit Configuration 2 Register */
@@ -61,3 +55,7 @@#define SPORT_PUT_RCLKDIV (sport, v) bfin_write16(((sport)->port.membase + OFFSET_RCLKDIV), v)#define SPORT_PUT_RFSDIV (sport, v) bfin_write16(((sport)->port.membase + OFFSET_RFSDIV), v)#define SPORT_PUT_STAT (sport, v) bfin_write16(((sport)->port.membase + OFFSET_STAT), v) + +#define SPORT_TX_FIFO_SIZE 8 + +#endif /* _BFIN_SPORT_UART_H */
Signature · 1 line
1.7.0.1
PATCH 2/36 serial: copy UART properties of UPF_FIXED_TYPE ports provisioned using early_serial_setup
In reply to Greg KHFrom: Shmulik Ladkani <[email protected]>
Augment the UPF_FIXED_TYPE logic, which currently applies to UART ports provisioned using platform_device_register.
The suggested patch applies same logic into 'serial8250_register_ports', making UART ports provisioned using early_serial_setup inherit their properties from the uart_config entry.
--- drivers/serial/8250.c | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-)
drivers/serial/8250.c +15 -6
@@ -2690,6 +2690,15 @@ static void __init serial8250_isa_init_ports(void) } } +static void +serial8250_init_fixed_type_port (struct uart_8250_port *up,unsigned int type) +{ + up->port.type = type; + up->port.fifosize = uart_config[type].fifo_size; + up->capabilities = uart_config[type].flags; + up->tx_loadsz = uart_config[type].tx_loadsz; +} +static void __init serial8250_register_ports (struct uart_driver *drv,struct device *dev) {
@@ -2706,6 +2715,10 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev)struct uart_8250_port *up = &serial8250_ports[i]; up->port.dev = dev; + +if (up->port.flags &UPF_FIXED_TYPE ) +serial8250_init_fixed_type_port (up, up->port.type); +uart_add_one_port (drv, &up->port); } }
@@ -3118,12 +3131,8 @@ int serial8250_register_port(struct uart_port *port)if (port->dev) uart->port.dev = port->dev; -if (port->flags &UPF_FIXED_TYPE ) { - uart->port.type = port->type; - uart->port.fifosize = uart_config[port->type].fifo_size; - uart->capabilities = uart_config[port->type].flags; - uart->tx_loadsz = uart_config[port->type].tx_loadsz; - } +if (port->flags &UPF_FIXED_TYPE ) +serial8250_init_fixed_type_port (uart, port->type);set_io_from_upio (&uart->port);/* Possibly override default I/O functions. */
Signature · 1 line
1.7.0.1
PATCH 3/36 serial: 68328serial.c: remove BAUD_TABLE_SIZE macro
In reply to Greg KHFrom: Thiago Farina <[email protected]>
This macro is a duplicate of ARRAY_SIZE defined in kernel api, so just use that instead.
--- drivers/serial/68328serial.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/serial/68328serial.c +3 -5
@@ -153,8 +153,6 @@ static int baud_table[] = {0 ,50 ,75 ,110 ,134 ,150 ,200 ,300 ,600 ,1200 ,1800 ,2400 ,4800 , 9600, 19200, 38400, 57600, 115200, 0 }; -#define BAUD_TABLE_SIZE (sizeof(baud_table)/sizeof(baud_table[0])) -/* Sets or clears DTR/RTS on the requested line */ static inline void m68k_rtsdtr (struct m68k_serial *ss,int set) {
@@ -1406,10 +1404,10 @@ static void m68328_set_baud(void)USTCNT = ustcnt & ~USTCNT_TXEN ; again: -for (i =0 ; i <sizeof (baud_table) /sizeof (baud_table[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (baud_table); i++)if (baud_table[i] == m68328_console_baud)break ; -if (i >=sizeof (baud_table) /sizeof (baud_table[0 ])) { +if (i >=ARRAY_SIZE (baud_table)) { m68328_console_baud =9600 ; goto again; }
@@ -1435,7 +1433,7 @@ int m68328_console_setup(struct console *cp, char *arg)if (arg) n =simple_strtoul (arg,NULL ,0 ); -for (i =0 ; i <BAUD_TABLE_SIZE ; i++) +for (i =0 ; i <ARRAY_SIZE (baud_table); i++)if (baud_table[i] == n)break ;if (i <BAUD_TABLE_SIZE ) {
Signature · 1 line
1.7.0.1
PATCH 4/36 serial: atmel_serial: add poll_get_char and poll_put_char uart_ops
In reply to Greg KHFrom: Albin Tonnerre <[email protected]>
Permits using KGDB over the console with the atmel_serial driver.
--- drivers/serial/atmel_serial.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
drivers/serial/atmel_serial.c +22 -0
@@ -1213,6 +1213,24 @@ static int atmel_verify_port(struct uart_port *port, struct serial_struct *ser)return ret; } +#ifdef CONFIG_CONSOLE_POLL +static int atmel_poll_get_char (struct uart_port *port) +{ +while (!(UART_GET_CSR (port) &ATMEL_US_RXRDY )) +cpu_relax (); + +return UART_GET_CHAR (port); +} + +static void atmel_poll_put_char (struct uart_port *port,unsigned char ch) +{ +while (!(UART_GET_CSR (port) &ATMEL_US_TXRDY )) +cpu_relax (); + +UART_PUT_CHAR (port, ch); +} +#endif +static struct uart_ops atmel_pops = { .tx_empty = atmel_tx_empty, .set_mctrl = atmel_set_mctrl,
@@ -1232,6 +1250,10 @@ static struct uart_ops atmel_pops = { .config_port = atmel_config_port, .verify_port = atmel_verify_port, .pm = atmel_serial_pm, +#ifdef CONFIG_CONSOLE_POLL + .poll_get_char = atmel_poll_get_char, + .poll_put_char = atmel_poll_put_char, +#endif };/*
Signature · 1 line
1.7.0.1
PATCH 5/36 serial: synclink_gt: dropped transmit data bugfix
In reply to Greg KHFrom: Paul Fulghum <[email protected]>
Fix transmit bug that could drop send data if write() called close to serial transmitter going idle after sending previous data. Bug is caused by incorrect use of device information member tx_count.
Driver originally processed one data block (write call) at a time, waiting for transmit idle before sending more. tx_count recorded how much data was loaded in DMA buffers on write(), and was cleared on send completion. tx_count use was overloaded to record accumulated data from put_char() callback when transmitter was idle.
A bug was introduced when transmit code was reworked to allow multiple blocks of data in the tx DMA buffers which keeps transmitter from going idle between blocks. tx_count was set to size of last block loaded, cleared when tx went idle, and monitored to know when to restart transmitter without proper synchronization. tx_count could be cleared when unsent data remained in DMA buffers and transmitter required restarting, effectively dropping unsent data.
Solution:
1. tx_count now used only to track accumulated data from put_char
2. DMA buffer state tracked by direct inspection of descriptors with spinlock synchronization
3. consolidate these tasks in tx_load() :
a. check for available buffer space
b. load buffers
c. restart DMA and or serial transmitter as needed These steps were previously duplicated in multiple places, sometimes incompletely.
4. fix use of tx_count as active transmit indicator, instead using tx_active which is meant for that purpose
--- drivers/char/synclink_gt.c | 186 +++++++++++++++++++++++++------------------- 1 files changed, 105 insertions(+), 81 deletions(-)
drivers/char/synclink_gt.c +105 -81
@@ -468,7 +468,7 @@ static unsigned int free_tbuf_count(struct slgt_info *info);static unsigned int tbuf_bytes (struct slgt_info *info);static void reset_tbufs (struct slgt_info *info);static void tdma_reset (struct slgt_info *info); -static void tx_load (struct slgt_info *info,const char *buf,unsigned int count); +static bool tx_load (struct slgt_info *info,const char *buf,unsigned int count);static void get_signals (struct slgt_info *info);static void set_signals (struct slgt_info *info);
@@ -813,59 +813,32 @@ static int write(struct tty_struct *tty,int ret =0 ;struct slgt_info *info = tty->driver_data;unsigned long flags; -unsigned int bufs_needed;if (sanity_check (info, tty->name,"write" )) - goto cleanup; +return -EIO ; +DBGINFO (("%s write count=%d\n" , info->device_name, count)); -if (!info->tx_buf) - goto cleanup; +if (!info->tx_buf || (count > info->max_frame_size)) +return -EIO ; -if (count > info->max_frame_size) { - ret = -EIO ; - goto cleanup; - } +if (!count || tty->stopped || tty->hw_stopped) +return 0 ; -if (!count) - goto cleanup; +spin_lock_irqsave (&info->lock, flags); -if (!info->tx_active && info->tx_count) { +if (info->tx_count) {/* send accumulated data from send_char() */ -tx_load (info, info->tx_buf, info->tx_count); - goto start; +if (!tx_load (info, info->tx_buf, info->tx_count)) + goto cleanup; + info->tx_count =0 ; } - bufs_needed = (count/DMABUFSIZE ); -if (count %DMABUFSIZE ) - ++bufs_needed; -if (bufs_needed >free_tbuf_count (info)) - goto cleanup; - ret = info->tx_count = count; -tx_load (info, buf, count); - goto start; - -start: -if (info->tx_count && !tty->stopped && !tty->hw_stopped) { -spin_lock_irqsave (&info->lock,flags); -if (!info->tx_active) -tx_start (info); -else if (!(rd_reg32 (info,TDCSR ) &BIT0 )) { -/* transmit still active but transmit DMA stopped */ -unsigned int i = info->tbuf_current; -if (!i) - i = info->tbuf_count; - i--; -/* if DMA buf unsent must try later after tx idle */ -if (desc_count (info->tbufs[i])) - ret =0 ; - } -if (ret >0 ) -update_tx_timer (info); -spin_unlock_irqrestore (&info->lock,flags); - } +if (tx_load (info, buf, count)) + ret = count; cleanup: +spin_unlock_irqrestore (&info->lock, flags);DBGINFO (("%s write rc=%d\n" , info->device_name, ret));return ret; }
@@ -882,7 +855,7 @@ static int put_char(struct tty_struct *tty, unsigned char ch)if (!info->tx_buf)return 0 ;spin_lock_irqsave (&info->lock,flags); -if (!info->tx_active && (info->tx_count < info->max_frame_size)) { +if (info->tx_count < info->max_frame_size) { info->tx_buf[info->tx_count++] = ch; ret =1 ; }
@@ -981,10 +954,8 @@ static void flush_chars(struct tty_struct *tty)DBGINFO (("%s flush_chars start transmit\n" , info->device_name));spin_lock_irqsave (&info->lock,flags); -if (!info->tx_active && info->tx_count) { -tx_load (info, info->tx_buf,info->tx_count); -tx_start (info); - } +if (info->tx_count &&tx_load (info, info->tx_buf, info->tx_count)) + info->tx_count =0 ;spin_unlock_irqrestore (&info->lock,flags); }
@@ -997,10 +968,9 @@ static void flush_buffer(struct tty_struct *tty)return ;DBGINFO (("%s flush_buffer\n" , info->device_name)); -spin_lock_irqsave (&info->lock,flags); -if (!info->tx_active) - info->tx_count =0 ; -spin_unlock_irqrestore (&info->lock,flags); +spin_lock_irqsave (&info->lock, flags); + info->tx_count =0 ; +spin_unlock_irqrestore (&info->lock, flags);tty_wakeup (tty); }
@@ -1033,12 +1003,10 @@ static void tx_release(struct tty_struct *tty)if (sanity_check (info, tty->name,"tx_release" ))return ;DBGINFO (("%s tx_release\n" , info->device_name)); -spin_lock_irqsave (&info->lock,flags); -if (!info->tx_active && info->tx_count) { -tx_load (info, info->tx_buf, info->tx_count); -tx_start (info); - } -spin_unlock_irqrestore (&info->lock,flags); +spin_lock_irqsave (&info->lock, flags); +if (info->tx_count &&tx_load (info, info->tx_buf, info->tx_count)) + info->tx_count =0 ; +spin_unlock_irqrestore (&info->lock, flags); }/*
@@ -1506,27 +1474,25 @@ static netdev_tx_t hdlcdev_xmit(struct sk_buff *skb,DBGINFO (("%s hdlc_xmit\n" , dev->name)); +if (!skb->len) +return NETDEV_TX_OK ; +/* stop sending until this frame completes */ netif_stop_queue (dev); -/* copy data to device buffers */ - info->tx_count = skb->len; -tx_load (info, skb->data, skb->len); -/* update network statistics */ dev->stats.tx_packets++; dev->stats.tx_bytes += skb->len; -/* done with socket buffer, so free it */ -dev_kfree_skb (skb); -/* save start time for transmit timeout detection */ dev->trans_start = jiffies; -spin_lock_irqsave (&info->lock,flags); -tx_start (info); -update_tx_timer (info); -spin_unlock_irqrestore (&info->lock,flags); +spin_lock_irqsave (&info->lock, flags); +tx_load (info, skb->data, skb->len); +spin_unlock_irqrestore (&info->lock, flags); + +/* done with socket buffer, so free it */ +dev_kfree_skb (skb);return NETDEV_TX_OK ; }
@@ -2180,7 +2146,7 @@ static void isr_serial(struct slgt_info *info)if (info->params.mode ==MGSL_MODE_ASYNC ) {if (status &IRQ_TXIDLE ) { -if (info->tx_count) +if (info->tx_active)isr_txeom (info, status); }if (info->rx_pio && (status &IRQ_RXDATA ))
@@ -2276,13 +2242,42 @@ static void isr_tdma(struct slgt_info *info) } } +/* +* return true if there are unsent tx DMA buffers, otherwise false +* +* if there are unsent buffers then info->tbuf_start +* is set to index of first unsent buffer +*/ +static bool unsent_tbufs (struct slgt_info *info) +{ +unsigned int i = info->tbuf_current; +bool rc = false; + +/* +* search backwards from last loaded buffer (precedes tbuf_current) +* for first unsent buffer (desc_count > 0) +*/ + +do { +if (i) + i--; +else + i = info->tbuf_count -1 ; +if (!desc_count (info->tbufs[i])) +break ; + info->tbuf_start = i; + rc = true; + }while (i != info->tbuf_current); + +return rc; +} +static void isr_txeom (struct slgt_info *info,unsigned short status) {DBGISR (("%s txeom status=%04x\n" , info->device_name, status));slgt_irq_off (info,IRQ_TXDATA +IRQ_TXIDLE +IRQ_TXUNDER );tdma_reset (info); -reset_tbufs (info);if (status &IRQ_TXUNDER ) {unsigned short val =rd_reg16 (info,TCR );wr_reg16 (info,TCR , (unsigned short )(val |BIT2 ));/* set reset bit */
@@ -2297,8 +2292,12 @@ static void isr_txeom(struct slgt_info *info, unsigned short status) info->icount.txok++; } +if (unsent_tbufs (info)) { +tx_start (info); +update_tx_timer (info); +return ; + } info->tx_active = false; - info->tx_count =0 ;del_timer (&info->tx_timer);
@@ -3949,7 +3948,7 @@ static void tx_start(struct slgt_info *info) info->tx_enabled = true; } -if (info->tx_count) { +if (desc_count (info->tbufs[info->tbuf_start])) { info->drop_rts_on_tx_done = false;if (info->params.mode !=MGSL_MODE_ASYNC ) {
@@ -4772,25 +4771,36 @@ static unsigned int tbuf_bytes(struct slgt_info *info) }/* -* load transmit DMA buffer(s) with data +* load data into transmit DMA buffer ring and start transmitter if needed +* return true if data accepted, otherwise false (buffers full) */ -static void tx_load (struct slgt_info *info,const char *buf,unsigned int size) +static bool tx_load (struct slgt_info *info,const char *buf,unsigned int size) {unsigned short count;unsigned int i;struct slgt_desc *d; -if (size ==0 ) -return ; +/* check required buffer space */ +if (DIV_ROUND_UP (size,DMABUFSIZE ) >free_tbuf_count (info)) +return false;DBGDATA (info, buf, size,"tx" ); +/* +* copy data to one or more DMA buffers in circular ring +* tbuf_start = first buffer for this data +* tbuf_current = next free buffer +* +* Copy all data before making data visible to DMA controller by +* setting descriptor count of the first buffer. +* This prevents an active DMA controller from reading the first DMA +* buffers of a frame and stopping before the final buffers are filled. +*/ + info->tbuf_start = i = info->tbuf_current;while (size) { d = &info->tbufs[i]; -if (++i == info->tbuf_count) - i =0 ; count = (unsigned short )((size >DMABUFSIZE ) ?DMABUFSIZE : size);memcpy (d->buf, buf, count);
@@ -4808,11 +4818,27 @@ static void tx_load(struct slgt_info *info, const char *buf, unsigned int size)else set_desc_eof (*d,0 ); -set_desc_count (*d, count); +/* set descriptor count for all but first buffer */ +if (i != info->tbuf_start) +set_desc_count (*d, count); d->buf_count = count; + +if (++i == info->tbuf_count) + i =0 ; } info->tbuf_current = i; + +/* set first buffer count to make new data visible to DMA controller */ + d = &info->tbufs[info->tbuf_start]; +set_desc_count (*d, d->buf_count); + +/* start transmitter if needed and update transmit timeout */ +if (!info->tx_active) +tx_start (info); +update_tx_timer (info); + +return true; }static int register_test (struct slgt_info *info)
@@ -4934,9 +4960,7 @@ static int loopback_test(struct slgt_info *info)spin_lock_irqsave (&info->lock,flags);async_mode (info);rx_start (info); - info->tx_count = count;tx_load (info, buf, count); -tx_start (info);spin_unlock_irqrestore (&info->lock, flags);/* wait for receive complete */
Signature · 1 line
1.7.0.1
PATCH 6/36 serial: 8250_pci: add support for MCS9865 / SYBA 6x Serial Port Card
In reply to Greg KHFrom: Ira W. Snyder <[email protected]>
This patch is heavily based on an earlier patch found on the linux-serial mailing list [1], written by Darius Augulis.
The previous incarnation of this patch only supported a 2x serial port card. I have added support for my SYBA 6x serial port card, and tested on x86.
[1]: http://marc.info/?l=linux-serial&m=124975806304760
--- drivers/parport/parport_pc.c | 6 ++++++ drivers/serial/8250_pci.c | 22 +++++++++++++++++++++- include/linux/pci_ids.h | 1 + 3 files changed, 28 insertions(+), 1 deletions(-)
drivers/parport/parport_pc.c +6 -0
@@ -2908,6 +2908,7 @@ enum parport_pc_pci_cards { netmos_9805, netmos_9815, netmos_9901, + netmos_9865, quatech_sppxp100, };
@@ -2989,6 +2990,7 @@ static struct parport_pc_pci { /* netmos_9805 */ { 1, { { 0, -1 }, } }, /* netmos_9815 */ { 2, { { 0, -1 }, { 2, -1 }, } }, /* netmos_9901 */ { 1, { { 0, -1 }, } }, + /* netmos_9865 */ { 1, { { 0, -1 }, } }, /* quatech_sppxp100 */ { 1, { { 0, 1 }, } }, };
@@ -3092,6 +3094,10 @@ static const struct pci_device_id parport_pc_pci_tbl[] = { PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9815 }, { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9901, 0xA000, 0x2000, 0, 0, netmos_9901 }, + { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865, + 0xA000, 0x1000, 0, 0, netmos_9865 }, + { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865, + 0xA000, 0x2000, 0, 0, netmos_9865 },/* Quatech SPPXP-100 Parallel port PCI ExpressCard */ { PCI_VENDOR_ID_QUATECH, PCI_DEVICE_ID_QUATECH_SPPXP_100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 },
drivers/serial/8250_pci.c +21 -1
@@ -760,7 +760,8 @@ static int pci_netmos_init(struct pci_dev *dev)/* subdevice 0x00PS means <P> parallel, <S> serial */ unsigned int num_serial = dev->subsystem_device &0xf ; -if (dev->device ==PCI_DEVICE_ID_NETMOS_9901 ) +if ((dev->device ==PCI_DEVICE_ID_NETMOS_9901 ) || + (dev->device ==PCI_DEVICE_ID_NETMOS_9865 ))return 0 ;if (dev->subsystem_vendor ==PCI_VENDOR_ID_IBM && dev->subsystem_device ==0x0299 )
@@ -1479,6 +1480,7 @@ enum pci_board_num_t { pbn_b0_bt_1_115200, pbn_b0_bt_2_115200, + pbn_b0_bt_4_115200, pbn_b0_bt_8_115200, pbn_b0_bt_1_460800,
@@ -1703,6 +1705,12 @@ static struct pciserial_board pci_boards[] __devinitdata = { .base_baud = 115200, .uart_offset = 8, }, + [pbn_b0_bt_4_115200] = { + .flags = FL_BASE0|FL_BASE_BARS, + .num_ports = 4, + .base_baud = 115200, + .uart_offset = 8, + }, [pbn_b0_bt_8_115200] = { .flags = FL_BASE0|FL_BASE_BARS, .num_ports = 8,
@@ -3649,6 +3657,18 @@ static struct pci_device_id serial_pci_tbl[] = { 0, 0, pbn_b0_1_115200 },/* +* Best Connectivity PCI Multi I/O cards +*/ + + {PCI_VENDOR_ID_NETMOS ,PCI_DEVICE_ID_NETMOS_9865 , +0xA000 ,0x1000 , + 0, 0, pbn_b0_1_115200 }, + + { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9865, +0xA000 ,0x3004 , + 0, 0, pbn_b0_bt_4_115200 }, + +/* * These entries match devices with class COMMUNICATION_SERIAL, * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL */
include/linux/pci_ids.h +1 -0
@@ -2697,6 +2697,7 @@#define PCI_DEVICE_ID_NETMOS_9835 0x9835#define PCI_DEVICE_ID_NETMOS_9845 0x9845#define PCI_DEVICE_ID_NETMOS_9855 0x9855 +#define PCI_DEVICE_ID_NETMOS_9865 0x9865#define PCI_DEVICE_ID_NETMOS_9901 0x9901#define PCI_VENDOR_ID_3COM_2 0xa727
Signature · 1 line
1.7.0.1
PATCH 7/36 serial: imx: fix NULL dereference Oops when pdata == NULL
In reply to Greg KHFrom: Baruch Siach <[email protected]>
The platform code doesn't have to provide platform data to get sensible default behaviour from the imx serial driver.
This patch does not handle NULL dereference in the IrDA case, which still requires a valid platform data pointer (in imx_startup()/imx_shutdown()), since I don't know whether there is a sensible default behaviour, or should the operation just fail cleanly.
--- drivers/serial/imx.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/serial/imx.c +3 -3
@@ -1279,7 +1279,7 @@ static int serial_imx_probe(struct platform_device *pdev) sport->use_irda =1 ;#endif -if (pdata->init) { +if (pdata && pdata->init) { ret = pdata->init (pdev);if (ret) goto clkput;
@@ -1292,7 +1292,7 @@ static int serial_imx_probe(struct platform_device *pdev)return 0 ; deinit: -if (pdata->exit) +if (pdata && pdata->exit) pdata->exit (pdev); clkput:clk_put (sport->clk);
@@ -1321,7 +1321,7 @@ static int serial_imx_remove(struct platform_device *pdev)clk_disable (sport->clk); -if (pdata->exit) +if (pdata && pdata->exit) pdata->exit (pdev);iounmap (sport->port.membase);
Signature · 1 line
1.7.0.1
PATCH 8/36 serial: add support for Korenix JetCard
In reply to Greg KHFrom: Kiros Yeh <[email protected]>
Add different model (with a different PCI ID) to support Korenix JetCard.
--- drivers/serial/8250_pci.c | 9 +++++++++ include/linux/pci_ids.h | 2 ++ 2 files changed, 11 insertions(+), 0 deletions(-)
drivers/serial/8250_pci.c +9 -0
@@ -3199,6 +3199,15 @@ static struct pci_device_id serial_pci_tbl[] = {0x1208 ,0x0004 ,0 ,0 , pbn_b0_4_921600 }, + { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF2, +0x1204 ,0x0004 ,0 ,0 , + pbn_b0_4_921600 }, + { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF2, +0x1208 ,0x0004 ,0 ,0 , + pbn_b0_4_921600 }, + { PCI_VENDOR_ID_KORENIX, PCI_DEVICE_ID_KORENIX_JETCARDF3, +0x1208 ,0x0004 ,0 ,0 , + pbn_b0_4_921600 },/* * Dell Remote Access Card 4 - [email protected] */
include/linux/pci_ids.h +2 -0
@@ -2333,6 +2333,8 @@#define PCI_VENDOR_ID_KORENIX 0x1982#define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600#define PCI_DEVICE_ID_KORENIX_JETCARDF1 0x16ff +#define PCI_DEVICE_ID_KORENIX_JETCARDF2 0x1700 +#define PCI_DEVICE_ID_KORENIX_JETCARDF3 0x17ff#define PCI_VENDOR_ID_QMI 0x1a32
Signature · 1 line
1.7.0.1
PATCH 9/36 serial: fix test of unsigned
In reply to Greg KHFrom: Roel Kluin <[email protected]>
The variables were unsigned so the tests did not work.
--- drivers/serial/msm_serial.c | 6 ++++-- drivers/serial/timbuart.c | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/serial/msm_serial.c +4 -2
@@ -691,6 +691,7 @@ static int __init msm_serial_probe(struct platform_device *pdev)struct msm_port *msm_port;struct resource *resource;struct uart_port *port; +int irq;if (unlikely (pdev->id <0 || pdev->id >=UART_NR ))return -ENXIO ;
@@ -711,9 +712,10 @@ static int __init msm_serial_probe(struct platform_device *pdev)return -ENXIO ; port->mapbase = resource->start; - port->irq =platform_get_irq (pdev,0 ); -if (unlikely (port->irq <0 )) + irq =platform_get_irq (pdev,0 ); +if (unlikely (irq <0 ))return -ENXIO ; + port->irq = irq;platform_set_drvdata (pdev, port);
drivers/serial/timbuart.c +4 -3
@@ -421,7 +421,7 @@ static struct uart_driver timbuart_driver = {static int timbuart_probe (struct platform_device *dev) { -int err; +int err, irq;struct timbuart_port *uart;struct resource *iomem;
@@ -453,11 +453,12 @@ static int timbuart_probe(struct platform_device *dev) uart->port.mapbase = iomem->start; uart->port.membase =NULL ; - uart->port.irq =platform_get_irq (dev,0 ); -if (uart->port.irq <0 ) { + irq =platform_get_irq (dev,0 ); +if (irq <0 ) { err = -EINVAL ; goto err_register; } + uart->port.irq = irq;tasklet_init (&uart->tasklet, timbuart_tasklet, (unsigned long )uart);
Signature · 1 line
1.7.0.1
PATCH 10/36 serial: Char: cyclades, fix compiler warning
In reply to Greg KHFrom: Jiri Slaby <[email protected]>
With gcc 4.0.2:drivers/char/cyclades.c: In function 'cyy_interrupt':drivers/char/cyclades.c:581: warning: 'info' may be used uninitialized in this function
introduced by
: commit 3aeea5b92210083c7cffd4f08a0bb141d3f2d574
: Author: Jiri Slaby <[email protected]>
: AuthorDate: Sat Sep 19 13:13:16 2009 -0700
: Commit: Live-CD User <[email protected]>
: CommitDate: Sat Sep 19 13:13:16 2009 -0700
:
: cyclades: introduce cyy_readb/writeb
In fact the true branch which uses uninitialized 'info' can never happen because chip is always less than ->nchips and channel is always less than 4 which we alloc.
So behave similar to rx handling and remove the test completely.
I wonder why gcc 4.4.1 doesn't spit a word.
--- drivers/char/cyclades.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
drivers/char/cyclades.c +0 -6
@@ -598,12 +598,6 @@ static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip, save_car =readb (base_addr + (CyCAR << index));cy_writeb (base_addr + (CyCAR << index), save_xir); -/* validate the port# (as configured and open) */ -if (channel + chip *4 >= cinfo->nports) { -cy_writeb (base_addr + (CySRER << index), -readb (base_addr + (CySRER << index)) & ~CyTxRdy); - goto end; - } info = &cinfo->ports[channel + chip *4 ]; tty =tty_port_tty_get (&info->port);if (tty ==NULL ) {
Signature · 1 line
1.7.0.1
PATCH 11/36 serial: cyclades: allow overriding ISA defaults also when the driver is built-in
In reply to Greg KHFrom: Bartlomiej Zolnierkiewicz <[email protected]>
--- drivers/char/cyclades.c | 9 +-------- 1 files changed, 1 insertions(+), 8 deletions(-)
drivers/char/cyclades.c +1 -8
@@ -158,13 +158,11 @@ static unsigned int cy_isa_addresses[] = {#define NR_ISA_ADDRS ARRAY_SIZE(cy_isa_addresses) -#ifdef MODULE static long maddr[NR_CARDS ];static int irq[NR_CARDS ];module_param_array (maddr, long,NULL ,0 );module_param_array (irq, int,NULL ,0 ); -#endif #endif /* CONFIG_ISA */
@@ -3310,13 +3308,10 @@ static int __init cy_detect_isa(void)unsigned short cy_isa_irq, nboard;void __iomem *cy_isa_address;unsigned short i, j, cy_isa_nchan; -#ifdef MODULE int isparam =0 ; -#endif nboard =0 ; -#ifdef MODULE /* Check for module parameters */ for (i =0 ; i <NR_CARDS ; i++) {if (maddr[i] || i) {
@@ -3326,7 +3321,6 @@ static int __init cy_detect_isa(void)if (!maddr[i])break ; } -#endif /* scan the address table probing for Cyclom-Y/ISA boards */ for (i =0 ; i <NR_ISA_ADDRS ; i++) {
@@ -3347,11 +3341,10 @@ static int __init cy_detect_isa(void)iounmap (cy_isa_address);continue ; } -#ifdef MODULE +if (isparam && i <NR_CARDS && irq[i]) cy_isa_irq = irq[i];else -#endif /* find out the board's irq by probing */ cy_isa_irq =detect_isa_irq (cy_isa_address);if (cy_isa_irq ==0 ) {
Signature · 1 line
1.7.0.1
PATCH 12/36 tty: char: mxser, remove unnecessary tty test
In reply to Greg KHFrom: Jiri Slaby <[email protected]>
Stanse found unnecessary test in mxser_startup.
tty is dereferenced earlier, the test is superfluous. Remove it.
--- drivers/char/mxser.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/char/mxser.c +1 -2
@@ -895,8 +895,7 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty)if (inb (info->ioaddr +UART_LSR ) ==0xff ) {spin_unlock_irqrestore (&info->slock, flags);if (capable (CAP_SYS_ADMIN )) { -if (tty) -set_bit (TTY_IO_ERROR , &tty->flags); +set_bit (TTY_IO_ERROR , &tty->flags);return 0 ; }else return -ENODEV ;
Signature · 1 line
1.7.0.1
PATCH 13/36 serial: isicom.c: use pr_fmt and pr_<level>
In reply to Greg KHFrom: Joe Perches <[email protected]>
Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Convert printks to pr_<level>
Convert some embedded function names to %s...__func__ Remove a period after exclamation points.
Remove #define pr_dbg which could be used by future kernel.h includes
--- drivers/char/isicom.c | 49 ++++++++++++++++++++++++++----------------------- 1 files changed, 26 insertions(+), 23 deletions(-)
drivers/char/isicom.c +26 -23
@@ -113,6 +113,8 @@* 64-bit verification */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/module.h> #include <linux/firmware.h> #include <linux/kernel.h>
@@ -140,7 +142,6 @@#define InterruptTheCard (base) outw(0, (base) + 0xc)#define ClearInterrupt (base) inw((base) + 0x0a) -#define pr_dbg(str...) pr_debug("ISICOM: " str)#ifdef DEBUG #define isicom_paranoia_check (a, b, c) __isicom_paranoia_check((a), (b), (c))#else
@@ -249,8 +250,7 @@ static int lock_card(struct isi_board *card)spin_unlock_irqrestore (&card->card_lock, card->flags);msleep (10 ); } -printk (KERN_WARNING "ISICOM: Failed to lock Card (0x%lx)\n" , - card->base); +pr_warning ("Failed to lock Card (0x%lx)\n" , card->base);return 0 ;/* Failed to acquire the card! */ }
@@ -379,13 +379,13 @@ static inline int __isicom_paranoia_check(struct isi_port const *port, char *name, const char *routine) {if (!port) { -printk (KERN_WARNING "ISICOM: Warning: bad isicom magic for " -"dev %s in %s.\n" , name, routine); +pr_warning ("Warning: bad isicom magic for dev %s in %s.\n" , + name, routine);return 1 ; }if (port->magic !=ISICOM_MAGIC ) { -printk (KERN_WARNING "ISICOM: Warning: NULL isicom port for " -"dev %s in %s.\n" , name, routine); +pr_warning ("Warning: NULL isicom port for dev %s in %s.\n" , + name, routine);return 1 ; }
@@ -450,8 +450,8 @@ static void isicom_tx(unsigned long _data)if (!(inw (base +0x02 ) & (1 << port->channel)))continue ; -pr_dbg ("txing %d bytes, port%d.\n" , txcount, - port->channel +1 ); +pr_debug ("txing %d bytes, port%d.\n" , + txcount, port->channel +1 );outw ((port->channel << isi_card[card].shift_count) | txcount, base); residue =NO ;
@@ -547,8 +547,8 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id) byte_count = header &0xff ;if (channel +1 > card->port_count) { -printk (KERN_WARNING "ISICOM: isicom_interrupt(0x%lx): " -"%d(channel) > port_count.\n" , base, channel+1 ); +pr_warning ("%s(0x%lx): %d(channel) > port_count.\n" , + __func__, base, channel+1 );outw (0x0000 , base+0x04 );/* enable interrupts */ spin_unlock (&card->card_lock);return IRQ_HANDLED ;
@@ -582,14 +582,15 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)if (port->status &ISI_DCD ) {if (!(header &ISI_DCD )) {/* Carrier has been lost */ -pr_dbg ("interrupt: DCD->low.\n" - ); +pr_debug ("%s: DCD->low.\n" , + __func__); port->status &= ~ISI_DCD ;tty_hangup (tty); } }else if (header &ISI_DCD ) {/* Carrier has been detected */ -pr_dbg ("interrupt: DCD->high.\n" ); +pr_debug ("%s: DCD->high.\n" , + __func__); port->status |=ISI_DCD ;wake_up_interruptible (&port->port.open_wait); }
@@ -641,17 +642,19 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)break ;case 2 :/* Statistics */ -pr_dbg ("isicom_interrupt: stats!!!.\n" ); +pr_debug ("%s: stats!!!\n" , __func__);break ;default : -pr_dbg ("Intr: Unknown code in status packet.\n" ); +pr_debug ("%s: Unknown code in status packet.\n" , + __func__);break ; } }else {/* Data Packet */ count =tty_prepare_flip_string (tty, &rp, byte_count & ~1 ); -pr_dbg ("Intr: Can rx %d of %d bytes.\n" , count, byte_count); +pr_debug ("%s: Can rx %d of %d bytes.\n" , + __func__, count, byte_count); word_count = count >>1 ;insw (base, rp, word_count); byte_count -= (word_count <<1 );
@@ -661,8 +664,8 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id) byte_count -=2 ; }if (byte_count >0 ) { -pr_dbg ("Intr(0x%lx:%d): Flip buffer overflow! dropping " -"bytes...\n" , base, channel +1 ); +pr_debug ("%s(0x%lx:%d): Flip buffer overflow! dropping bytes...\n" , + __func__, base, channel +1 );/* drain out unread xtra data */ while (byte_count >0 ) {inw (base);
@@ -888,8 +891,8 @@ static void isicom_shutdown_port(struct isi_port *port)struct isi_board *card = port->card;if (--card->count <0 ) { -pr_dbg ("isicom_shutdown_port: bad board(0x%lx) count %d.\n" , - card->base, card->count); +pr_debug ("%s: bad board(0x%lx) count %d.\n" , + __func__, card->base, card->count); card->count =0 ; }/* last port was closed, shutdown that board too */
@@ -1681,13 +1684,13 @@ static int __init isicom_init(void) retval =tty_register_driver (isicom_normal);if (retval) { -pr_dbg ("Couldn't register the dialin driver\n" ); +pr_debug ("Couldn't register the dialin driver\n" ); goto err_puttty; } retval =pci_register_driver (&isicom_driver);if (retval <0 ) { -printk (KERN_ERR "ISICOM: Unable to register pci driver.\n" ); +pr_err ("Unable to register pci driver.\n" ); goto err_unrtty; }
Signature · 1 line
1.7.0.1
PATCH 14/36 hvc_console: fix test on unsigned in hvc_console_print()
In reply to Greg KHFrom: Roel Kluin <[email protected]>
vtermnos[] is unsigned, so this test was wrong.
--- drivers/char/hvc_console.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/char/hvc_console.c +1 -1
@@ -146,7 +146,7 @@ static void hvc_console_print(struct console *co, const char *b,return ;/* This console adapter was removed so it is not usable. */ -if (vtermnos[index] <0 ) +if (vtermnos[index] ==-1 )return ;while (count >0 || i >0 ) {
Signature · 1 line
1.7.0.1
PATCH 15/36 tty: moxa: remove #ifdef MODULE completely.
In reply to Greg KHFrom: Rakib Mullick <[email protected]>
We can pass "module parameters" on the kernel command line even when !MODULE. So, #ifdef MODULE becomes obsolete. Also move the declaration moxa_board_conf at the start of the function, since we were hit by the following warning.
drivers/char/moxa.c: In function `moxa_init':drivers/char/moxa.c:1040: warning: ISO C90 forbids mixed declarations and code
--- drivers/char/moxa.c | 17 ++++++----------- 1 files changed, 6 insertions(+), 11 deletions(-)
drivers/char/moxa.c +6 -11
@@ -164,24 +164,22 @@ static unsigned int moxaFuncTout = HZ / 2;static unsigned int moxaLowWaterChk;static DEFINE_MUTEX (moxa_openlock);static DEFINE_SPINLOCK (moxa_lock); -/* Variables for insmod */ -#ifdef MODULE +static unsigned long baseaddr[MAX_BOARDS ];static unsigned int type[MAX_BOARDS ];static unsigned int numports[MAX_BOARDS ]; -#endif MODULE_AUTHOR ("William Chen" );MODULE_DESCRIPTION ("MOXA Intellio Family Multiport Board Device Driver" );MODULE_LICENSE ("GPL" ); -#ifdef MODULE +module_param_array (type, uint,NULL ,0 );MODULE_PARM_DESC (type,"card type: C218=2, C320=4" );module_param_array (baseaddr, ulong,NULL ,0 );MODULE_PARM_DESC (baseaddr,"base address" );module_param_array (numports, uint,NULL ,0 );MODULE_PARM_DESC (numports,"numports (ignored for C218)" ); -#endif +module_param (ttymajor, int,0 );/*
@@ -1024,6 +1022,8 @@ static int __init moxa_init(void) {unsigned int isabrds =0 ;int retval =0 ; +struct moxa_board_conf *brd = moxa_boards; +unsigned int i;printk (KERN_INFO "MOXA Intellio family driver version %s\n" ,MOXA_VERSION );
@@ -1051,10 +1051,7 @@ static int __init moxa_init(void) }/* Find the boards defined from module args. */ -#ifdef MODULE - { -struct moxa_board_conf *brd = moxa_boards; -unsigned int i; +for (i =0 ; i <MAX_BOARDS ; i++) {if (!baseaddr[i])break ;
@@ -1087,8 +1084,6 @@ static int __init moxa_init(void) isabrds++; } } - } -#endif #ifdef CONFIG_PCI retval =pci_register_driver (&moxa_pci_driver);
Signature · 1 line
1.7.0.1
PATCH 16/36 ip2: remove #ifdef MODULE from ip2main.c
In reply to Greg KHFrom: Rakib Mullick <[email protected]>
On the kernel command line we can pass "module parameters". So #ifdef MODULE is obsolute now. Remove it completely. When CONFIG_PCI=n and building ip2main.c then we are hit by the following warning. So move *pdev into #ifdef CONFIG_PCI.
drivers/char/ip2/ip2main.c: In function `ip2_loadmain':drivers/char/ip2/ip2main.c:542: warning: unused variable `pdev'
--- drivers/char/ip2/ip2main.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-)
drivers/char/ip2/ip2main.c +5 -6
@@ -263,7 +263,7 @@ static int tracewrap;/* Macros */ /**********/ -#if defined(MODULE ) && defined(IP2DEBUG_OPEN ) +#ifdef IP2DEBUG_OPEN #define DBG_CNT (s) printk(KERN_DEBUG "(%s): [%x] ttyc=%d, modc=%x -> %s\n", \ tty->name,(pCh->flags), \ tty->count,/*GET_USE_COUNT(module)*/0,s)
@@ -487,7 +487,6 @@ static const struct firmware *ip2_request_firmware(void)return fw; } -#ifndef MODULE /****************************************************************************** * ip2_setup: * str: kernel command line string
@@ -531,7 +530,6 @@ static int __init ip2_setup(char *str)return 1 ; }__setup ("ip2=" , ip2_setup); -#endif /* !MODULE */ static int __init ip2_loadmain (void ) {
@@ -539,7 +537,6 @@ static int __init ip2_loadmain(void)int err =0 ;i2eBordStrPtr pB =NULL ;int rc =-1 ; -struct pci_dev *pdev =NULL ;const struct firmware *fw =NULL ;if (poll_only) {
@@ -612,6 +609,7 @@ static int __init ip2_loadmain(void)case PCI :#ifdef CONFIG_PCI { +struct pci_dev *pdev =NULL ;u32 addr;int status;
@@ -626,7 +624,7 @@ static int __init ip2_loadmain(void)if (pci_enable_device (pdev)) {dev_err (&pdev->dev,"can't enable device\n" ); -break ; + goto out; } ip2config.type[i] =PCI ; ip2config.pci_dev[i] =pci_dev_get (pdev);
@@ -638,6 +636,8 @@ static int __init ip2_loadmain(void)dev_err (&pdev->dev,"I/O address error\n" ); ip2config.irq[i] = pdev->irq; +out: +pci_dev_put (pdev); }#else printk(KERN_ERR "IP2: PCI card specified but PCI "
@@ -656,7 +656,6 @@ static int __init ip2_loadmain(void)break ; }/* switch */ }/* for */ -pci_dev_put (pdev);for (i =0 ; i <IP2_MAX_BOARDS ; ++i) {if (ip2config.addr[i]) {
Signature · 1 line
1.7.0.1
PATCH 17/36 ip2: Add module parameter.
In reply to Greg KHFrom: Rakib Mullick <[email protected]>
Stephen Rothwell found the following warning (x86_64 allmodconfig):
drivers/char/ip2/ip2main.c:511: warning: 'ip2_setup' defined but not used
This patch adds module parameter to fix the above warning.
--- drivers/char/ip2/ip2main.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
drivers/char/ip2/ip2main.c +13 -0
@@ -208,6 +208,7 @@ static int DumpFifoBuffer( char __user *, int);static void ip2_init_board (int ,const struct firmware *);static unsigned short find_eisa_board (int ); +static int ip2_setup (char *str);/***************/ /* Static Data */
@@ -285,7 +286,10 @@ MODULE_AUTHOR("Doug McNash");MODULE_DESCRIPTION ("Computone IntelliPort Plus Driver" );MODULE_LICENSE ("GPL" ); +#define MAX_CMD_STR 50 +static int poll_only; +static char cmd[MAX_CMD_STR ];static int Eisa_irq;static int Eisa_slot;
@@ -309,6 +313,8 @@ module_param_array(io, int, NULL, 0);MODULE_PARM_DESC (io,"I/O ports for IntelliPort Cards" );module_param (poll_only, bool,0 );MODULE_PARM_DESC (poll_only,"Do not use card interrupts" ); +module_param_string (ip2, cmd,MAX_CMD_STR ,0 ); +MODULE_PARM_DESC (ip2,"Contains module parameter passed with 'ip2='" );/* for sysfs class support */ static struct class *ip2_class;
@@ -538,12 +544,19 @@ static int __init ip2_loadmain(void)i2eBordStrPtr pB =NULL ;int rc =-1 ;const struct firmware *fw =NULL ; +char *str; + + str = cmd;if (poll_only) {/* Hard lock the interrupts to zero */ irq[0 ] = irq[1 ] = irq[2 ] = irq[3 ] = poll_only =0 ; } +/* Check module parameter with 'ip2=' has been passed or not */ +if (!poll_only && (!strncmp (str,"ip2=" ,4 ))) +ip2_setup (str); +ip2trace (ITRC_NO_PORT ,ITRC_INIT ,ITRC_ENTER ,0 );/* process command line arguments to modprobe or
Signature · 1 line
1.7.0.1
PATCH 18/36 tty: declare MODULE_FIRMWARE in various drivers
In reply to Greg KHFrom: Ben Hutchings <[email protected]>
--- drivers/char/cyclades.c | 1 + drivers/char/ip2/ip2main.c | 2 ++ drivers/char/isicom.c | 5 +++++ drivers/char/moxa.c | 3 +++ drivers/serial/icom.c | 4 +++- drivers/usb/serial/keyspan_pda.c | 7 +++++++ 6 files changed, 21 insertions(+), 1 deletions(-)
drivers/char/cyclades.c +1 -0
@@ -4195,3 +4195,4 @@ module_exit(cy_cleanup_module);MODULE_LICENSE ("GPL" );MODULE_VERSION (CY_VERSION );MODULE_ALIAS_CHARDEV_MAJOR (CYCLADES_MAJOR ); +MODULE_FIRMWARE ("cyzfirm.bin" );
drivers/char/ip2/ip2main.c +2 -0
@@ -3209,3 +3209,5 @@ static struct pci_device_id ip2main_pci_tbl[] __devinitdata = { };MODULE_DEVICE_TABLE (pci, ip2main_pci_tbl); + +MODULE_FIRMWARE ("intelliport2.bin" );
drivers/char/isicom.c +5 -0
@@ -1720,3 +1720,8 @@ module_exit(isicom_exit);MODULE_AUTHOR ("MultiTech" );MODULE_DESCRIPTION ("Driver for the ISI series of cards by MultiTech" );MODULE_LICENSE ("GPL" ); +MODULE_FIRMWARE ("isi608.bin" ); +MODULE_FIRMWARE ("isi608em.bin" ); +MODULE_FIRMWARE ("isi616em.bin" ); +MODULE_FIRMWARE ("isi4608.bin" ); +MODULE_FIRMWARE ("isi4616.bin" );
drivers/char/moxa.c +3 -0
@@ -172,6 +172,9 @@ static unsigned int numports[MAX_BOARDS];MODULE_AUTHOR ("William Chen" );MODULE_DESCRIPTION ("MOXA Intellio Family Multiport Board Device Driver" );MODULE_LICENSE ("GPL" ); +MODULE_FIRMWARE ("c218tunx.cod" ); +MODULE_FIRMWARE ("cp204unx.cod" ); +MODULE_FIRMWARE ("c320tunx.cod" );module_param_array (type, uint,NULL ,0 );MODULE_PARM_DESC (type,"card type: C218=2, C320=4" );
drivers/serial/icom.c +3 -1
@@ -1654,4 +1654,6 @@ MODULE_DESCRIPTION("IBM iSeries Serial IOA driver");MODULE_SUPPORTED_DEVICE ("IBM iSeries 2745, 2771, 2772, 2742, 2793 and 2805 Communications adapters" );MODULE_LICENSE ("GPL" ); - +MODULE_FIRMWARE ("icom_call_setup.bin" ); +MODULE_FIRMWARE ("icom_res_dce.bin" ); +MODULE_FIRMWARE ("icom_asc.bin" );
drivers/usb/serial/keyspan_pda.c +7 -0
@@ -789,6 +789,13 @@ static int keyspan_pda_fake_startup(struct usb_serial *serial)return 1 ; } +#ifdef KEYSPAN +MODULE_FIRMWARE ("keyspan_pda/keyspan_pda.fw" ); +#endif +#ifdef XIRCOM +MODULE_FIRMWARE ("keyspan_pda/xircom_pgs.fw" ); +#endif +static int keyspan_pda_startup (struct usb_serial *serial) {
Signature · 1 line
1.7.0.1
PATCH 19/36 Char: synclink, remove unnecessary checks
In reply to Greg KHFrom: Jiri Slaby <[email protected]>
Stanse found a potential null dereference in mgsl_put_char and mgsl_write. There is a check for tty being NULL, but it is dereferenced earlier.
Actually, tty cannot be NULL in .write and .put_char, so remove the tests.
--- drivers/char/synclink.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/char/synclink.c +2 -2
@@ -2031,7 +2031,7 @@ static int mgsl_put_char(struct tty_struct *tty, unsigned char ch)if (mgsl_paranoia_check (info, tty->name,"mgsl_put_char" ))return 0 ; -if (!tty || !info->xmit_buf) +if (!info->xmit_buf)return 0 ;spin_lock_irqsave (&info->irq_spinlock, flags);
@@ -2121,7 +2121,7 @@ static int mgsl_write(struct tty_struct * tty,if (mgsl_paranoia_check (info, tty->name,"mgsl_write" )) goto cleanup; -if (!tty || !info->xmit_buf) +if (!info->xmit_buf) goto cleanup; if ( info->params.mode == MGSL_MODE_HDLC ||
Signature · 1 line
1.7.0.1
PATCH 20/36 serial: bfin_5xx: remove useless gpio handling with hard flow control
In reply to Greg KHFrom: Sonic Zhang <[email protected]>
For UARTs that have dedicated hardware flow control support, there will be no gpios to request/free as they are part of the normal peripheral pins.
--- drivers/serial/bfin_5xx.c | 16 +--------------- 1 files changed, 1 insertions(+), 15 deletions(-)
drivers/serial/bfin_5xx.c +1 -15
@@ -746,15 +746,6 @@ static int bfin_serial_startup(struct uart_port *port) Status interrupt.\n"); } -if (uart->cts_pin >=0 ) { -gpio_request (uart->cts_pin,DRIVER_NAME ); -gpio_direction_output (uart->cts_pin,1 ); - } -if (uart->rts_pin >=0 ) { -gpio_request (uart->rts_pin,DRIVER_NAME ); -gpio_direction_output (uart->rts_pin,0 ); - } -/* CTS RTS PINs are negative assertive. */ UART_PUT_MCR (uart,ACTS );UART_SET_IER (uart,EDSSI );
@@ -801,10 +792,6 @@ static void bfin_serial_shutdown(struct uart_port *port)gpio_free (uart->rts_pin);#endif #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS -if (uart->cts_pin >=0 ) -gpio_free (uart->cts_pin); -if (uart->rts_pin >=0 ) -gpio_free (uart->rts_pin);if (UART_GET_IER (uart) &&EDSSI )free_irq (uart->status_irq, uart);#endif
@@ -1409,8 +1396,7 @@ static int bfin_serial_remove(struct platform_device *dev)continue ;uart_remove_one_port (&bfin_serial_reg, &bfin_serial_ports[i].port); bfin_serial_ports[i].port.dev =NULL ; -#if defined(CONFIG_SERIAL_BFIN_CTSRTS ) || \ - defined(CONFIG_SERIAL_BFIN_HARD_CTSRTS ) +#if defined(CONFIG_SERIAL_BFIN_CTSRTS )gpio_free (bfin_serial_ports[i].cts_pin);gpio_free (bfin_serial_ports[i].rts_pin);#endif
Signature · 1 line
1.7.0.1
PATCH 21/36 serial: bfin_5xx: need to disable DMA TX interrupt too
In reply to Greg KHFrom: Graf Yang <[email protected]>
If we don't disable the DMA TX channel, an inopportune timeout will trigger the interrupt handler and may cause a dead lock with the spin_lock.
--- drivers/serial/bfin_5xx.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/serial/bfin_5xx.c +2 -0
@@ -488,6 +488,7 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart) {int x_pos, pos; +dma_disable_irq (uart->tx_dma_channel);dma_disable_irq (uart->rx_dma_channel);spin_lock_bh (&uart->port.lock);
@@ -521,6 +522,7 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart) }spin_unlock_bh (&uart->port.lock); +dma_enable_irq (uart->tx_dma_channel);dma_enable_irq (uart->rx_dma_channel);mod_timer (&(uart->rx_dma_timer), jiffies +DMA_RX_FLUSH_JIFFIES );
Signature · 1 line
1.7.0.1
PATCH 22/36 serial: bfin_5xx: kgdboc should accept gdb break only when it is active
In reply to Greg KHFrom: Sonic Zhang <[email protected]>
If we always check for gdb breaks even when it isn't active, we get false positives on normal code and the system panics.
URL: http://blackfin.uclinux.org/gf/tracker/5277
--- drivers/serial/bfin_5xx.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/serial/bfin_5xx.c +2 -1
@@ -237,7 +237,8 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart) #if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \ defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE) - if (kgdb_connected && kgdboc_port_line == uart->port.line) + if (kgdb_connected && kgdboc_port_line == uart->port.line + && kgdboc_break_enabled) if (ch == 0x3) {/* Ctrl + C */ kgdb_breakpoint(); return;
Signature · 1 line
1.7.0.1
PATCH 23/36 serial: bfin_5xx: pull in linux/io.h for ioremap prototypes
In reply to Greg KHFrom: Mike Frysinger <[email protected]>
--- drivers/serial/bfin_5xx.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/serial/bfin_5xx.c +1 -0
@@ -14,6 +14,7 @@#include <linux/module.h> #include <linux/ioport.h> +#include <linux/io.h> #include <linux/init.h> #include <linux/console.h> #include <linux/sysrq.h>
Signature · 1 line
1.7.0.1
PATCH 24/36 serial: bcm63xx_uart: don't use kfree() on non kmalloced area.
In reply to Greg KHFrom: Maxime Bizon <[email protected]>
--- drivers/serial/bcm63xx_uart.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/serial/bcm63xx_uart.c +1 -1
@@ -830,7 +830,7 @@ static int __devinit bcm_uart_probe(struct platform_device *pdev) ret =uart_add_one_port (&bcm_uart_driver, port);if (ret) { -kfree (port); + ports[pdev->id].membase =0 ;return ret; }platform_set_drvdata (pdev, port);
Signature · 1 line
1.7.0.1
PATCH 25/36 serial: bcm63xx_uart: allow more than one uart to be registered.
In reply to Greg KHFrom: Maxime Bizon <[email protected]>
The bcm6358 CPU has two uarts, make it possible to use the second one.
--- drivers/serial/bcm63xx_uart.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/serial/bcm63xx_uart.c +3 -2
@@ -35,7 +35,7 @@#include <bcm63xx_regs.h> #include <bcm63xx_io.h> -#define BCM63XX_NR_UARTS 1 +#define BCM63XX_NR_UARTS 2static struct uart_port ports[BCM63XX_NR_UARTS ];
@@ -784,7 +784,7 @@ static struct uart_driver bcm_uart_driver = { .dev_name = "ttyS", .major = TTY_MAJOR, .minor = 64, - .nr = 1, + .nr = BCM63XX_NR_UARTS, .cons = BCM63XX_CONSOLE, };
@@ -826,6 +826,7 @@ static int __devinit bcm_uart_probe(struct platform_device *pdev) port->dev = &pdev->dev; port->fifosize =16 ; port->uartclk =clk_get_rate (clk) /2 ; + port->line = pdev->id;clk_put (clk); ret =uart_add_one_port (&bcm_uart_driver, port);
Signature · 1 line
1.7.0.1
PATCH 26/36 sdio_uart: Use kfifo instead of the messy circ stuff
In reply to Greg KHFrom: Alan Cox <[email protected]>
Revised patch to use the new kfifo API. This replaces the one that was dropped from -next due to collisions with the kfifo API changes.
--- drivers/mmc/card/sdio_uart.c | 93 +++++++++++++---------------------------- 1 files changed, 30 insertions(+), 63 deletions(-)
drivers/mmc/card/sdio_uart.c +30 -63
@@ -37,6 +37,7 @@#include <linux/gfp.h> #include <linux/tty.h> #include <linux/tty_flip.h> +#include <linux/kfifo.h> #include <linux/mmc/core.h> #include <linux/mmc/card.h>
@@ -47,19 +48,9 @@#define UART_NR 8/* Number of UARTs this driver can handle */ -#define UART_XMIT_SIZE PAGE_SIZE +#define FIFO_SIZE PAGE_SIZE#define WAKEUP_CHARS 256 -#define circ_empty (circ) ((circ)->head == (circ)->tail) -#define circ_clear (circ) ((circ)->head = (circ)->tail = 0) - -#define circ_chars_pending (circ) \ - (CIRC_CNT((circ)->head, (circ)->tail, UART_XMIT_SIZE)) - -#define circ_chars_free (circ) \ - (CIRC_SPACE((circ)->head, (circ)->tail, UART_XMIT_SIZE)) - -struct uart_icount {__u32 cts;__u32 dsr;
@@ -82,7 +73,7 @@ struct sdio_uart_port {struct mutex func_lock;struct task_struct *in_sdio_uart_irq;unsigned int regs_offset; -struct circ_buf xmit; +struct kfifo xmit_fifo;spinlock_t write_lock;struct uart_icount icount;unsigned int uartclk;
@@ -105,6 +96,8 @@ static int sdio_uart_add_port(struct sdio_uart_port *port)kref_init (&port->kref);mutex_init (&port->func_lock);spin_lock_init (&port->write_lock); +if (kfifo_alloc (&port->xmit_fifo,FIFO_SIZE ,GFP_KERNEL )) +return -ENOMEM ;spin_lock (&sdio_uart_table_lock);for (index =0 ; index <UART_NR ; index++) {
@@ -140,6 +133,7 @@ static void sdio_uart_port_destroy(struct kref *kref) {struct sdio_uart_port *port = container_of(kref, struct sdio_uart_port, kref); +kfifo_free (&port->xmit_fifo);kfree (port); }
@@ -456,9 +450,11 @@ static void sdio_uart_receive_chars(struct sdio_uart_port *port,static void sdio_uart_transmit_chars (struct sdio_uart_port *port) { -struct circ_buf *xmit = &port->xmit; +struct kfifo *xmit = &port->xmit_fifo;int count;struct tty_struct *tty; +u8 iobuf[16 ]; +int len;if (port->x_char) {sdio_out (port,UART_TX , port->x_char);
@@ -469,27 +465,25 @@ static void sdio_uart_transmit_chars(struct sdio_uart_port *port) tty =tty_port_tty_get (&port->port); -if (tty ==NULL ||circ_empty (xmit) || +if (tty ==NULL || !kfifo_len (xmit) || tty->stopped || tty->hw_stopped) {sdio_uart_stop_tx (port);tty_kref_put (tty);return ; } - count =16 ; -do { -sdio_out (port,UART_TX , xmit->buf[xmit->tail]); - xmit->tail = (xmit->tail +1 ) & (UART_XMIT_SIZE -1 ); + len =kfifo_out_locked (xmit, iobuf,16 , &port->write_lock); +for (count =0 ; count < len; count++) { +sdio_out (port,UART_TX , iobuf[count]); port->icount.tx++; -if (circ_empty (xmit)) -break ; - }while (--count >0 ); + } -if (circ_chars_pending (xmit) <WAKEUP_CHARS ) + len =kfifo_len (xmit); +if (len <WAKEUP_CHARS ) {tty_wakeup (tty); - -if (circ_empty (xmit)) -sdio_uart_stop_tx (port); +if (len ==0 ) +sdio_uart_stop_tx (port); + }tty_kref_put (tty); }
@@ -632,7 +626,6 @@ static int sdio_uart_activate(struct tty_port *tport, struct tty_struct *tty) {struct sdio_uart_port *port = container_of(tport, struct sdio_uart_port, port); -unsigned long page;int ret;/*
@@ -641,22 +634,17 @@ static int sdio_uart_activate(struct tty_port *tport, struct tty_struct *tty)*/ set_bit (TTY_IO_ERROR , &tty->flags); -/* Initialise and allocate the transmit buffer. */ - page =__get_free_page (GFP_KERNEL ); -if (!page) -return -ENOMEM ; - port->xmit.buf = (unsigned char *)page; -circ_clear (&port->xmit); +kfifo_reset (&port->xmit_fifo); ret =sdio_uart_claim_func (port);if (ret) - goto err1; +return ret; ret =sdio_enable_func (port->func);if (ret) - goto err2; + goto err1; ret =sdio_claim_irq (port->func, sdio_uart_irq);if (ret) - goto err3; + goto err2;/* * Clear the FIFO buffers and disable them.
@@ -700,12 +688,10 @@ static int sdio_uart_activate(struct tty_port *tport, struct tty_struct *tty)sdio_uart_release_func (port);return 0 ; -err3: -sdio_disable_func (port->func); err2: -sdio_uart_release_func (port); +sdio_disable_func (port->func); err1: -free_page ((unsigned long )port->xmit.buf); +sdio_uart_release_func (port);return ret; }
@@ -727,7 +713,7 @@ static void sdio_uart_shutdown(struct tty_port *tport) ret =sdio_uart_claim_func (port);if (ret) - goto skip; +return ;sdio_uart_stop_rx (port);
@@ -749,10 +735,6 @@ static void sdio_uart_shutdown(struct tty_port *tport)sdio_disable_func (port->func);sdio_uart_release_func (port); - -skip: -/* Free the transmit buffer page. */ -free_page ((unsigned long )port->xmit.buf); }/**
@@ -822,27 +804,12 @@ static int sdio_uart_write(struct tty_struct *tty, const unsigned char *buf, int count) {struct sdio_uart_port *port = tty->driver_data; -struct circ_buf *circ = &port->xmit; -int c, ret =0 ; +int ret;if (!port->func)return -ENODEV ; -spin_lock (&port->write_lock); -while (1 ) { - c =CIRC_SPACE_TO_END (circ->head, circ->tail,UART_XMIT_SIZE ); -if (count < c) - c = count; -if (c <=0 ) -break ; -memcpy (circ->buf + circ->head, buf, c); - circ->head = (circ->head + c) & (UART_XMIT_SIZE -1 ); - buf += c; - count -= c; - ret += c; - } -spin_unlock (&port->write_lock); - + ret =kfifo_in_locked (&port->xmit_fifo, buf, count, &port->write_lock);if (!(port->ier &UART_IER_THRI )) {int err =sdio_uart_claim_func (port);if (!err) {
@@ -859,13 +826,13 @@ static int sdio_uart_write(struct tty_struct *tty, const unsigned char *buf,static int sdio_uart_write_room (struct tty_struct *tty) {struct sdio_uart_port *port = tty->driver_data; -return port ?circ_chars_free (&port->xmit) :0 ; +return FIFO_SIZE -kfifo_len (&port->xmit_fifo); }static int sdio_uart_chars_in_buffer (struct tty_struct *tty) {struct sdio_uart_port *port = tty->driver_data; -return port ?circ_chars_pending (&port->xmit) :0 ; +return kfifo_len (&port->xmit_fifo); }static void sdio_uart_send_xchar (struct tty_struct *tty,char ch)
Signature · 1 line
1.7.0.1
PATCH 27/36 nozomi: Add tty_port usage
In reply to Greg KHFrom: Alan Cox <[email protected]>
The Nozomi tty handling is very broken on the open/close side (See
http://bugzilla.kernel.org/show_bug.cgi?id=13024 for one example). In particular it marks the tty as closed on the first close() not on the last.
Most of the logic is pretty solid except for the open/close path so switch to the tty_port helpers and let them do all the heavy lifting. This is also fixes all the POSIX behaviour violations in the open/close paths.
Begin by adding the tty port usage
--- drivers/char/nozomi.c | 115 +++++++++++++++++++++++++++++-------------------- 1 files changed, 68 insertions(+), 47 deletions(-)
drivers/char/nozomi.c +68 -47
@@ -371,6 +371,8 @@ struct port {struct mutex tty_sem;wait_queue_head_t tty_wait;struct async_icount tty_icount; + +struct nozomi *dc; };/* Private data one for each card in the system */
@@ -414,6 +416,8 @@ MODULE_DEVICE_TABLE(pci, nozomi_pci_tbl);static struct nozomi *ndevs[NOZOMI_MAX_CARDS ];static struct tty_driver *ntty_driver; +static const struct tty_port_operations noz_tty_port_ops; +/* * find card by tty_index */
@@ -1473,9 +1477,11 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev,for (i =0 ; i <MAX_PORT ; i++) {struct device *tty_dev; - -mutex_init (&dc->port[i].tty_sem); -tty_port_init (&dc->port[i].port); +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, &pdev->dev);
@@ -1600,67 +1606,74 @@ static void set_dtr(const struct tty_struct *tty, int dtr)* ---------------------------------------------------------------------------- */ -/* Called when the userspace process opens the tty, /dev/noz*. */ -static int ntty_open (struct tty_struct *tty,struct file *file) +static int ntty_install (struct tty_driver *driver,struct tty_struct *tty) {struct port *port =get_port_by_tty (tty);struct nozomi *dc =get_dc_by_tty (tty); -unsigned long flags; - +int ret;if (!port || !dc || dc->state !=NOZOMI_STATE_READY )return -ENODEV ; - -if (mutex_lock_interruptible (&port->tty_sem)) -return -ERESTARTSYS ; - - port->port.count++; - dc->open_ttys++; - -/* Enable interrupt downlink for channel */ -if (port->port.count ==1 ) { - tty->driver_data = port; -tty_port_tty_set (&port->port, tty); -DBG1 ("open: %d" , port->token_dl); -spin_lock_irqsave (&dc->spin_mutex, flags); - dc->last_ier = dc->last_ier | port->token_dl; -writew (dc->last_ier, dc->reg_ier); -spin_unlock_irqrestore (&dc->spin_mutex, flags); + ret =tty_init_termios (tty); +if (ret ==0 ) { +tty_driver_kref_get (driver); + driver->ttys[tty->index] = tty; } -mutex_unlock (&port->tty_sem); -return 0 ; +return ret; } -/* Called when the userspace process close the tty, /dev/noz*. Also -called immediately if ntty_open fails in which case tty->driver_data -will be NULL an we exit by the first return */ +static void ntty_cleanup (struct tty_struct *tty) +{ + tty->driver_data =NULL ; +} -static void ntty_close (struct tty_struct *tty,struct file *file) +static int ntty_activate (struct tty_port *tport,struct tty_struct *tty) { -struct nozomi *dc =get_dc_by_tty (tty); -struct port *nport = tty->driver_data; -struct tty_port *port = &nport->port; + struct port *port = container_of(tport, struct port, port); +struct nozomi *dc = port->dc;unsigned long flags; -if (!dc || !nport) -return ; +DBG1 ("open: %d" , port->token_dl); +spin_lock_irqsave (&dc->spin_mutex, flags); + dc->last_ier = dc->last_ier | port->token_dl; +writew (dc->last_ier, dc->reg_ier); + dc->open_ttys++; +spin_unlock_irqrestore (&dc->spin_mutex, flags); +printk ("noz: activated %d: %p\n" , tty->index, tport); +return 0 ; +} -/* Users cannot interrupt a close */ -mutex_lock (&nport->tty_sem); +static int ntty_open (struct tty_struct *tty,struct file *filp) +{ +struct port *port =get_port_by_tty (tty); +return tty_port_open (&port->port, tty, filp); +} -WARN_ON (!port->count); +static void ntty_shutdown (struct tty_port *tport) +{ + struct port *port = container_of(tport, struct port, port); +struct nozomi *dc = port->dc; +unsigned long flags; +DBG1 ("close: %d" , port->token_dl); +spin_lock_irqsave (&dc->spin_mutex, flags); + dc->last_ier &= ~(port->token_dl); +writew (dc->last_ier, dc->reg_ier); dc->open_ttys--; - port->count--; +spin_unlock_irqrestore (&dc->spin_mutex, flags); +printk ("noz: shutdown %p\n" , tport); +} -if (port->count ==0 ) { -DBG1 ("close: %d" , nport->token_dl); -tty_port_tty_set (port,NULL ); -spin_lock_irqsave (&dc->spin_mutex, flags); - dc->last_ier &= ~(nport->token_dl); -writew (dc->last_ier, dc->reg_ier); -spin_unlock_irqrestore (&dc->spin_mutex, flags); - } -mutex_unlock (&nport->tty_sem); +static void ntty_close (struct tty_struct *tty,struct file *filp) +{ +struct port *port = tty->driver_data; +if (port) +tty_port_close (&port->port, tty, filp); +} + +static void ntty_hangup (struct tty_struct *tty) +{ +struct port *port = tty->driver_data; +tty_port_hangup (&port->port); }/*
@@ -1906,10 +1919,16 @@ exit_in_buffer:return rval; } +static const struct tty_port_operations noz_tty_port_ops = { + .activate = ntty_activate, + .shutdown = ntty_shutdown, +}; +static const struct tty_operations tty_ops = { .ioctl = ntty_ioctl, .open = ntty_open, .close = ntty_close, + .hangup = ntty_hangup, .write = ntty_write, .write_room = ntty_write_room, .unthrottle = ntty_unthrottle,
@@ -1917,6 +1936,8 @@ static const struct tty_operations tty_ops = { .chars_in_buffer = ntty_chars_in_buffer, .tiocmget = ntty_tiocmget, .tiocmset = ntty_tiocmset, + .install = ntty_install, + .cleanup = ntty_cleanup, };/* Module initialization */
Signature · 1 line
1.7.0.1
PATCH 28/36 nozomi: Fix mutex handling
In reply to Greg KHFrom: Alan Cox <[email protected]>
The original author didn't realise the kernel lock was a drop while sleep lock so did clever (and wrong) things to work around the non need to avoid deadlocks. Remove the cleverness and the comment (as we don't hold the BKL now anyway in those paths)
--- drivers/char/nozomi.c | 34 ++++++++++++---------------------- 1 files changed, 12 insertions(+), 22 deletions(-)
drivers/char/nozomi.c +12 -22
@@ -1693,15 +1693,7 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer,if (!dc || !port)return -ENODEV ; -if (unlikely (!mutex_trylock (&port->tty_sem))) { -/* -* must test lock as tty layer wraps calls -* to this function with BKL -*/ -dev_err (&dc->pdev->dev,"Would have deadlocked - " -"return EAGAIN\n" ); -return -EAGAIN ; - } +mutex_lock (&port->tty_sem);if (unlikely (!port->port.count)) {DBG1 (" " );
@@ -1741,25 +1733,23 @@ exit:* This method is called by the upper tty layer. * #according to sources N_TTY.c it expects a value >= 0 and * does not check for negative values. +* +* If the port is unplugged report lots of room and let the bits +* dribble away so we don't block anything. */ static int ntty_write_room (struct tty_struct *tty) {struct port *port = tty->driver_data; -int room =0 ; +int room =4096 ;const struct nozomi *dc =get_dc_by_tty (tty); -if (!dc || !port) -return 0 ; -if (!mutex_trylock (&port->tty_sem)) -return 0 ; - -if (!port->port.count) - goto exit; - - room = port->fifo_ul.size -kfifo_len (&port->fifo_ul); - -exit: -mutex_unlock (&port->tty_sem); +if (dc) { +mutex_lock (&port->tty_sem); +if (port->port.count) + room = port->fifo_ul.size - +kfifo_len (&port->fifo_ul); +mutex_unlock (&port->tty_sem); + }return room; }
Signature · 1 line
1.7.0.1
PATCH 29/36 nozomi: Tidy up the PCI table
In reply to Greg KHFrom: Alan Cox <[email protected]>
--- drivers/char/nozomi.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
drivers/char/nozomi.c +1 -5
@@ -136,10 +136,6 @@ static int debug;#define RECEIVE_BUF_MAX 4 -/* Define all types of vendors and devices to support */ -#define VENDOR1 0x1931/* Vendor Option */ -#define DEVICE1 0x000c/* HSDPA card */ -#define R_IIR 0x0000/* Interrupt Identity Register */ #define R_FCR 0x0000/* Flow Control Register */ #define R_IER 0x0004/* Interrupt Enable Register */
@@ -407,7 +403,7 @@ struct buffer {/* Global variables */ static const struct pci_device_id nozomi_pci_tbl[]__devinitconst = { - {PCI_DEVICE (VENDOR1 ,DEVICE1 )}, + {PCI_DEVICE (0x1931 ,0x000c )},/* Nozomi HSDPA */ {}, };
Signature · 1 line
1.7.0.1
PATCH 30/36 serial: timberdale: Remove dependancies
In reply to Greg KHFrom: Alan Cox <[email protected]>
MFD_TIMBERDALE doesn't appear to be defined anywhere. However the code in question can build happily without platform specifics so remove the check
--- drivers/serial/Kconfig | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/serial/Kconfig +0 -1
@@ -1449,7 +1449,6 @@ config SERIAL_BFIN_SPORT3_UART config SERIAL_TIMBERDALE tristate "Support for timberdale UART" - depends on MFD_TIMBERDALE select SERIAL_CORE ---help--- Add support for UART controller on timberdale.
Signature · 1 line
1.7.0.1
PATCH 31/36 tty: Fix the ldisc hangup race
In reply to Greg KHFrom: Alan Cox <[email protected]>
This was noticed by Matthias Urlichs and he proposed a fix. This patch does the fixing a different way to avoid introducing several new race conditions into the code.
The problem case is TTY_DRIVER_RESET_TERMIOS = 0. In that case while we abort the ldisc change, the hangup processing has not cleaned up and restarted the ldisc either.
We can't restart the ldisc stuff in the set_ldisc as we don't know what the hangup did and may touch stuff we shouldn't as we are no longer supposed to influence the tty at that point in case it has been re-opened before we get rescheduled.
Instead do it the simple way. Always re-init the ldisc on the hangup, but use TTY_DRIVER_RESET_TERMIOS to indicate that we should force N_TTY.
--- drivers/char/tty_ldisc.c | 50 +++++++++++++++++++++++++++------------------ 1 files changed, 30 insertions(+), 20 deletions(-)
drivers/char/tty_ldisc.c +30 -20
@@ -706,12 +706,13 @@ static void tty_reset_termios(struct tty_struct *tty)/** * tty_ldisc_reinit - reinitialise the tty ldisc * @tty: tty to reinit +* @ldisc: line discipline to reinitialize * -* Switch the tty back to N_TTY line discipline and leave the -* ldisc state closed +* Switch the tty to a line discipline and leave the ldisc +* state closed */ -static void tty_ldisc_reinit (struct tty_struct *tty) +static void tty_ldisc_reinit (struct tty_struct *tty,int ldisc) {struct tty_ldisc *ld;
@@ -721,10 +722,10 @@ static void tty_ldisc_reinit(struct tty_struct *tty)/* * Switch the line discipline back */ - ld =tty_ldisc_get (N_TTY ); + ld =tty_ldisc_get (ldisc);BUG_ON (IS_ERR (ld));tty_ldisc_assign (tty, ld); -tty_set_termios_ldisc (tty,N_TTY ); +tty_set_termios_ldisc (tty, ldisc); }/**
@@ -745,6 +746,8 @@ static void tty_ldisc_reinit(struct tty_struct *tty)void tty_ldisc_hangup (struct tty_struct *tty) {struct tty_ldisc *ld; +int reset = tty->driver->flags &TTY_DRIVER_RESET_TERMIOS ; +int err =0 ;/* * FIXME! What are the locking issues here? This may me overdoing
@@ -772,25 +775,32 @@ void tty_ldisc_hangup(struct tty_struct *tty)wake_up_interruptible_poll (&tty->read_wait,POLLIN );/* * Shutdown the current line discipline, and reset it to -* N_TTY. +* N_TTY if need be. +* +* Avoid racing set_ldisc or tty_ldisc_release */ -if (tty->driver->flags &TTY_DRIVER_RESET_TERMIOS ) { -/* Avoid racing set_ldisc or tty_ldisc_release */ -mutex_lock (&tty->ldisc_mutex); -tty_ldisc_halt (tty); -if (tty->ldisc) {/* Not yet closed */ -/* Switch back to N_TTY */ -tty_ldisc_reinit (tty); -/* At this point we have a closed ldisc and we want to -reopen it. We could defer this to the next open but -it means auditing a lot of other paths so this is -a FIXME */ +mutex_lock (&tty->ldisc_mutex); +tty_ldisc_halt (tty); +/* At this point we have a closed ldisc and we want to +reopen it. We could defer this to the next open but +it means auditing a lot of other paths so this is +a FIXME */ +if (tty->ldisc) {/* Not yet closed */ +if (reset ==0 ) { +tty_ldisc_reinit (tty, tty->termios->c_line); + err =tty_ldisc_open (tty, tty->ldisc); + } +/* If the re-open fails or we reset then go to N_TTY. The +N_TTY open cannot fail */ +if (reset || err) { +tty_ldisc_reinit (tty,N_TTY );WARN_ON (tty_ldisc_open (tty, tty->ldisc)); -tty_ldisc_enable (tty); } -mutex_unlock (&tty->ldisc_mutex); -tty_reset_termios (tty); +tty_ldisc_enable (tty); } +mutex_unlock (&tty->ldisc_mutex); +if (reset) +tty_reset_termios (tty); }/**
Signature · 1 line
1.7.0.1
PATCH 32/36 tty: Fix up char drivers request_room usage
In reply to Greg KHFrom: Alan Cox <[email protected]>
We can't change them all but quite a few misuse it.
--- drivers/char/nozomi.c | 2 -- drivers/char/serial167.c | 3 +-- drivers/char/specialix.c | 2 -- drivers/serial/icom.c | 1 - drivers/serial/ioc3_serial.c | 3 +-- 5 files changed, 2 insertions(+), 9 deletions(-)
drivers/char/nozomi.c +0 -2
@@ -853,8 +853,6 @@ static int receive_data(enum port_type index, struct nozomi *dc) goto put; } -tty_buffer_request_room (tty, size); -while (size >0 ) {read_mem32 ((u32 *) buf, addr + offset,RECEIVE_BUF_MAX );
drivers/char/serial167.c +1 -2
@@ -658,8 +658,7 @@ static irqreturn_t cd2401_rx_interrupt(int irq, void *dev_id) info->mon.char_max = char_count; info->mon.char_last = char_count;#endif - len =tty_buffer_request_room (tty, char_count); -while (len--) { +while (char_count--) { data = base_addr[CyRDR];tty_insert_flip_char (tty, data,TTY_NORMAL );#ifdef CYCLOM_16Y_HACK
drivers/char/specialix.c +0 -2
@@ -646,8 +646,6 @@ static void sx_receive(struct specialix_board *bp)dprintk (SX_DEBUG_RX ,"port: %p: count: %d\n" , port, count); port->hits[count >8 ?9 : count]++; -tty_buffer_request_room (tty, count); -while (count--)tty_insert_flip_char (tty,sx_in (bp, CD186x_RDR),TTY_NORMAL );tty_flip_buffer_push (tty);
drivers/serial/icom.c +0 -1
@@ -751,7 +751,6 @@ static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port)trace (icom_port,"FID_STATUS" , status); count =cpu_to_le16 (icom_port->statStg->rcv[rcv_buff].leLength); - count =tty_buffer_request_room (tty, count);trace (icom_port,"RCV_COUNT" , count);trace (icom_port,"REAL_COUNT" , count);
drivers/serial/ioc3_serial.c +1 -2
@@ -1411,8 +1411,7 @@ static int receive_chars(struct uart_port *the_port) read_count =do_read (the_port, ch,MAX_CHARS );if (read_count >0 ) { flip =1 ; - read_room =tty_buffer_request_room (tty, read_count); -tty_insert_flip_string (tty, ch, read_room); + read_room =tty_insert_flip_string (tty, ch, read_count); the_port->icount.rx += read_count; }spin_unlock_irqrestore (&the_port->lock, pflags);
Signature · 1 line
1.7.0.1
PATCH 33/36 tty: Keep the default buffering to sub-page units
In reply to Greg KHFrom: Alan Cox <[email protected]>
We allocate during interrupts so while our buffering is normally diced up small anyway on some hardware at speed we can pressure the VM excessively for page pairs. We don't really need big buffers to be linear so don't try so hard.
In order to make this work well we will tidy up excess callers to request_room, which cannot itself enforce this break up.
--- drivers/char/tty_buffer.c | 6 ++++-- include/linux/tty.h | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/char/tty_buffer.c +4 -2
@@ -247,7 +247,8 @@ int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, {int copied =0 ; do { - int space = tty_buffer_request_room(tty, size - copied); + int goal = min(size - copied, TTY_BUFFER_PAGE); + int space = tty_buffer_request_room(tty, goal); struct tty_buffer *tb = tty->buf.tail; /* If there is no space then tb may be NULL */ if (unlikely(space == 0))
@@ -283,7 +284,8 @@ int tty_insert_flip_string_flags(struct tty_struct *tty, {int copied =0 ; do { - int space = tty_buffer_request_room(tty, size - copied); + int goal = min(size - copied, TTY_BUFFER_PAGE); + int space = tty_buffer_request_room(tty, goal); struct tty_buffer *tb = tty->buf.tail; /* If there is no space then tb may be NULL */ if (unlikely(space == 0))
include/linux/tty.h +10 -0
@@ -68,6 +68,16 @@ struct tty_buffer {unsigned long data[0 ]; }; +/* +* We default to dicing tty buffer allocations to this many characters +* in order to avoid multiple page allocations. We assume tty_buffer itself +* is under 256 bytes. See tty_buffer_find for the allocation logic this +* must match +*/ + +#define TTY_BUFFER_PAGE ((PAGE_SIZE - 256) / 2) + +struct tty_bufhead {struct delayed_work work;spinlock_t lock;
Signature · 1 line
1.7.0.1
PATCH 34/36 tty: Add a new VT mode which is like VT_PROCESS but doesn't require a VT_RELDISP ioctl call
In reply to Greg KHFrom: Ari Entlich <[email protected]>
This new VT mode (VT_PROCESS_AUTO) does everything that VT_PROCESS does except that it doesn't wait for a VT_RELDISP ioctl before switching away from a VT with that mode.
If the X server eventually uses this new mode, debugging and crash recovery should become easier. This is because even when currently in the VT of a frozen X server it would still be possible to switch out by doing SysRq-r and then CTRL-<number of a text vt>, sshing in and doing chvt <number of a text vt>, or any other method of VT switching. The general concensus on #xorg-devel seems to be that it should be safe to use this with X now that we have KMS.
This also moves the VT_ACKACQ define to a more appropriate place, for clarity's sake.
--- drivers/char/vt_ioctl.c | 39 ++++++++++++++++++++------------------- include/linux/vt.h | 3 ++- 2 files changed, 22 insertions(+), 20 deletions(-)
drivers/char/vt_ioctl.c +20 -19
@@ -888,7 +888,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ret = -EFAULT ; goto out; } -if (tmp.mode !=VT_AUTO && tmp.mode !=VT_PROCESS ) { +if (tmp.mode !=VT_AUTO && tmp.mode !=VT_PROCESS && tmp.mode !=VT_PROCESS_AUTO ) { ret = -EINVAL ; goto out; }
@@ -1622,7 +1622,7 @@ static void complete_change_console(struct vc_data *vc)* telling it that it has acquired. Also check if it has died and * clean up (similar to logic employed in change_console()) */ -if (vc->vt_mode.mode ==VT_PROCESS ) { +if (vc->vt_mode.mode ==VT_PROCESS || vc->vt_mode.mode ==VT_PROCESS_AUTO ) {/* * Send the signal as privileged - kill_pid() will * tell us if the process has gone or something else
@@ -1682,7 +1682,7 @@ void change_console(struct vc_data *new_vc)* vt to auto control. */ vc = vc_cons[fg_console].d; -if (vc->vt_mode.mode ==VT_PROCESS ) { +if (vc->vt_mode.mode ==VT_PROCESS || vc->vt_mode.mode ==VT_PROCESS_AUTO ) {/* * Send the signal as privileged - kill_pid() will * tell us if the process has gone or something else
@@ -1693,27 +1693,28 @@ void change_console(struct vc_data *new_vc)*/ vc->vt_newvt = new_vc->vc_num;if (kill_pid (vc->vt_pid, vc->vt_mode.relsig,1 ) ==0 ) { +if (vc->vt_mode.mode ==VT_PROCESS ) +/* +* It worked. Mark the vt to switch to and +* return. The process needs to send us a +* VT_RELDISP ioctl to complete the switch. +*/ +return ; + }else {/* -* It worked. Mark the vt to switch to and -* return. The process needs to send us a -* VT_RELDISP ioctl to complete the switch. +* The controlling process has died, so we revert back to +* normal operation. In this case, we'll also change back +* to KD_TEXT mode. I'm not sure if this is strictly correct +* but it saves the agony when the X server dies and the screen +* remains blanked due to KD_GRAPHICS! It would be nice to do +* this outside of VT_PROCESS but there is no single process +* to account for and tracking tty count may be undesirable. */ -return ; +reset_vc (vc); }/* -* The controlling process has died, so we revert back to -* normal operation. In this case, we'll also change back -* to KD_TEXT mode. I'm not sure if this is strictly correct -* but it saves the agony when the X server dies and the screen -* remains blanked due to KD_GRAPHICS! It would be nice to do -* this outside of VT_PROCESS but there is no single process -* to account for and tracking tty count may be undesirable. -*/ -reset_vc (vc); - -/* -* Fall through to normal (VT_AUTO) handling of the switch... +* Fall through to normal (VT_AUTO and VT_PROCESS_AUTO) handling of the switch... */ }
include/linux/vt.h +2 -1
@@ -27,7 +27,7 @@ struct vt_mode {#define VT_SETMODE 0x5602/* set mode of active vt */ #define VT_AUTO 0x00/* auto vt switching */ #define VT_PROCESS 0x01/* process controls switching */ -#define VT_ACKACQ 0x02/* acknowledge switch */ +#define VT_PROCESS_AUTO 0x02/* process is notified of switching */ struct vt_stat {unsigned short v_active;/* active vt */
@@ -38,6 +38,7 @@ struct vt_stat {#define VT_SENDSIG 0x5604/* signal to send to bitmask of vts */ #define VT_RELDISP 0x5605/* release display */ +#define VT_ACKACQ 0x02/* acknowledge switch */ #define VT_ACTIVATE 0x5606/* make vt active */ #define VT_WAITACTIVE 0x5607/* wait for vt active */
Signature · 1 line
1.7.0.1
PATCH 35/36 jsm: removing the uart structure and filename on error
In reply to Greg KHFrom: Breno Leitao <[email protected]>
If jsm fails to load, then remove the uart stuff, otherwise, the things (as files), will be there forever (even when the module is unloaded). If you try to reload the module, the following message appears:
kobject_add_internal failed for ttyn1 with -EEXIST, don't try to register things with the same name in the same directory.
This patch remove the uart things when the driver fails.
--- drivers/serial/jsm/jsm_driver.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/serial/jsm/jsm_driver.c +1 -0
@@ -179,6 +179,7 @@ static int __devinit jsm_probe_one(struct pci_dev *pdev, const struct pci_devicereturn 0 ; out_free_irq: +jsm_remove_uart_port (brd);free_irq (brd->irq, brd); out_iounmap:iounmap (brd->re_map_membase);
Signature · 1 line
1.7.0.1
PATCH 36/36 jsm: fixing error if the driver fails to load
In reply to Greg KHFrom: Breno Leitao <[email protected]>
Currently if the driver fails to register on port, the kernel crashes with the following stack:
cpu 0x1: Vector: 300 (Data Access) at [c0000000e0303090]
pc: c00000000039aa74: .__mutex_lock_slowpath+0x44/0x10c
lr: c00000000039aa58: .__mutex_lock_slowpath+0x28/0x10c[c0000000e03033c0] c00000000026b074 .uart_remove_one_port+0xbc/0x16c [c0000000e0303460] d0000000000e0554 .jsm_remove_uart_port+0x8c/0x10c [jsm] [c0000000e03034f0] d0000000000dc034 .jsm_remove_one+0x34/0x108 [jsm] [c0000000e0303590] c0000000001f4aa0 .pci_device_remove+0x48/0x74
...
This patch just fixes the code flow to abort the load when an error is detected.
--- drivers/serial/jsm/jsm_tty.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/serial/jsm/jsm_tty.c +6 -3
@@ -432,7 +432,7 @@ int __devinit jsm_tty_init(struct jsm_board *brd)int jsm_uart_port_init (struct jsm_board *brd) { -int i; +int i, rc;unsigned int line;struct jsm_channel *ch;
@@ -467,8 +467,11 @@ int jsm_uart_port_init(struct jsm_board *brd) }else set_bit (line, linemap); brd->channels[i]->uart_port.line = line; -if (uart_add_one_port (&jsm_uart_driver, &brd->channels[i]->uart_port)) -printk (KERN_INFO "jsm: add device failed\n" ); + rc =uart_add_one_port (&jsm_uart_driver, &brd->channels[i]->uart_port); +if (rc){ +printk (KERN_INFO "jsm: Port %d failed. Aborting...\n" , i); +return rc; + }else printk (KERN_INFO "jsm: Port %d added\n" , i); }
Signature · 1 line
1.7.0.1