This patch series introduces the idea of a tty_port - a common structure
that eventually all ports will have. Some drivers are migrated to make partial
use of the tty port commonality and helpers but only a little.
On the USB side the USB tty API is changed to fix a whole pile of races where
tty->port->tty cannot be assumed to be tty (because of hangup/reopen). The
USB drivers all get a spring clean and the entire pile have been dragged into
CodingStyle near compliance (some cases where the checkpatch whines that
make no sense have been ignored).
Greg: At the end of this series there shouldn't be any white space issues
although some earlier patches introduce them and later ones take them away
Aim... load... fire...
---
Alan Cox (70):
tty-usb-mos7720: Coding style
whiteheat: remove unused variable
mos7840: remove loads of bogus assignments to status
omninet: Use string flip functions
tty-usb-omninet: Coding style
tty-usb-option: Coding style
tty-usb-oti6858: Coding style
tty-usb-safe-serial: Coding style
tty-usb-ti-usb: Coding style
tty-usb-spcp8x5: Minor coding style
tty-usb-sierra: Coding style - minor
tty-usb-pl2303: Coding style
mct_u232: Use flip buffer functions
tty-usb-mct-u232: Coding style
kobil_sct: Fix ioctls
tty-usb-kobil-sct: Coding style
keyspan_pda: Use string flip functions
tty-usb-kl5kusb105: Coding style
tty-usb-keyspan-pda: Coding style
keyspan: Use string flip functions when possible
tty-usb-keyspan: Coding style
tty-usb-iuu-phoenix: Clean up to coding style
tty-usb-ir-usb: Clean up to coding style
tty-usb-ipw: Coding style
ipaq: Coding style
io_ti: Minor coding style
usb-serial: Coding style
io_edgeport: Fix various bogus returns to the tty layer
tty-usb-io_edgeport: Coding style
tty-usb-visor: Coding style
tty-usb-hp4x: Fix overlong line
...From: Alan Cox <alan@redhat.com> Move the line disciplines towards a conventional ->ops arrangement. For the moment the actual 'tty_ldisc' struct in the tty is kept as part of the tty struct but this can then be changed if it turns out that when it all settles down we want to refcount ldiscs separately to the tty. Pull the ldisc code out of /proc and put it with our ldisc code. Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/bluetooth/hci_ldisc.c | 6 - drivers/char/cyclades.c | 3 drivers/char/epca.c | 4 drivers/char/ip2/i2lib.c | 4 drivers/char/ip2/ip2main.c | 7 - drivers/char/n_hdlc.c | 6 - drivers/char/n_r3964.c | 2 drivers/char/n_tty.c | 2 drivers/char/pcmcia/synclink_cs.c | 4 drivers/char/pty.c | 10 + drivers/char/selection.c | 3 drivers/char/synclink.c | 4 drivers/char/synclink_gt.c | 4 drivers/char/synclinkmp.c | 4 drivers/char/tty_io.c | 336 +++++++++++++++++++++++------------- drivers/char/tty_ioctl.c | 16 +- drivers/input/serio/serport.c | 2 drivers/isdn/capi/capi.c | 4 drivers/isdn/gigaset/ser-gigaset.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/pc300_tty.c | 4 drivers/net/wan/x25_asy.c | 2 drivers/net/wireless/strip.c | 2 fs/proc/proc_tty.c | 48 ----- include/linux/tty.h | 9 - include/linux/tty_ldisc.h | 7 + net/bluetooth/rfcomm/tty.c | 13 - net/irda/ircomm/ircomm_tty.c | 14 +- 33 files changed, 287 insertions(+), 247 deletions(-) diff ...
Sorry for such a trivial comment, but the leading 'k' above looks like a ty= po. Louis --=20 Dr Louis Rilling Kerlabs Skype: louis.rilling Batiment Germanium Phone: (+33|0) 6 80 89 08 23 80 avenue des Buttes de Coesmes http://www.kerlabs.com/ 35700 Rennes
From: Adrian Bunk <bunk@kernel.org> This patch removes ancient VCS tags (either protected by #ifdef SCCS_LABELS or commented out). Signed-off-by: Adrian Bunk <bunk@kernel.org> --- drivers/char/rio/cirrus.h | 3 --- drivers/char/rio/cmdblk.h | 6 ------ drivers/char/rio/cmdpkt.h | 6 ------ drivers/char/rio/daemon.h | 6 ------ drivers/char/rio/errors.h | 6 ------ drivers/char/rio/func.h | 6 ------ drivers/char/rio/map.h | 4 ---- drivers/char/rio/param.h | 5 ----- drivers/char/rio/parmmap.h | 7 ------- drivers/char/rio/pci.h | 4 ---- drivers/char/rio/protsts.h | 7 ------- drivers/char/rio/rio_linux.c | 5 ----- drivers/char/rio/rioboard.h | 6 ------ drivers/char/rio/riocmd.c | 3 --- drivers/char/rio/rioctrl.c | 4 ---- drivers/char/rio/riodrvr.h | 4 ---- drivers/char/rio/rioinfo.h | 4 ---- drivers/char/rio/rioinit.c | 3 --- drivers/char/rio/riointr.c | 4 ---- drivers/char/rio/rioparam.c | 4 ---- drivers/char/rio/rioroute.c | 3 --- drivers/char/rio/riospace.h | 4 ---- drivers/char/rio/riotable.c | 3 --- drivers/char/rio/riotty.c | 4 ---- drivers/char/rio/route.h | 6 ------ drivers/char/rio/unixrup.h | 4 ---- 26 files changed, 0 insertions(+), 121 deletions(-) diff --git a/drivers/char/rio/cirrus.h b/drivers/char/rio/cirrus.h index a03a538..5ab5167 100644 --- a/drivers/char/rio/cirrus.h +++ b/drivers/char/rio/cirrus.h @@ -35,9 +35,6 @@ ***************************************************************************/ #ifndef _cirrus_h -#ifndef lint -/* static char* _cirrus_h_sccs = "@(#)cirrus.h 1.16"; */ -#endif #define _cirrus_h 1 /* Bit fields for particular registers shared with driver */ diff --git a/drivers/char/rio/cmdblk.h b/drivers/char/rio/cmdblk.h index c46b2fd..9ed4f86 100644 --- a/drivers/char/rio/cmdblk.h +++ b/drivers/char/rio/cmdblk.h @@ -33,12 +33,6 @@ #ifndef ...
From: Adrian Bunk <bunk@kernel.org>
This patch removes CVS keywords that weren't updated for a long time in
comments, printk's and MODULE_DESCRIPTION's (no printk's or
MODULE_DESCRIPTION's are completely removed).
While doing this I also found and fixed a missing \n in a printk
in m32r_sio.c
Signed-off-by: Adrian Bunk <bunk@kernel.org>
---
drivers/serial/21285.c | 6 ++----
drivers/serial/8250.c | 6 ++----
drivers/serial/8250.h | 2 --
drivers/serial/8250_pci.c | 2 --
drivers/serial/8250_pnp.c | 2 --
drivers/serial/Kconfig | 2 --
drivers/serial/Makefile | 2 --
drivers/serial/amba-pl010.c | 6 ++----
drivers/serial/amba-pl011.c | 2 --
drivers/serial/clps711x.c | 7 ++-----
drivers/serial/cpm_uart/cpm_uart_core.c | 4 ++--
drivers/serial/m32r_sio.c | 4 ++--
drivers/serial/mpsc.c | 4 ++--
drivers/serial/pnx8xxx_uart.c | 2 +-
drivers/serial/sa1100.c | 7 ++-----
drivers/serial/sunsu.c | 2 +-
16 files changed, 18 insertions(+), 42 deletions(-)
diff --git a/drivers/serial/21285.c b/drivers/serial/21285.c
index 0276471..1b6b83c 100644
--- a/drivers/serial/21285.c
+++ b/drivers/serial/21285.c
@@ -4,8 +4,6 @@
* Driver for the serial port on the 21285 StrongArm-110 core logic chip.
*
* Based on drivers/char/serial.c
- *
- * $Id: 21285.c,v 1.37 2002/07/28 10:03:27 rmk Exp $
*/
#include <linux/module.h>
#include <linux/tty.h>
@@ -494,7 +492,7 @@ static int __init serial21285_init(void)
{
int ret;
- printk(KERN_INFO "Serial: 21285 driver $Revision: 1.37 $\n");
+ printk(KERN_INFO "Serial: 21285 driver\n");
serial21285_setup_ports();
@@ -515,5 +513,5 @@ module_init(serial21285_init);
module_exit(serial21285_exit);
...From: Alan Cox <alan@redhat.com>
Every tty driver has its own concept of a port structure and because they all
differ we cannot extract commonality. Begin fixing this by creating a structure
drivers can elect to use so that over time we can push fields into this and
create commonality and then introduce common methods.
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/char/tty_io.c | 34 ++++++++++++++++++++++++++++++++++
include/linux/tty.h | 30 +++++++++++++++++++++++++++++-
2 files changed, 63 insertions(+), 1 deletions(-)
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index ab1dd0a..1856096 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -2088,6 +2088,40 @@ ssize_t redirected_tty_write(struct file *file, const char __user *buf,
return tty_write(file, buf, count, ppos);
}
+void tty_port_init(struct tty_port *port)
+{
+ memset(port, 0, sizeof(*port));
+ init_waitqueue_head(&port->open_wait);
+ init_waitqueue_head(&port->close_wait);
+ mutex_init(&port->mutex);
+}
+EXPORT_SYMBOL(tty_port_init);
+
+int tty_port_alloc_xmit_buf(struct tty_port *port)
+{
+ /* We may sleep in get_zeroed_page() */
+ mutex_lock(&port->mutex);
+ if (port->xmit_buf == NULL)
+ port->xmit_buf = (unsigned char *)get_zeroed_page(GFP_KERNEL);
+ mutex_unlock(&port->mutex);
+ if (port->xmit_buf == NULL)
+ return -ENOMEM;
+ return 0;
+}
+EXPORT_SYMBOL(tty_port_alloc_xmit_buf);
+
+void tty_port_free_xmit_buf(struct tty_port *port)
+{
+ mutex_lock(&port->mutex);
+ if (port->xmit_buf != NULL) {
+ free_page((unsigned long)port->xmit_buf);
+ port->xmit_buf = NULL;
+ }
+ mutex_unlock(&port->mutex);
+}
+EXPORT_SYMBOL(tty_port_free_xmit_buf);
+
+
static char ptychar[] = "pqrstuvwxyzabcde";
/**
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 013711e..d7c695b 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -166,6 +166,29 @@ struct tty_bufhead {
struct device;
struct signal_struct;
+
+/*
+ * ...From: Alan Cox <alan@redhat.com>
Coding style clean up and white space tidy
Signed-off-by: Alan Cox <alan@redhat.com>
---
include/linux/tty.h | 165 ++++++++++++++++++++++++++-------------------------
1 files changed, 85 insertions(+), 80 deletions(-)
diff --git a/include/linux/tty.h b/include/linux/tty.h
index d7c695b..46008e8 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -71,7 +71,8 @@ struct tty_bufhead {
struct tty_buffer *head; /* Queue head */
struct tty_buffer *tail; /* Active buffer */
struct tty_buffer *free; /* Free queue head */
- int memory_used; /* Buffer space used excluding free queue */
+ int memory_used; /* Buffer space used excluding
+ free queue */
};
/*
* When a break, frame error, or parity error happens, these codes are
@@ -101,68 +102,68 @@ struct tty_bufhead {
#define LNEXT_CHAR(tty) ((tty)->termios->c_cc[VLNEXT])
#define EOL2_CHAR(tty) ((tty)->termios->c_cc[VEOL2])
-#define _I_FLAG(tty,f) ((tty)->termios->c_iflag & (f))
-#define _O_FLAG(tty,f) ((tty)->termios->c_oflag & (f))
-#define _C_FLAG(tty,f) ((tty)->termios->c_cflag & (f))
-#define _L_FLAG(tty,f) ((tty)->termios->c_lflag & (f))
-
-#define I_IGNBRK(tty) _I_FLAG((tty),IGNBRK)
-#define I_BRKINT(tty) _I_FLAG((tty),BRKINT)
-#define I_IGNPAR(tty) _I_FLAG((tty),IGNPAR)
-#define I_PARMRK(tty) _I_FLAG((tty),PARMRK)
-#define I_INPCK(tty) _I_FLAG((tty),INPCK)
-#define I_ISTRIP(tty) _I_FLAG((tty),ISTRIP)
-#define I_INLCR(tty) _I_FLAG((tty),INLCR)
-#define I_IGNCR(tty) _I_FLAG((tty),IGNCR)
-#define I_ICRNL(tty) _I_FLAG((tty),ICRNL)
-#define I_IUCLC(tty) _I_FLAG((tty),IUCLC)
-#define I_IXON(tty) _I_FLAG((tty),IXON)
-#define I_IXANY(tty) _I_FLAG((tty),IXANY)
-#define I_IXOFF(tty) _I_FLAG((tty),IXOFF)
-#define I_IMAXBEL(tty) _I_FLAG((tty),IMAXBEL)
-#define I_IUTF8(tty) _I_FLAG((tty),IUTF8)
-
-#define O_OPOST(tty) _O_FLAG((tty),OPOST)
-#define O_OLCUC(tty) _O_FLAG((tty),OLCUC)
-#define O_ONLCR(tty) _O_FLAG((tty),ONLCR)
-#define ...From: Alan Cox <alan@redhat.com>
Switch the EPCA driver to include and begin using a tty_port structure
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/char/epca.c | 106 ++++++++++++++++++++++++++-------------------------
drivers/char/epca.h | 7 ---
2 files changed, 54 insertions(+), 59 deletions(-)
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index aa8e19f..ac9995f 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -432,7 +432,7 @@ static void pc_close(struct tty_struct *tty, struct file *filp)
spin_unlock_irqrestore(&epca_lock, flags);
return;
}
- if (ch->count-- > 1) {
+ if (ch->port.count-- > 1) {
/* Begin channel is open more than once */
/*
* Return without doing anything. Someone might still
@@ -442,19 +442,19 @@ static void pc_close(struct tty_struct *tty, struct file *filp)
return;
}
/* Port open only once go ahead with shutdown & reset */
- BUG_ON(ch->count < 0);
+ BUG_ON(ch->port.count < 0);
/*
* Let the rest of the driver know the channel is being closed.
* This becomes important if an open is attempted before close
* is finished.
*/
- ch->asyncflags |= ASYNC_CLOSING;
+ ch->port.flags |= ASYNC_CLOSING;
tty->closing = 1;
spin_unlock_irqrestore(&epca_lock, flags);
- if (ch->asyncflags & ASYNC_INITIALIZED) {
+ if (ch->port.flags & ASYNC_INITIALIZED) {
/* Setup an event to indicate when the
transmit buffer empties */
setup_empty_event(tty, ch);
@@ -469,17 +469,17 @@ static void pc_close(struct tty_struct *tty, struct file *filp)
spin_lock_irqsave(&epca_lock, flags);
tty->closing = 0;
ch->event = 0;
- ch->tty = NULL;
+ ch->port.tty = NULL;
spin_unlock_irqrestore(&epca_lock, flags);
- if (ch->blocked_open) {
+ if (ch->port.blocked_open) {
if (ch->close_delay)
...From: Alan Cox <alan@redhat.com>
Switch esp to use the new tty_port structures
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/char/esp.c | 272 +++++++++++++++++++++++-----------------------
include/linux/hayesesp.h | 9 --
2 files changed, 138 insertions(+), 143 deletions(-)
diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index 84840ba..2eaf09f 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -128,9 +128,9 @@ static struct tty_driver *esp_driver;
#if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT)
#define DBG_CNT(s) printk(KERN_DEBUG "(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \
- tty->name, info->flags, \
+ tty->name, info->port.flags, \
serial_driver.refcount, \
- info->count, tty->count, s)
+ info->port.count, tty->count, s)
#else
#define DBG_CNT(s)
#endif
@@ -172,13 +172,13 @@ static inline int serial_paranoia_check(struct esp_struct *info,
static inline unsigned int serial_in(struct esp_struct *info, int offset)
{
- return inb(info->port + offset);
+ return inb(info->io_port + offset);
}
static inline void serial_out(struct esp_struct *info, int offset,
unsigned char value)
{
- outb(value, info->port+offset);
+ outb(value, info->io_port+offset);
}
/*
@@ -273,7 +273,7 @@ static inline void release_pio_buffer(struct esp_pio_buffer *buf)
static inline void receive_chars_pio(struct esp_struct *info, int num_bytes)
{
- struct tty_struct *tty = info->tty;
+ struct tty_struct *tty = info->port.tty;
int i;
struct esp_pio_buffer *pio_buf;
struct esp_pio_buffer *err_buf;
@@ -295,7 +295,7 @@ static inline void receive_chars_pio(struct esp_struct *info, int num_bytes)
for (i = 0; i < num_bytes - 1; i += 2) {
*((unsigned short *)(pio_buf->data + i)) =
- inw(info->port + UART_ESI_RX);
+ inw(info->io_port + UART_ESI_RX);
err_buf->data[i] = serial_in(info, UART_ESI_RWS);
err_buf->data[i + 1] = (err_buf->data[i] >> 3) & status_mask;
...From: Alan Cox <alan@redhat.com>
Switch drivers using the old "generic serial" driver to use the tty_port
structures
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/char/generic_serial.c | 158 ++++++++++++++++++++--------------------
drivers/char/rio/rio_linux.c | 20 +++--
drivers/char/rio/riocmd.c | 10 +--
drivers/char/rio/riointr.c | 10 +--
drivers/char/rio/rioparam.c | 2 -
drivers/char/rio/riotty.c | 16 ++--
drivers/char/sx.c | 115 ++++++++++++++---------------
include/linux/generic_serial.h | 8 +-
8 files changed, 166 insertions(+), 173 deletions(-)
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c
index 252f73e..4bde737 100644
--- a/drivers/char/generic_serial.c
+++ b/drivers/char/generic_serial.c
@@ -60,7 +60,7 @@ int gs_put_char(struct tty_struct * tty, unsigned char ch)
if (!port) return 0;
- if (! (port->flags & ASYNC_INITIALIZED)) return 0;
+ if (! (port->port.flags & ASYNC_INITIALIZED)) return 0;
/* Take a lock on the serial tranmit buffer! */
mutex_lock(& port->port_write_mutex);
@@ -103,7 +103,7 @@ int gs_write(struct tty_struct * tty,
if (!port) return 0;
- if (! (port->flags & ASYNC_INITIALIZED))
+ if (! (port->port.flags & ASYNC_INITIALIZED))
return 0;
/* get exclusive "write" access to this port (problem 3) */
@@ -141,13 +141,13 @@ int gs_write(struct tty_struct * tty,
mutex_unlock(& port->port_write_mutex);
gs_dprintk (GS_DEBUG_WRITE, "write: interrupts are %s\n",
- (port->flags & GS_TX_INTEN)?"enabled": "disabled");
+ (port->port.flags & GS_TX_INTEN)?"enabled": "disabled");
if (port->xmit_cnt &&
!tty->stopped &&
!tty->hw_stopped &&
- !(port->flags & GS_TX_INTEN)) {
- port->flags |= GS_TX_INTEN;
+ !(port->port.flags & GS_TX_INTEN)) {
+ port->port.flags |= GS_TX_INTEN;
port->rd->enable_tx_interrupts (port);
}
func_exit ();
@@ -208,7 +208,7 @@ static ...From: Alan Cox <alan@redhat.com>
Switch riscom8 to use the new tty_port structure
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/char/riscom8.c | 145 ++++++++++++++++++++++--------------------------
drivers/char/riscom8.h | 8 ---
2 files changed, 68 insertions(+), 85 deletions(-)
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c
index f073c71..b0ba241 100644
--- a/drivers/char/riscom8.c
+++ b/drivers/char/riscom8.c
@@ -322,7 +322,7 @@ static struct riscom_port *rc_get_port(struct riscom_board const *bp,
channel = rc_in(bp, CD180_GICR) >> GICR_CHAN_OFF;
if (channel < CD180_NCH) {
port = &rc_port[board_No(bp) * RC_NPORT + channel];
- if (port->flags & ASYNC_INITIALIZED)
+ if (port->port.flags & ASYNC_INITIALIZED)
return port;
}
printk(KERN_ERR "rc%d: %s interrupt from invalid port %d\n",
@@ -341,7 +341,7 @@ static void rc_receive_exc(struct riscom_board const *bp)
if (port == NULL)
return;
- tty = port->tty;
+ tty = port->port.tty;
#ifdef RC_REPORT_OVERRUN
status = rc_in(bp, CD180_RCSR);
@@ -364,7 +364,7 @@ static void rc_receive_exc(struct riscom_board const *bp)
printk(KERN_INFO "rc%d: port %d: Handling break...\n",
board_No(bp), port_No(port));
flag = TTY_BREAK;
- if (port->flags & ASYNC_SAK)
+ if (port->port.flags & ASYNC_SAK)
do_SAK(tty);
} else if (status & RCSR_PE)
@@ -392,7 +392,7 @@ static void rc_receive(struct riscom_board const *bp)
if (port == NULL)
return;
- tty = port->tty;
+ tty = port->port.tty;
count = rc_in(bp, CD180_RDCR);
@@ -422,7 +422,7 @@ static void rc_transmit(struct riscom_board const *bp)
if (port == NULL)
return;
- tty = port->tty;
+ tty = port->port.tty;
if (port->IER & IER_TXEMPTY) {
/* FIFO drained */
@@ -467,7 +467,7 @@ static void rc_transmit(struct riscom_board const *bp)
count = CD180_NFIFO;
do {
- rc_out(bp, CD180_TDR, port->xmit_buf[port->xmit_tail++]);
+ rc_out(bp, CD180_TDR, ...From: Alan Cox <alan@redhat.com>
Chris Malley posted a patch removing a NULL check in the riscom8 driver.
Further analysis shows that even more of the tests are irrelevant so we
can delete lots of stuff
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/char/riscom8.c | 32 ++++++++------------------------
1 files changed, 8 insertions(+), 24 deletions(-)
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c
index b0ba241..3ca8957 100644
--- a/drivers/char/riscom8.c
+++ b/drivers/char/riscom8.c
@@ -638,9 +638,6 @@ static void rc_change_speed(struct riscom_board *bp, struct riscom_port *port)
unsigned char cor1 = 0, cor3 = 0;
unsigned char mcor1 = 0, mcor2 = 0;
- if (tty == NULL || tty->termios == NULL)
- return;
-
port->IER = 0;
port->COR2 = 0;
port->MSVR = MSVR_RTS;
@@ -794,8 +791,7 @@ static int rc_setup_port(struct riscom_board *bp, struct riscom_port *port)
spin_lock_irqsave(&riscom_lock, flags);
- if (port->port.tty)
- clear_bit(TTY_IO_ERROR, &port->port.tty->flags);
+ clear_bit(TTY_IO_ERROR, &port->port.tty->flags);
if (port->port.count == 1)
bp->count++;
port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
@@ -807,10 +803,9 @@ static int rc_setup_port(struct riscom_board *bp, struct riscom_port *port)
}
/* Must be called with interrupts disabled */
-static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port)
+static void rc_shutdown_port(struct tty_struct *tty,
+ struct riscom_board *bp, struct riscom_port *port)
{
- struct tty_struct *tty;
-
if (!(port->port.flags & ASYNC_INITIALIZED))
return;
@@ -830,10 +825,7 @@ static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port)
}
#endif
tty_port_free_xmit_buf(&port->port);
-
- tty = port->port.tty;
-
- if (tty == NULL || C_HUPCL(tty)) {
+ if (C_HUPCL(tty)) {
/* Drop DTR */
bp->DTR |= (1u << port_No(port));
rc_out(bp, RC_DTR, bp->DTR);
@@ -848,8 +840,7 @@ static void ...From: Alan Cox <alan@redhat.com>
Switch isicom to use a tty_port structure for some fields
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/char/isicom.c | 181 +++++++++++++++++++++----------------------------
1 files changed, 79 insertions(+), 102 deletions(-)
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 4f3cefa..20be56f 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -198,17 +198,12 @@ struct isi_board {
struct isi_port {
unsigned short magic;
- unsigned int flags;
- int count;
- int blocked_open;
+ struct tty_port port;
int close_delay;
u16 channel;
u16 status;
u16 closing_wait;
struct isi_board *card;
- struct tty_struct *tty;
- wait_queue_head_t close_wait;
- wait_queue_head_t open_wait;
unsigned char *xmit_buf;
int xmit_head;
int xmit_tail;
@@ -430,11 +425,11 @@ static void isicom_tx(unsigned long _data)
for (; count > 0; count--, port++) {
/* port not active or tx disabled to force flow control */
- if (!(port->flags & ASYNC_INITIALIZED) ||
+ if (!(port->port.flags & ASYNC_INITIALIZED) ||
!(port->status & ISI_TXOK))
continue;
- tty = port->tty;
+ tty = port->port.tty;
if (tty == NULL)
continue;
@@ -458,7 +453,7 @@ static void isicom_tx(unsigned long _data)
if (residue == YES) {
residue = NO;
if (cnt > 0) {
- wrd |= (port->xmit_buf[port->xmit_tail]
+ wrd |= (port->port.xmit_buf[port->xmit_tail]
<< 8);
port->xmit_tail = (port->xmit_tail + 1)
& (SERIAL_XMIT_SIZE - 1);
@@ -474,14 +469,14 @@ static void isicom_tx(unsigned long _data)
if (cnt <= 0)
break;
word_count = cnt >> 1;
- outsw(base, port->xmit_buf+port->xmit_tail, word_count);
+ outsw(base, port->port.xmit_buf+port->xmit_tail, word_count);
port->xmit_tail = (port->xmit_tail
+ (word_count << 1)) & (SERIAL_XMIT_SIZE - 1);
txcount -= (word_count << 1);
port->xmit_cnt -= (word_count << ...From: Alan Cox <alan@redhat.com>
Switch istallion to use the new tty_port structure
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/char/istallion.c | 116 +++++++++++++++++++++++----------------------
include/linux/istallion.h | 6 --
2 files changed, 59 insertions(+), 63 deletions(-)
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index 7c8b62f..6ef1c56 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -735,8 +735,8 @@ static void stli_cleanup_ports(struct stlibrd *brdp)
for (j = 0; j < STL_MAXPORTS; j++) {
portp = brdp->ports[j];
if (portp != NULL) {
- if (portp->tty != NULL)
- tty_hangup(portp->tty);
+ if (portp->port.tty != NULL)
+ tty_hangup(portp->port.tty);
kfree(portp);
}
}
@@ -811,9 +811,9 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
* The sleep here does not need interrupt protection since the wakeup
* for it is done with the same context.
*/
- if (portp->flags & ASYNC_CLOSING) {
- interruptible_sleep_on(&portp->close_wait);
- if (portp->flags & ASYNC_HUP_NOTIFY)
+ if (portp->port.flags & ASYNC_CLOSING) {
+ interruptible_sleep_on(&portp->port.close_wait);
+ if (portp->port.flags & ASYNC_HUP_NOTIFY)
return -EAGAIN;
return -ERESTARTSYS;
}
@@ -824,7 +824,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
* requires several commands to the board we will need to wait for any
* other open that is already initializing the port.
*/
- portp->tty = tty;
+ portp->port.tty = tty;
tty->driver_data = portp;
portp->refcount++;
@@ -833,10 +833,10 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
if (signal_pending(current))
return -ERESTARTSYS;
- if ((portp->flags & ASYNC_INITIALIZED) == 0) {
+ if ((portp->port.flags & ASYNC_INITIALIZED) == 0) {
set_bit(ST_INITIALIZING, &portp->state);
if ((rc = stli_initopen(brdp, portp)) >= 0) {
- portp->flags |= ...From: Alan Cox <alan@redhat.com>
Switch MOXA to use the new tty_port structure
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/char/moxa.c | 87 +++++++++++++++++++++++++--------------------------
1 files changed, 42 insertions(+), 45 deletions(-)
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index d57d3a6..bb9bcff 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -130,17 +130,14 @@ struct moxaq_str {
};
struct moxa_port {
+ struct tty_port port;
struct moxa_board_conf *board;
- struct tty_struct *tty;
void __iomem *tableAddr;
int type;
int close_delay;
- unsigned int count;
- int asyncflags;
int cflag;
unsigned long statusflags;
- wait_queue_head_t open_wait;
u8 DCDState;
u8 lineCtrl;
@@ -348,10 +345,10 @@ static int moxa_ioctl(struct tty_struct *tty, struct file *file,
if (status & 4)
tmp.dcd = 1;
- if (!p->tty || !p->tty->termios)
+ if (!p->port.tty || !p->port.tty->termios)
tmp.cflag = p->cflag;
else
- tmp.cflag = p->tty->termios->c_cflag;
+ tmp.cflag = p->port.tty->termios->c_cflag;
copy:
if (copy_to_user(argm, &tmp, sizeof(tmp))) {
mutex_unlock(&moxa_openlock);
@@ -828,7 +825,7 @@ static int moxa_init_board(struct moxa_board_conf *brd, struct device *dev)
p->type = PORT_16550A;
p->close_delay = 5 * HZ / 10;
p->cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL;
- init_waitqueue_head(&p->open_wait);
+ tty_port_init(&p->port);
}
switch (brd->boardType) {
@@ -884,12 +881,12 @@ static void moxa_board_deinit(struct moxa_board_conf *brd)
/* pci hot-un-plug support */
for (a = 0; a < brd->numPorts; a++)
- if (brd->ports[a].asyncflags & ASYNC_INITIALIZED)
- tty_hangup(brd->ports[a].tty);
+ if (brd->ports[a].port.flags & ASYNC_INITIALIZED)
+ tty_hangup(brd->ports[a].port.tty);
while (1) {
opened = 0;
for (a = 0; a < brd->numPorts; a++)
- if (brd->ports[a].asyncflags & ASYNC_INITIALIZED)
+ if ...From: Alan Cox <alan@redhat.com>
Switch mxser to use the new tty_port structure
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/char/mxser.c | 257 +++++++++++++++++++++++++-------------------------
1 files changed, 126 insertions(+), 131 deletions(-)
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index 4b81a85..e83ccee 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -222,8 +222,8 @@ struct mxser_mon_ext {
struct mxser_board;
struct mxser_port {
+ struct tty_port port;
struct mxser_board *board;
- struct tty_struct *tty;
unsigned long ioaddr;
unsigned long opmode_ioaddr;
@@ -234,7 +234,6 @@ struct mxser_port {
int rx_low_water;
int baud_base; /* max. speed */
int type; /* UART type */
- int flags; /* defined in tty.h */
int x_char; /* xon/xoff character */
int IER; /* Interrupt Enable Register */
@@ -249,15 +248,12 @@ struct mxser_port {
unsigned char err_shadow;
unsigned long event;
- int count; /* # of fd on device */
- int blocked_open; /* # of blocked opens */
struct async_icount icount; /* kernel counters for 4 input interrupts */
int timeout;
int read_status_mask;
int ignore_status_mask;
int xmit_fifo_size;
- unsigned char *xmit_buf;
int xmit_head;
int xmit_tail;
int xmit_cnt;
@@ -267,7 +263,6 @@ struct mxser_port {
struct mxser_mon mon_data;
spinlock_t slock;
- wait_queue_head_t open_wait;
wait_queue_head_t delta_msr_wait;
};
@@ -575,7 +570,7 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp,
*/
if ((filp->f_flags & O_NONBLOCK) ||
test_bit(TTY_IO_ERROR, &tty->flags)) {
- port->flags |= ASYNC_NORMAL_ACTIVE;
+ port->port.flags |= ASYNC_NORMAL_ACTIVE;
return 0;
}
@@ -585,32 +580,32 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp,
/*
* Block waiting for the carrier detect and the line to become
* free (i.e., not in use by the callout). While we are ...From: Alan Cox <alan@redhat.com>
Switch the rocketport to use the new tty_port structure
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/char/rocket.c | 116 +++++++++++++++++++++++----------------------
drivers/char/rocket_int.h | 9 +--
2 files changed, 61 insertions(+), 64 deletions(-)
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index 743dc80..ab04adb 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -434,15 +434,15 @@ static void rp_do_transmit(struct r_port *info)
#endif
if (!info)
return;
- if (!info->tty) {
+ if (!info->port.tty) {
printk(KERN_WARNING "rp: WARNING %s called with "
- "info->tty==NULL\n", __func__);
+ "info->port.tty==NULL\n", __func__);
clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]);
return;
}
spin_lock_irqsave(&info->slock, flags);
- tty = info->tty;
+ tty = info->port.tty;
info->xmit_fifo_room = TXFIFO_SIZE - sGetTxCnt(cp);
/* Loop sending data to FIFO until done or FIFO full */
@@ -502,13 +502,13 @@ static void rp_handle_port(struct r_port *info)
"info->flags & NOT_INIT\n");
return;
}
- if (!info->tty) {
+ if (!info->port.tty) {
printk(KERN_WARNING "rp: WARNING: rp_handle_port called with "
- "info->tty==NULL\n");
+ "info->port.tty==NULL\n");
return;
}
cp = &info->channel;
- tty = info->tty;
+ tty = info->port.tty;
IntMask = sGetChanIntID(cp) & info->intmask;
#ifdef ROCKET_DEBUG_INTR
@@ -530,7 +530,7 @@ static void rp_handle_port(struct r_port *info)
tty_hangup(tty);
}
info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0;
- wake_up_interruptible(&info->open_wait);
+ wake_up_interruptible(&info->port.open_wait);
}
#ifdef ROCKET_DEBUG_INTR
if (IntMask & DELTA_CTS) { /* CTS change */
@@ -650,7 +650,7 @@ static void init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev)
info->chan = chan;
info->closing_wait = 3000;
info->close_delay = ...From: Alan Cox <alan@redhat.com>
Switch the serial_core based drivers to use the new tty_port structure. We
can't quite use all of it yet because of the dynamically allocated extras
in the serial_core layer.
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/serial/8250.c | 2 +
drivers/serial/jsm/jsm_neo.c | 2 +
drivers/serial/jsm/jsm_tty.c | 8 ++--
drivers/serial/serial_core.c | 80 ++++++++++++++++++++++--------------------
include/linux/serial_core.h | 26 ++++++--------
5 files changed, 60 insertions(+), 58 deletions(-)
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index b040912..2dbfba8 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1287,7 +1287,7 @@ static void serial8250_enable_ms(struct uart_port *port)
static void
receive_chars(struct uart_8250_port *up, unsigned int *status)
{
- struct tty_struct *tty = up->port.info->tty;
+ struct tty_struct *tty = up->port.info->port.tty;
unsigned char ch, lsr = *status;
int max_count = 256;
char flag;
diff --git a/drivers/serial/jsm/jsm_neo.c b/drivers/serial/jsm/jsm_neo.c
index b2d6f5b..b7584ca 100644
--- a/drivers/serial/jsm/jsm_neo.c
+++ b/drivers/serial/jsm/jsm_neo.c
@@ -998,7 +998,7 @@ static void neo_param(struct jsm_channel *ch)
{ 50, B50 },
};
- cflag = C_BAUD(ch->uart_port.info->tty);
+ cflag = C_BAUD(ch->uart_port.info->port.tty);
baud = 9600;
for (i = 0; i < ARRAY_SIZE(baud_rates); i++) {
if (baud_rates[i].cflag == cflag) {
diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c
index 94ec663..a697914 100644
--- a/drivers/serial/jsm/jsm_tty.c
+++ b/drivers/serial/jsm/jsm_tty.c
@@ -145,7 +145,7 @@ static void jsm_tty_send_xchar(struct uart_port *port, char ch)
struct ktermios *termios;
spin_lock_irqsave(&port->lock, lock_flags);
- termios = port->info->tty->termios;
+ termios = port->info->port.tty->termios;
if (ch == termios->c_cc[VSTART])
...From: Alan Cox <alan@redhat.com>
Switch the stallion driver to use the tty_port structure
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/char/stallion.c | 160 +++++++++++++++++++++++-----------------------
include/linux/stallion.h | 6 --
2 files changed, 81 insertions(+), 85 deletions(-)
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index d17be10..0243efb 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -613,17 +613,17 @@ static void stl_cd_change(struct stlport *portp)
{
unsigned int oldsigs = portp->sigs;
- if (!portp->tty)
+ if (!portp->port.tty)
return;
portp->sigs = stl_getsignals(portp);
if ((portp->sigs & TIOCM_CD) && ((oldsigs & TIOCM_CD) == 0))
- wake_up_interruptible(&portp->open_wait);
+ wake_up_interruptible(&portp->port.open_wait);
if ((oldsigs & TIOCM_CD) && ((portp->sigs & TIOCM_CD) == 0))
- if (portp->flags & ASYNC_CHECK_CD)
- tty_hangup(portp->tty);
+ if (portp->port.flags & ASYNC_CHECK_CD)
+ tty_hangup(portp->port.tty);
}
/*
@@ -734,11 +734,11 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
* On the first open of the device setup the port hardware, and
* initialize the per port data structure.
*/
- portp->tty = tty;
+ portp->port.tty = tty;
tty->driver_data = portp;
- portp->refcount++;
+ portp->port.count++;
- if ((portp->flags & ASYNC_INITIALIZED) == 0) {
+ if ((portp->port.flags & ASYNC_INITIALIZED) == 0) {
if (!portp->tx.buf) {
portp->tx.buf = kmalloc(STL_TXBUFSIZE, GFP_KERNEL);
if (!portp->tx.buf)
@@ -752,7 +752,7 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
stl_enablerxtx(portp, 1, 1);
stl_startrxtx(portp, 1, 0);
clear_bit(TTY_IO_ERROR, &tty->flags);
- portp->flags |= ASYNC_INITIALIZED;
+ portp->port.flags |= ASYNC_INITIALIZED;
}
/*
@@ -761,9 +761,9 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
* The sleep here does not need interrupt ...From: Alan Cox <alan@redhat.com>
Switch the synclink ports to use the new tty_port structure
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/char/synclink.c | 195 ++++++++++++++++++++----------------------
drivers/char/synclink_gt.c | 201 +++++++++++++++++++++-----------------------
drivers/char/synclinkmp.c | 203 +++++++++++++++++++++-----------------------
3 files changed, 289 insertions(+), 310 deletions(-)
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 5e4b2e6..734098f 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -180,8 +180,7 @@ struct tx_holding_buffer {
struct mgsl_struct {
int magic;
- int flags;
- int count; /* count of opens */
+ struct tty_port port;
int line;
int hw_version;
unsigned short close_delay;
@@ -189,10 +188,8 @@ struct mgsl_struct {
struct mgsl_icount icount;
- struct tty_struct *tty;
int timeout;
int x_char; /* xon/xoff character */
- int blocked_open; /* # of blocked opens */
u16 read_status_mask;
u16 ignore_status_mask;
unsigned char *xmit_buf;
@@ -200,9 +197,6 @@ struct mgsl_struct {
int xmit_tail;
int xmit_cnt;
- wait_queue_head_t open_wait;
- wait_queue_head_t close_wait;
-
wait_queue_head_t status_event_wait_q;
wait_queue_head_t event_wait_q;
struct timer_list tx_timer; /* HDLC transmit timeout timer */
@@ -1134,7 +1128,7 @@ static void mgsl_bh_receive(struct mgsl_struct *info)
static void mgsl_bh_transmit(struct mgsl_struct *info)
{
- struct tty_struct *tty = info->tty;
+ struct tty_struct *tty = info->port.tty;
unsigned long flags;
if ( debug_level >= DEBUG_LEVEL_BH )
@@ -1276,7 +1270,7 @@ static void mgsl_isr_transmit_status( struct mgsl_struct *info )
else
#endif
{
- if (info->tty->stopped || info->tty->hw_stopped) {
+ if (info->port.tty->stopped || info->port.tty->hw_stopped) {
usc_stop_transmitter(info);
return;
}
@@ ...From: Alan Cox <alan@redhat.com>
Reverse the order of one test and it gets much more readable
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/char/tty_io.c | 48 ++++++++++++++++++++++--------------------------
1 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 1856096..87b1f9b 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -3488,35 +3488,31 @@ static int tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p
static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int cmd,
unsigned __user *p)
{
- int retval = -EINVAL;
-
- if (tty->ops->tiocmset) {
- unsigned int set, clear, val;
-
- retval = get_user(val, p);
- if (retval)
- return retval;
-
- set = clear = 0;
- switch (cmd) {
- case TIOCMBIS:
- set = val;
- break;
- case TIOCMBIC:
- clear = val;
- break;
- case TIOCMSET:
- set = val;
- clear = ~val;
- break;
- }
+ int retval;
+ unsigned int set, clear, val;
- set &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP;
- clear &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP;
+ if (tty->ops->tiocmset == NULL)
+ return -EINVAL;
- retval = tty->ops->tiocmset(tty, file, set, clear);
+ retval = get_user(val, p);
+ if (retval)
+ return retval;
+ set = clear = 0;
+ switch (cmd) {
+ case TIOCMBIS:
+ set = val;
+ break;
+ case TIOCMBIC:
+ clear = val;
+ break;
+ case TIOCMSET:
+ set = val;
+ clear = ~val;
+ break;
}
- return retval;
+ set &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP;
+ clear &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP;
+ return tty->ops->tiocmset(tty, file, set, clear);
}
/*
--
From: Alan Cox <alan@redhat.com>
Switch cyclades to use the new tty_port structure
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/char/cyclades.c | 315 +++++++++++++++++++++++-----------------------
include/linux/cyclades.h | 7 -
2 files changed, 158 insertions(+), 164 deletions(-)
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 2bf4b4a..e06f637 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -762,7 +762,7 @@ static int cy_next_channel; /* next minor available */
/*
* This is used to look up the divisor speeds and the timeouts
* We're normally limited to 15 distinct baud rates. The extra
- * are accessed via settings in info->flags.
+ * are accessed via settings in info->port.flags.
* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
* 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
* HI VHI
@@ -1003,7 +1003,7 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip,
cy_writeb(base_addr + (CyCAR << index), save_xir);
/* if there is nowhere to put the data, discard it */
- if (info->tty == NULL) {
+ if (info->port.tty == NULL) {
if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) ==
CyIVRRxEx) { /* exception */
data = readb(base_addr + (CyRDSR << index));
@@ -1015,7 +1015,7 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip,
goto end;
}
/* there is an open port for this data */
- tty = info->tty;
+ tty = info->port.tty;
if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) ==
CyIVRRxEx) { /* exception */
data = readb(base_addr + (CyRDSR << index));
@@ -1041,7 +1041,7 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip,
readb(base_addr + (CyRDSR <<
index)), TTY_BREAK);
info->icount.rx++;
- if (info->flags & ASYNC_SAK)
+ if (info->port.flags & ASYNC_SAK)
do_SAK(tty);
} else if ...From: Alan Cox <alan@redhat.com>
Fix up the termios of the people who have not yet got with the program
Signed-off-by: Alan Cox <alan@redhat.com>
---
include/asm-avr32/ioctls.h | 4 ++++
include/asm-frv/ioctls.h | 4 ++++
include/asm-frv/termbits.h | 5 ++++-
3 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/include/asm-avr32/ioctls.h b/include/asm-avr32/ioctls.h
index 0500426..0cf2c0a 100644
--- a/include/asm-avr32/ioctls.h
+++ b/include/asm-avr32/ioctls.h
@@ -47,6 +47,10 @@
#define TIOCSBRK 0x5427 /* BSD compatibility */
#define TIOCCBRK 0x5428 /* BSD compatibility */
#define TIOCGSID 0x5429 /* Return the session ID of FD */
+#define TCGETS2 _IOR('T',0x2A, struct termios2)
+#define TCSETS2 _IOW('T',0x2B, struct termios2)
+#define TCSETSW2 _IOW('T',0x2C, struct termios2)
+#define TCSETSF2 _IOW('T',0x2D, struct termios2)
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
diff --git a/include/asm-frv/ioctls.h b/include/asm-frv/ioctls.h
index 341c7dd..d0c30e3 100644
--- a/include/asm-frv/ioctls.h
+++ b/include/asm-frv/ioctls.h
@@ -47,6 +47,10 @@
#define TIOCSBRK 0x5427 /* BSD compatibility */
#define TIOCCBRK 0x5428 /* BSD compatibility */
#define TIOCGSID 0x5429 /* Return the session ID of FD */
+#define TCGETS2 _IOR('T',0x2A, struct termios2)
+#define TCSETS2 _IOW('T',0x2B, struct termios2)
+#define TCSETSW2 _IOW('T',0x2C, struct termios2)
+#define TCSETSF2 _IOW('T',0x2D, struct termios2)
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
diff --git a/include/asm-frv/termbits.h b/include/asm-frv/termbits.h
index 74851b4..5568492 100644
--- a/include/asm-frv/termbits.h
+++ b/include/asm-frv/termbits.h
@@ -141,6 +141,7 @@ struct ktermios {
#define HUPCL 0002000
#define CLOCAL 0004000
#define CBAUDEX ...From: Alan Cox <alan@redhat.com>
Move more bits into the tty_port structure
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/char/cyclades.c | 28 ++++----
drivers/char/isicom.c | 28 ++++----
drivers/char/moxa.c | 8 +-
drivers/char/mxser.c | 29 +++-----
drivers/char/riscom8.c | 24 +++----
drivers/char/riscom8.h | 2 -
drivers/char/rocket.c | 23 +++---
drivers/char/rocket.h | 4 +
drivers/char/rocket_int.h | 2 -
drivers/char/specialix.c | 153 ++++++++++++++++++++----------------------
drivers/char/specialix_io8.h | 8 --
drivers/char/sx.c | 2 -
drivers/char/synclink.c | 16 ++--
drivers/char/synclink_gt.c | 16 ++--
drivers/char/synclinkmp.c | 14 ++--
drivers/char/tty_io.c | 2 +
include/linux/cyclades.h | 6 +-
include/linux/tty.h | 2 +
18 files changed, 169 insertions(+), 198 deletions(-)
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index e06f637..5ee9f46 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -2677,8 +2677,8 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
*/
tty->closing = 1;
spin_unlock_irqrestore(&card->card_lock, flags);
- if (info->closing_wait != CY_CLOSING_WAIT_NONE)
- tty_wait_until_sent(tty, info->closing_wait);
+ if (info->port.closing_wait != CY_CLOSING_WAIT_NONE)
+ tty_wait_until_sent(tty, info->port.closing_wait);
spin_lock_irqsave(&card->card_lock, flags);
@@ -2734,9 +2734,9 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
info->port.tty = NULL;
if (info->port.blocked_open) {
spin_unlock_irqrestore(&card->card_lock, flags);
- if (info->close_delay) {
+ if (info->port.close_delay) {
msleep_interruptible(jiffies_to_msecs
- (info->close_delay));
+ (info->port.close_delay));
}
wake_up_interruptible(&info->port.open_wait);
...From: Alan Cox <alan@redhat.com>
Bring ezusb and whiteheat into line with the coding style
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/ezusb.c | 22 +-
drivers/usb/serial/whiteheat.c | 429 ++++++++++++++++++++++------------------
drivers/usb/serial/whiteheat.h | 78 +++++--
3 files changed, 302 insertions(+), 227 deletions(-)
diff --git a/drivers/usb/serial/ezusb.c b/drivers/usb/serial/ezusb.c
index cc4fbd9..711e84f 100644
--- a/drivers/usb/serial/ezusb.c
+++ b/drivers/usb/serial/ezusb.c
@@ -20,7 +20,8 @@
/* EZ-USB Control and Status Register. Bit 0 controls 8051 reset */
#define CPUCS_REG 0x7F92
-int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *data, int length, __u8 bRequest)
+int ezusb_writememory(struct usb_serial *serial, int address,
+ unsigned char *data, int length, __u8 request)
{
int result;
unsigned char *transfer_buffer;
@@ -33,26 +34,27 @@ int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *da
transfer_buffer = kmemdup(data, length, GFP_KERNEL);
if (!transfer_buffer) {
- dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n", __func__, length);
+ dev_err(&serial->dev->dev, "%s - kmalloc(%d) failed.\n",
+ __func__, length);
return -ENOMEM;
}
- result = usb_control_msg (serial->dev, usb_sndctrlpipe(serial->dev, 0), bRequest, 0x40, address, 0, transfer_buffer, length, 3000);
- kfree (transfer_buffer);
+ result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
+ request, 0x40, address, 0, transfer_buffer, length, 3000);
+ kfree(transfer_buffer);
return result;
}
+EXPORT_SYMBOL_GPL(ezusb_writememory);
-int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit)
+int ezusb_set_reset(struct usb_serial *serial, unsigned char reset_bit)
{
int response;
/* dbg("%s - %d", __func__, reset_bit); */
- response = ezusb_writememory (serial, CPUCS_REG, &reset_bit, 1, 0xa0);
+ response = ...From: Alan Cox <alan@redhat.com>
Termios tidy up, plus fix break and DTR.
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/whiteheat.c | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 5a3ed57..0954191 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -652,11 +652,8 @@ static int whiteheat_open(struct tty_struct *tty,
goto exit;
}
- if (tty) {
- old_term.c_cflag = ~tty->termios->c_cflag;
- old_term.c_iflag = ~tty->termios->c_iflag;
- whiteheat_set_termios(tty, port, &old_term);
- }
+ if (tty)
+ firm_setup_port(tty);
/* Work around HCD bugs */
usb_clear_halt(port->serial->dev, port->read_urb->pipe);
@@ -907,7 +904,6 @@ static int whiteheat_ioctl(struct tty_struct *tty, struct file *file,
static void whiteheat_set_termios(struct tty_struct *tty,
struct usb_serial_port *port, struct ktermios *old_termios)
{
- /* FIXME */
firm_setup_port(tty);
}
@@ -1303,7 +1299,7 @@ static int firm_set_dtr(struct usb_serial_port *port, __u8 onoff)
dtr_command.port = port->number - port->serial->minor + 1;
dtr_command.state = onoff;
- return firm_send_command(port, WHITEHEAT_SET_RTS,
+ return firm_send_command(port, WHITEHEAT_SET_DTR,
(__u8 *)&dtr_command, sizeof(dtr_command));
}
@@ -1314,7 +1310,7 @@ static int firm_set_break(struct usb_serial_port *port, __u8 onoff)
break_command.port = port->number - port->serial->minor + 1;
break_command.state = onoff;
- return firm_send_command(port, WHITEHEAT_SET_RTS,
+ return firm_send_command(port, WHITEHEAT_SET_BREAK,
(__u8 *)&break_command, sizeof(break_command));
}
--
From: Alan Cox <alan@redhat.com> Coding style tidy up for belkin_sa Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/belkin_sa.c | 148 +++++++++++++++++++++++----------------- drivers/usb/serial/belkin_sa.h | 15 ++-- 2 files changed, 94 insertions(+), 69 deletions(-) diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index 1a76269..2ebe06c 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c @@ -7,13 +7,14 @@ * This program is largely derived from work by the linux-usb group * and associated source files. Please see the usb/serial files for * individual credits and copyrights. - * + * * 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. * - * See Documentation/usb/usb-serial.txt for more information on using this driver + * See Documentation/usb/usb-serial.txt for more information on using this + * driver * * TODO: * -- Add true modem contol line query capability. Currently we track the @@ -28,7 +29,8 @@ * compressed all the differnent device entries into 1. * * 30-May-2001 gkh - * switched from using spinlock to a semaphore, which fixes lots of problems. + * switched from using spinlock to a semaphore, which fixes lots of + * problems. * * 08-Apr-2001 gb * - Identify version on module load. @@ -41,7 +43,7 @@ * - Added support for the old Belkin and Peracom devices. * - Made the port able to be opened multiple times. * - Added some defaults incase the line settings are things these devices - * can't support. + * can't support. * * 18-Oct-2000 William Greathouse * Released into the wild (linux-usb-devel) @@ -72,7 +74,7 @@ #include <linux/tty_flip.h> #include <linux/module.h> #include <linux/spinlock.h> -#include ...
From: Alan Cox <alan@redhat.com>
Tidy up
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/bus.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index 0b14aea..83bbb5b 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -15,7 +15,8 @@
#include <linux/usb.h>
#include <linux/usb/serial.h>
-static int usb_serial_device_match (struct device *dev, struct device_driver *drv)
+static int usb_serial_device_match(struct device *dev,
+ struct device_driver *drv)
{
struct usb_serial_driver *driver;
const struct usb_serial_port *port;
@@ -46,7 +47,7 @@ static ssize_t show_port_number(struct device *dev,
static DEVICE_ATTR(port_number, S_IRUGO, show_port_number, NULL);
-static int usb_serial_device_probe (struct device *dev)
+static int usb_serial_device_probe(struct device *dev)
{
struct usb_serial_driver *driver;
struct usb_serial_port *port;
@@ -66,7 +67,7 @@ static int usb_serial_device_probe (struct device *dev)
retval = -EIO;
goto exit;
}
- retval = driver->port_probe (port);
+ retval = driver->port_probe(port);
module_put(driver->driver.owner);
if (retval)
goto exit;
@@ -77,8 +78,8 @@ static int usb_serial_device_probe (struct device *dev)
goto exit;
minor = port->number;
- tty_register_device (usb_serial_tty_driver, minor, dev);
- dev_info(&port->serial->dev->dev,
+ tty_register_device(usb_serial_tty_driver, minor, dev);
+ dev_info(&port->serial->dev->dev,
"%s converter now attached to ttyUSB%d\n",
driver->description, minor);
@@ -86,7 +87,7 @@ exit:
return retval;
}
-static int usb_serial_device_remove (struct device *dev)
+static int usb_serial_device_remove(struct device *dev)
{
struct usb_serial_driver *driver;
struct usb_serial_port *port;
@@ -94,9 +95,8 @@ static int usb_serial_device_remove (struct device *dev)
int minor;
port ...From: Alan Cox <alan@redhat.com>
Code tidy
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/console.c | 127 ++++++++++++++++++++++--------------------
1 files changed, 66 insertions(+), 61 deletions(-)
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 940f5de..9a4cd0a 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -6,7 +6,7 @@
* 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.
- *
+ *
* Thanks to Randy Dunlap for the original version of this code.
*
*/
@@ -67,7 +67,7 @@ static int usb_console_setup(struct console *co, char *options)
struct tty_struct *tty = NULL;
struct ktermios *termios = NULL, dummy;
- dbg ("%s", __func__);
+ dbg("%s", __func__);
if (options) {
baud = simple_strtoul(options, NULL, 10);
@@ -84,52 +84,52 @@ static int usb_console_setup(struct console *co, char *options)
/* build a cflag setting */
switch (baud) {
- case 1200:
- cflag |= B1200;
- break;
- case 2400:
- cflag |= B2400;
- break;
- case 4800:
- cflag |= B4800;
- break;
- case 19200:
- cflag |= B19200;
- break;
- case 38400:
- cflag |= B38400;
- break;
- case 57600:
- cflag |= B57600;
- break;
- case 115200:
- cflag |= B115200;
- break;
- case 9600:
- default:
- cflag |= B9600;
- /*
- * Set this to a sane value to prevent a divide error
- */
- baud = 9600;
- break;
+ case 1200:
+ cflag |= B1200;
+ break;
+ case 2400:
+ cflag |= B2400;
+ break;
+ case 4800:
+ cflag |= B4800;
+ break;
+ case 19200:
+ cflag |= B19200;
+ break;
+ case 38400:
+ cflag |= B38400;
+ break;
+ case 57600:
+ cflag |= B57600;
+ break;
+ case 115200:
+ cflag |= B115200;
+ break;
+ case 9600:
+ default:
+ cflag |= B9600;
+ /*
+ * Set this to a sane value to ...From: Alan Cox <alan@redhat.com>
Setting CFLAG bits is all well and good but you must sort out ispeed and
ospeed properly.
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/console.c | 37 +++++--------------------------------
1 files changed, 5 insertions(+), 32 deletions(-)
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 9a4cd0a..7b74238 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -81,39 +81,11 @@ static int usb_console_setup(struct console *co, char *options)
if (*s)
doflow = (*s++ == 'r');
}
+
+ /* Sane default */
+ if (baud == 0)
+ baud = 9600;
- /* build a cflag setting */
- switch (baud) {
- case 1200:
- cflag |= B1200;
- break;
- case 2400:
- cflag |= B2400;
- break;
- case 4800:
- cflag |= B4800;
- break;
- case 19200:
- cflag |= B19200;
- break;
- case 38400:
- cflag |= B38400;
- break;
- case 57600:
- cflag |= B57600;
- break;
- case 115200:
- cflag |= B115200;
- break;
- case 9600:
- default:
- cflag |= B9600;
- /*
- * Set this to a sane value to prevent a divide error
- */
- baud = 9600;
- break;
- }
switch (bits) {
case 7:
cflag |= CS7;
@@ -188,6 +160,7 @@ static int usb_console_setup(struct console *co, char *options)
if (serial->type->set_termios) {
termios->c_cflag = cflag;
+ tty_termios_encode_baud_rate(termios, baud, baud);
serial->type->set_termios(NULL, port, &dummy);
port->port.tty = NULL;
--
From: Alan Cox <alan@redhat.com>
Bring up to coding style
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/cp2101.c | 318 +++++++++++++++++++++----------------------
1 files changed, 158 insertions(+), 160 deletions(-)
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c
index 908803e..16a0fda 100644
--- a/drivers/usb/serial/cp2101.c
+++ b/drivers/usb/serial/cp2101.c
@@ -25,7 +25,7 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/usb.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include <linux/usb/serial.h>
/*
@@ -45,12 +45,12 @@ static void cp2101_close(struct tty_struct *, struct usb_serial_port *,
static void cp2101_get_termios(struct tty_struct *);
static void cp2101_set_termios(struct tty_struct *, struct usb_serial_port *,
struct ktermios*);
-static int cp2101_tiocmget (struct tty_struct *, struct file *);
-static int cp2101_tiocmset (struct tty_struct *, struct file *,
+static int cp2101_tiocmget(struct tty_struct *, struct file *);
+static int cp2101_tiocmset(struct tty_struct *, struct file *,
unsigned int, unsigned int);
static void cp2101_break_ctl(struct tty_struct *, int);
-static int cp2101_startup (struct usb_serial *);
-static void cp2101_shutdown(struct usb_serial*);
+static int cp2101_startup(struct usb_serial *);
+static void cp2101_shutdown(struct usb_serial *);
static int debug;
@@ -96,7 +96,7 @@ static struct usb_device_id id_table [] = {
{ } /* Terminating Entry */
};
-MODULE_DEVICE_TABLE (usb, id_table);
+MODULE_DEVICE_TABLE(usb, id_table);
static struct usb_driver cp2101_driver = {
.name = "cp2101",
@@ -205,12 +205,12 @@ static int cp2101_get_config(struct usb_serial_port *port, u8 request,
request++;
/* Issue the request, attempting to read 'size' bytes */
- result = usb_control_msg (serial->dev,usb_rcvctrlpipe (serial->dev, 0),
+ result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
...From: Alan Cox <alan@redhat.com>
Coding style fixups
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/cyberjack.c | 131 +++++++++++++++++++++-------------------
1 files changed, 69 insertions(+), 62 deletions(-)
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
index 546178e..b4d7235 100644
--- a/drivers/usb/serial/cyberjack.c
+++ b/drivers/usb/serial/cyberjack.c
@@ -37,7 +37,7 @@
#include <linux/tty_flip.h>
#include <linux/module.h>
#include <linux/spinlock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
@@ -65,7 +65,7 @@ static void cyberjack_close(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp);
static int cyberjack_write(struct tty_struct *tty,
struct usb_serial_port *port, const unsigned char *buf, int count);
-static int cyberjack_write_room( struct tty_struct *tty);
+static int cyberjack_write_room(struct tty_struct *tty);
static void cyberjack_read_int_callback(struct urb *urb);
static void cyberjack_read_bulk_callback(struct urb *urb);
static void cyberjack_write_bulk_callback(struct urb *urb);
@@ -75,7 +75,7 @@ static struct usb_device_id id_table [] = {
{ } /* Terminating entry */
};
-MODULE_DEVICE_TABLE (usb, id_table);
+MODULE_DEVICE_TABLE(usb, id_table);
static struct usb_driver cyberjack_driver = {
.name = "cyberjack",
@@ -138,20 +138,20 @@ static int cyberjack_startup(struct usb_serial *serial)
for (i = 0; i < serial->num_ports; ++i) {
int result;
serial->port[i]->interrupt_in_urb->dev = serial->dev;
- result = usb_submit_urb(serial->port[i]->interrupt_in_urb,
+ result = usb_submit_urb(serial->port[i]->interrupt_in_urb,
GFP_KERNEL);
if (result)
err(" usb_submit_urb(read int) failed");
dbg("%s - usb_submit_urb(int urb)", __func__);
}
- return( 0 );
+ return 0;
}
static void cyberjack_shutdown(struct usb_serial *serial)
{
int ...From: Alan Cox <alan@redhat.com> Coding style clean ups Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/cypress_m8.c | 617 ++++++++++++++++++++------------------- drivers/usb/serial/cypress_m8.h | 2 2 files changed, 325 insertions(+), 294 deletions(-) diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 6999d33..bb9c7c4 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -2,7 +2,7 @@ * USB Cypress M8 driver * * Copyright (C) 2004 - * Lonnie Mendez (dignome@gmail.com) + * Lonnie Mendez (dignome@gmail.com) * Copyright (C) 2003,2004 * Neil Whelchel (koyama@firstlight.net) * @@ -11,19 +11,21 @@ * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * See Documentation/usb/usb-serial.txt for more information on using this driver + * See Documentation/usb/usb-serial.txt for more information on using this + * driver * * See http://geocities.com/i0xox0i for information on this driver and the * earthmate usb device. * * Lonnie Mendez <dignome@gmail.com> * 4-29-2005 - * Fixed problem where setting or retreiving the serial config would fail with - * EPIPE. Removed CRTS toggling so the driver behaves more like other usbserial - * adapters. Issued new interval of 1ms instead of the default 10ms. As a - * result, transfer speed has been substantially increased. From avg. 850bps to - * avg. 3300bps. initial termios has also been modified. Cleaned up code and - * formatting issues so it is more readable. Replaced the C++ style comments. + * Fixed problem where setting or retreiving the serial config would fail + * with EPIPE. Removed CRTS toggling so the driver behaves more like + * other usbserial adapters. Issued new interval of 1ms instead of the + * default 10ms. As a result, transfer speed has been substantially + * increased from avg. 850bps to avg. 3300bps. ...
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/cypress_m8.c | 37 +++++++++++++++++--------------------
1 files changed, 17 insertions(+), 20 deletions(-)
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index bb9c7c4..22837a3 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -1093,27 +1093,24 @@ static void cypress_set_termios(struct tty_struct *tty,
} else
parity_enable = parity_type = 0;
- if (cflag & CSIZE) {
- switch (cflag & CSIZE) {
- case CS5:
- data_bits = 0;
- break;
- case CS6:
- data_bits = 1;
- break;
- case CS7:
- data_bits = 2;
- break;
- case CS8:
- data_bits = 3;
- break;
- default:
- err("%s - CSIZE was set, but not CS5-CS8",
- __func__);
- data_bits = 3;
- } else
+ switch (cflag & CSIZE) {
+ case CS5:
+ data_bits = 0;
+ break;
+ case CS6:
+ data_bits = 1;
+ break;
+ case CS7:
+ data_bits = 2;
+ break;
+ case CS8:
data_bits = 3;
-
+ break;
+ default:
+ err("%s - CSIZE was set, but not CS5-CS8",
+ __func__);
+ data_bits = 3;
+ }
spin_lock_irqsave(&priv->lock, flags);
oldlines = priv->line_control;
if ((cflag & CBAUD) == B0) {
--
From: Alan Cox <alan@redhat.com> Code tidy Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/digi_acceleport.c | 693 ++++++++++++++++++---------------- 1 files changed, 358 insertions(+), 335 deletions(-) diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 847848b..0f3d553 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c @@ -1,237 +1,236 @@ /* -* Digi AccelePort USB-4 and USB-2 Serial Converters -* -* Copyright 2000 by Digi International -* -* 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. -* -* Shamelessly based on Brian Warner's keyspan_pda.c and Greg Kroah-Hartman's -* usb-serial driver. -* -* Peter Berger (pberger@brimson.com) -* Al Borchers (borchers@steinerpoint.com) -* -* (12/03/2001) gkh -* switched to using port->port.count instead of private version. -* Removed port->active -* -* (04/08/2001) gb -* Identify version on module load. -* -* (11/01/2000) Adam J. Richter -* usb_device_id table support -* -* (11/01/2000) pberger and borchers -* -- Turned off the USB_DISABLE_SPD flag for write bulk urbs--it caused -* USB 4 ports to hang on startup. -* -- Serialized access to write urbs by adding the dp_write_urb_in_use -* flag; otherwise, the driver caused SMP system hangs. Watching the -* urb status is not sufficient. -* -* (10/05/2000) gkh -* -- Fixed bug with urb->dev not being set properly, now that the usb -* core needs it. -* -* (8/8/2000) pberger and borchers -* -- Fixed close so that -* - it can timeout while waiting for transmit idle, if needed; -* - it ignores interrupts when flushing the port, turning -* of modem signalling, and so on; -* - it waits for the ...
From: Alan Cox <alan@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/empeg.c | 203 +++++++++++++++++++++++--------------------- 1 files changed, 107 insertions(+), 96 deletions(-) diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c index 47ebdf5..a6ab5b5 100644 --- a/drivers/usb/serial/empeg.c +++ b/drivers/usb/serial/empeg.c @@ -11,36 +11,39 @@ * it under the terms of the GNU General Public License, as published by * the Free Software Foundation, version 2. * - * See Documentation/usb/usb-serial.txt for more information on using this driver - * + * See Documentation/usb/usb-serial.txt for more information on using this + * driver + * * (07/16/2001) gb - * remove unused code in empeg_close() (thanks to Oliver Neukum for pointing this - * out) and rewrote empeg_set_termios(). - * + * remove unused code in empeg_close() (thanks to Oliver Neukum for + * pointing this out) and rewrote empeg_set_termios(). + * * (05/30/2001) gkh - * switched from using spinlock to a semaphore, which fixes lots of problems. + * switched from using spinlock to a semaphore, which fixes lots of + * problems. * * (04/08/2001) gb * Identify version on module load. - * + * * (01/22/2001) gb - * Added write_room() and chars_in_buffer() support. - * + * Added write_room() and chars_in_buffer() support. + * * (12/21/2000) gb * Moved termio stuff inside the port->active check. * Moved MOD_DEC_USE_COUNT to end of empeg_close(). - * + * * (12/03/2000) gb - * Added port->port.tty->ldisc.set_termios(port->port.tty, NULL) to empeg_open() - * This notifies the tty driver that the termios have changed. - * + * Added port->port.tty->ldisc.set_termios(port->port.tty, NULL) to + * empeg_open(). This notifies the tty driver that the termios have + * changed. + * * (11/13/2000) gb - * Moved tty->low_latency = 1 from empeg_read_bulk_callback() to empeg_open() - * (It only needs to be set once - ...
From: Alan Cox <alan@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/ftdi_sio.c | 1078 ++++++++++++++++++++++------------------- drivers/usb/serial/ftdi_sio.h | 126 ++--- 2 files changed, 635 insertions(+), 569 deletions(-) diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index cde50b0..44de3a0 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -12,7 +12,8 @@ * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * See Documentation/usb/usb-serial.txt for more information on using this driver + * See Documentation/usb/usb-serial.txt for more information on using this + * driver * * See http://ftdi-usb-sio.sourceforge.net for upto date testing info * and extra documentation @@ -25,7 +26,8 @@ /* Bill Ryder - bryder@sgi.com - wrote the FTDI_SIO implementation */ /* Thanx to FTDI for so kindly providing details of the protocol required */ /* to talk to the device */ -/* Thanx to gkh and the rest of the usb dev group for all code I have assimilated :-) */ +/* Thanx to gkh and the rest of the usb dev group for all code I have + assimilated :-) */ #include <linux/kernel.h> #include <linux/errno.h> @@ -36,7 +38,7 @@ #include <linux/tty_flip.h> #include <linux/module.h> #include <linux/spinlock.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <linux/usb.h> #include <linux/serial.h> #include <linux/usb/serial.h> @@ -55,17 +57,22 @@ static __u16 product; struct ftdi_private { ftdi_chip_type_t chip_type; - /* type of the device, either SIO or FT8U232AM */ + /* type of device, either SIO or FT8U232AM */ int baud_base; /* baud base clock for divisor setting */ - int custom_divisor; /* custom_divisor kludge, this is for baud_base (different from what goes to the chip!) */ + int custom_divisor; /* custom_divisor kludge, this is for + baud_base (different from ...
From: Alan Cox <alan@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/funsoft.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/usb/serial/funsoft.c b/drivers/usb/serial/funsoft.c index e8ba2cb..d30f736 100644 --- a/drivers/usb/serial/funsoft.c +++ b/drivers/usb/serial/funsoft.c @@ -14,7 +14,7 @@ #include <linux/module.h> #include <linux/usb.h> #include <linux/usb/serial.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> static int debug; --
From: Alan Cox <alan@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/garmin_gps.c | 354 +++++++++++++++++++-------------------- 1 files changed, 176 insertions(+), 178 deletions(-) diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 06cfa43..2e663f1 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c @@ -33,7 +33,7 @@ #include <linux/tty_flip.h> #include <linux/module.h> #include <linux/spinlock.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <asm/atomic.h> #include <linux/usb.h> #include <linux/usb/serial.h> @@ -44,7 +44,7 @@ static int initial_mode = 1; /* debug flag */ -static int debug = 0; +static int debug; #define GARMIN_VENDOR_ID 0x091E @@ -56,7 +56,7 @@ static int debug = 0; #define VERSION_MINOR 31 #define _STR(s) #s -#define _DRIVER_VERSION(a,b) "v" _STR(a) "." _STR(b) +#define _DRIVER_VERSION(a, b) "v" _STR(a) "." _STR(b) #define DRIVER_VERSION _DRIVER_VERSION(VERSION_MAJOR, VERSION_MINOR) #define DRIVER_AUTHOR "hermann kneissel" #define DRIVER_DESC "garmin gps driver" @@ -65,37 +65,37 @@ static int debug = 0; #define EINVPKT 1000 /* invalid packet structure */ -// size of the header of a packet using the usb protocol +/* size of the header of a packet using the usb protocol */ #define GARMIN_PKTHDR_LENGTH 12 -// max. possible size of a packet using the serial protocol -#define MAX_SERIAL_PKT_SIZ (3+255+3) +/* max. possible size of a packet using the serial protocol */ +#define MAX_SERIAL_PKT_SIZ (3 + 255 + 3) -// max. possible size of a packet with worst case stuffing -#define MAX_SERIAL_PKT_SIZ_STUFFED MAX_SERIAL_PKT_SIZ+256 +/* max. possible size of a packet with worst case stuffing */ +#define MAX_SERIAL_PKT_SIZ_STUFFED (MAX_SERIAL_PKT_SIZ + 256) -// size of a buffer able to hold a complete (no stuffing) packet -// (the document protocol does not contain packets with a ...
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/generic.c | 87 ++++++++++++++++++++++++------------------
1 files changed, 49 insertions(+), 38 deletions(-)
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 5128018..fe84c88 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -18,7 +18,7 @@
#include <linux/moduleparam.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
static int debug;
@@ -81,7 +81,7 @@ static int generic_probe(struct usb_interface *interface,
}
#endif
-int usb_serial_generic_register (int _debug)
+int usb_serial_generic_register(int _debug)
{
int retval = 0;
@@ -89,10 +89,11 @@ int usb_serial_generic_register (int _debug)
#ifdef CONFIG_USB_SERIAL_GENERIC
generic_device_ids[0].idVendor = vendor;
generic_device_ids[0].idProduct = product;
- generic_device_ids[0].match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT;
+ generic_device_ids[0].match_flags =
+ USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT;
/* register our generic driver with ourselves */
- retval = usb_serial_register (&usb_serial_generic_device);
+ retval = usb_serial_register(&usb_serial_generic_device);
if (retval)
goto exit;
retval = usb_register(&generic_driver);
@@ -103,12 +104,12 @@ exit:
return retval;
}
-void usb_serial_generic_deregister (void)
+void usb_serial_generic_deregister(void)
{
#ifdef CONFIG_USB_SERIAL_GENERIC
/* remove our generic driver */
usb_deregister(&generic_driver);
- usb_serial_deregister (&usb_serial_generic_device);
+ usb_serial_deregister(&usb_serial_generic_device);
#endif
}
@@ -121,9 +122,9 @@ int usb_serial_generic_open(struct tty_struct *tty,
dbg("%s - port %d", __func__, port->number);
- /* force low_latency on so that our tty_push actually forces the data through,
- ...From: Alan Cox <alan@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/hp4x.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/usb/serial/hp4x.c b/drivers/usb/serial/hp4x.c index 75b88b3..ab90586 100644 --- a/drivers/usb/serial/hp4x.c +++ b/drivers/usb/serial/hp4x.c @@ -9,7 +9,8 @@ * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * See Documentation/usb/usb-serial.txt for more information on using this driver + * See Documentation/usb/usb-serial.txt for more information on using this + * driver */ #include <linux/kernel.h> --
From: Alan Cox <alan@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/visor.c | 340 +++++++++++++++++++++++++------------------- 1 files changed, 191 insertions(+), 149 deletions(-) diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 373a3c7..cf8924f 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c @@ -9,7 +9,8 @@ * modify it under the terms of the GNU General Public License version * 2 as published by the Free Software Foundation. * - * See Documentation/usb/usb-serial.txt for more information on using this driver + * See Documentation/usb/usb-serial.txt for more information on using this + * driver * */ @@ -23,7 +24,7 @@ #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/spinlock.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <linux/usb.h> #include <linux/usb/serial.h> #include "visor.h" @@ -35,23 +36,29 @@ #define DRIVER_DESC "USB HandSpring Visor / Palm OS driver" /* function prototypes for a handspring visor */ -static int visor_open (struct tty_struct *tty, struct usb_serial_port *port, struct file *filp); -static void visor_close (struct tty_struct *tty, struct usb_serial_port *port, struct file *filp); -static int visor_write (struct tty_struct *tty, struct usb_serial_port *port, const unsigned char *buf, int count); -static int visor_write_room (struct tty_struct *tty); -static void visor_throttle (struct tty_struct *tty); -static void visor_unthrottle (struct tty_struct *tty); -static int visor_probe (struct usb_serial *serial, const struct usb_device_id *id); +static int visor_open(struct tty_struct *tty, struct usb_serial_port *port, + struct file *filp); +static void visor_close(struct tty_struct *tty, struct usb_serial_port *port, + struct file *filp); +static int visor_write(struct tty_struct *tty, struct usb_serial_port *port, + const unsigned char *buf, int count); +static int ...
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/io_edgeport.c | 1965 +++++++++++++++++++++-----------------
drivers/usb/serial/io_tables.h | 6
2 files changed, 1107 insertions(+), 864 deletions(-)
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 1d8d130..3cb2511 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -42,7 +42,7 @@
#include <linux/serial.h>
#include <linux/ioctl.h>
#include <linux/wait.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
#include "io_edgeport.h"
@@ -59,14 +59,17 @@
/* First, the latest boot code - for first generation edgeports */
#define IMAGE_ARRAY_NAME BootCodeImage_GEN1
#define IMAGE_VERSION_NAME BootCodeImageVersion_GEN1
-#include "io_fw_boot.h" /* the bootloader firmware to download to a device, if it needs it */
+#include "io_fw_boot.h" /* the bootloader firmware to download to
+ a device, if it needs it */
/* for second generation edgeports */
#define IMAGE_ARRAY_NAME BootCodeImage_GEN2
#define IMAGE_VERSION_NAME BootCodeImageVersion_GEN2
-#include "io_fw_boot2.h" /* the bootloader firmware to download to a device, if it needs it */
+#include "io_fw_boot2.h" /* the bootloader firmware to download to
+ a device, if it needs it */
-/* Then finally the main run-time operational code - for first generation edgeports */
+/* Then finally the main run-time operational code - for first generation
+ edgeports */
#define IMAGE_ARRAY_NAME OperationalCodeImage_GEN1
#define IMAGE_VERSION_NAME OperationalCodeImageVersion_GEN1
#include "io_fw_down.h" /* Define array OperationalCodeImage[] */
@@ -84,16 +87,16 @@
/* receive port state */
enum RXSTATE {
- EXPECT_HDR1 = 0, /* Expect header byte 1 */
- EXPECT_HDR2 = 1, /* Expect header byte 2 */
- EXPECT_DATA = 2, /* Expect 'RxBytesRemaining' data ...From: Alan Cox <alan@redhat.com>
The edgeport reports negative error codes to functions that do not
expect them. This can cause ports to jam forever
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/io_edgeport.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 3cb2511..44d020e 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -1444,15 +1444,15 @@ static int edge_write_room(struct tty_struct *tty)
dbg("%s", __func__);
if (edge_port == NULL)
- return -ENODEV;
+ return 0;
if (edge_port->closePending)
- return -ENODEV;
+ return 0;
dbg("%s - port %d", __func__, port->number);
if (!edge_port->open) {
dbg("%s - port not opened", __func__);
- return -EINVAL;
+ return 0;
}
/* total of both buffers is still txCredit */
@@ -1484,13 +1484,13 @@ static int edge_chars_in_buffer(struct tty_struct *tty)
dbg("%s", __func__);
if (edge_port == NULL)
- return -ENODEV;
+ return 0;
if (edge_port->closePending)
- return -ENODEV;
+ return 0;
if (!edge_port->open) {
dbg("%s - port not opened", __func__);
- return -EINVAL;
+ return 0;
}
spin_lock_irqsave(&edge_port->ep_lock, flags);
--
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/usb-serial.c | 311 +++++++++++++++++++++------------------
1 files changed, 168 insertions(+), 143 deletions(-)
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 6a1146a..8882f95 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -12,7 +12,8 @@
* This driver was originally based on the ACM driver by Armin Fuerst (which was
* based on a driver by Brad Keryan)
*
- * See Documentation/usb/usb-serial.txt for more information on using this driver
+ * See Documentation/usb/usb-serial.txt for more information on using this
+ * driver
*
*/
@@ -28,7 +29,7 @@
#include <linux/spinlock.h>
#include <linux/mutex.h>
#include <linux/list.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
#include "pl2303.h"
@@ -59,7 +60,8 @@ static struct usb_driver usb_serial_driver = {
*/
static int debug;
-static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially all NULL */
+/* initially all NULL */
+static struct usb_serial *serial_table[SERIAL_TTY_MINORS];
static DEFINE_MUTEX(table_lock);
static LIST_HEAD(usb_serial_driver_list);
@@ -76,7 +78,8 @@ struct usb_serial *usb_serial_get_by_index(unsigned index)
return serial;
}
-static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_ports, unsigned int *minor)
+static struct usb_serial *get_free_serial(struct usb_serial *serial,
+ int num_ports, unsigned int *minor)
{
unsigned int i, j;
int good_spot;
@@ -122,9 +125,8 @@ static void return_serial(struct usb_serial *serial)
if (serial == NULL)
return;
- for (i = 0; i < serial->num_ports; ++i) {
+ for (i = 0; i < serial->num_ports; ++i)
serial_table[serial->minor + i] = NULL;
- }
}
static void destroy_serial(struct kref *kref)
@@ -156,7 +158,8 @@ static void ...From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/io_ti.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 808e285..c6a6444 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -2402,7 +2402,7 @@ static void change_port_settings(struct tty_struct *tty,
return;
}
-static void edge_set_termios(struct tty_struct *tty,
+static void edge_set_termios(struct tty_struct *tty,
struct usb_serial_port *port, struct ktermios *old_termios)
{
struct edgeport_port *edge_port = usb_get_serial_port_data(port);
@@ -2771,7 +2771,7 @@ static unsigned int edge_buf_data_avail(struct edge_buf *eb)
{
if (eb == NULL)
return 0;
- return ((eb->buf_size + eb->buf_put - eb->buf_get) % eb->buf_size);
+ return (eb->buf_size + eb->buf_put - eb->buf_get) % eb->buf_size;
}
@@ -2786,7 +2786,7 @@ static unsigned int edge_buf_space_avail(struct edge_buf *eb)
{
if (eb == NULL)
return 0;
- return ((eb->buf_size + eb->buf_get - eb->buf_put - 1) % eb->buf_size);
+ return (eb->buf_size + eb->buf_get - eb->buf_put - 1) % eb->buf_size;
}
--
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/ipaq.c | 97 ++++++++++++++++++++++++---------------------
1 files changed, 52 insertions(+), 45 deletions(-)
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index 437982a..5f07f62 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -53,7 +53,7 @@
#include <linux/tty_flip.h>
#include <linux/module.h>
#include <linux/spinlock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
#include "ipaq.h"
@@ -82,10 +82,10 @@ static int ipaq_startup(struct usb_serial *serial);
static void ipaq_shutdown(struct usb_serial *serial);
static int ipaq_write(struct tty_struct *tty, struct usb_serial_port *port,
const unsigned char *buf, int count);
-static int ipaq_write_bulk(struct usb_serial_port *port, const unsigned char *buf,
- int count);
+static int ipaq_write_bulk(struct usb_serial_port *port,
+ const unsigned char *buf, int count);
static void ipaq_write_gather(struct usb_serial_port *port);
-static void ipaq_read_bulk_callback (struct urb *urb);
+static void ipaq_read_bulk_callback(struct urb *urb);
static void ipaq_write_bulk_callback(struct urb *urb);
static int ipaq_write_room(struct tty_struct *tty);
static int ipaq_chars_in_buffer(struct tty_struct *tty);
@@ -552,7 +552,7 @@ static struct usb_device_id ipaq_id_table [] = {
{ } /* Terminating entry */
};
-MODULE_DEVICE_TABLE (usb, ipaq_id_table);
+MODULE_DEVICE_TABLE(usb, ipaq_id_table);
static struct usb_driver ipaq_driver = {
.name = "ipaq",
@@ -615,9 +615,9 @@ static int ipaq_open(struct tty_struct *tty,
for (i = 0; i < URBDATA_QUEUE_MAX / PACKET_SIZE; i++) {
pkt = kmalloc(sizeof(struct ipaq_packet), GFP_KERNEL);
- if (pkt == NULL) {
+ if (pkt == NULL)
goto enomem;
- }
+
pkt->data = kmalloc(PACKET_SIZE, GFP_KERNEL);
if ...From: Alan Cox <alan@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/ipw.c | 279 ++++++++++++++++++++++++---------------------- 1 files changed, 144 insertions(+), 135 deletions(-) diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index a89ebfe..a842025 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c @@ -10,27 +10,27 @@ * (at your option) any later version. * * All information about the device was acquired using SnoopyPro - * on MSFT's O/S, and examing the MSFT drivers' debug output + * on MSFT's O/S, and examing the MSFT drivers' debug output * (insanely left _on_ in the enduser version) * * It was written out of frustration with the IPWireless USB modem * supplied by Axity3G/Sentech South Africa not supporting * Linux whatsoever. * - * Nobody provided any proprietary information that was not already + * Nobody provided any proprietary information that was not already * available for this device. - * - * The modem adheres to the "3GPP TS 27.007 AT command set for 3G - * User Equipment (UE)" standard, available from + * + * The modem adheres to the "3GPP TS 27.007 AT command set for 3G + * User Equipment (UE)" standard, available from * http://www.3gpp.org/ftp/Specs/html-info/27007.htm * * The code was only tested the IPWireless handheld modem distributed * in South Africa by Sentech. - * + * * It may work for Woosh Inc in .nz too, as it appears they use the * same kit. * - * There is still some work to be done in terms of handling + * There is still some work to be done in terms of handling * DCD, DTR, RTS, CTS which are currently faked. * It's good enough for PPP at this point. It's based off all kinds of * code found in usb/serial and usb/class @@ -47,7 +47,7 @@ #include <linux/spinlock.h> #include <linux/usb.h> #include <linux/usb/serial.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> /* * Version ...
From: Alan Cox <alan@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/ir-usb.c | 373 +++++++++++++++++++++++-------------------- 1 files changed, 201 insertions(+), 172 deletions(-) diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index 43dd970..19bff6a 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c @@ -19,7 +19,8 @@ * was written by Roman Weissgaerber <weissg@vienna.at>, Dag Brattli * <dag@brattli.net>, and Jean Tourrilhes <jt@hpl.hp.com> * - * See Documentation/usb/usb-serial.txt for more information on using this driver + * See Documentation/usb/usb-serial.txt for more information on using this + * driver * * 2007_Jun_21 Alan Cox <alan@redhat.com> * Minimal cleanups for some of the driver problens and tty layer abuse. @@ -59,7 +60,7 @@ #include <linux/tty_flip.h> #include <linux/module.h> #include <linux/spinlock.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <linux/usb.h> #include <linux/usb/serial.h> @@ -105,28 +106,32 @@ static int buffer_size; /* if overridden by the user, then use the specified number of XBOFs */ static int xbof = -1; -static int ir_startup (struct usb_serial *serial); -static int ir_open(struct tty_struct *tty, struct usb_serial_port *port, struct file *filep); -static void ir_close(struct tty_struct *tty, struct usb_serial_port *port, struct file *filep); -static int ir_write(struct tty_struct *tty, struct usb_serial_port *port, const unsigned char *buf, int count); -static void ir_write_bulk_callback (struct urb *urb); -static void ir_read_bulk_callback (struct urb *urb); -static void ir_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios); +static int ir_startup(struct usb_serial *serial); +static int ir_open(struct tty_struct *tty, struct usb_serial_port *port, + struct file *filep); +static void ir_close(struct tty_struct *tty, struct usb_serial_port ...
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/iuu_phoenix.c | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index d654148..ddff37f 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -318,11 +318,10 @@ static int bulk_immediate(struct usb_serial_port *port, u8 *buf, u8 count)
port->bulk_out_endpointAddress), buf,
count, &actual, HZ * 1);
- if (status != IUU_OPERATION_OK) {
+ if (status != IUU_OPERATION_OK)
dbg("%s - error = %2x", __func__, status);
- } else {
+ else
dbg("%s - write OK !", __func__);
- }
return status;
}
@@ -342,12 +341,10 @@ static int read_immediate(struct usb_serial_port *port, u8 *buf, u8 count)
port->bulk_in_endpointAddress), buf,
count, &actual, HZ * 1);
- if (status != IUU_OPERATION_OK) {
+ if (status != IUU_OPERATION_OK)
dbg("%s - error = %2x", __func__, status);
- } else {
+ else
dbg("%s - read OK !", __func__);
- }
-
return status;
}
@@ -770,14 +767,14 @@ static int iuu_uart_write(struct tty_struct *tty, struct usb_serial_port *port,
if (priv->writelen > 0) {
/* buffer already filled but not commited */
spin_unlock_irqrestore(&priv->lock, flags);
- return (0);
+ return 0;
}
/* fill the buffer */
memcpy(priv->writebuf, buf, count);
priv->writelen = count;
spin_unlock_irqrestore(&priv->lock, flags);
- return (count);
+ return count;
}
static void read_rxcmd_callback(struct urb *urb)
--
From: Alan Cox <alan@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/keyspan.c | 839 +++++++++++++++++++++--------------------- 1 files changed, 427 insertions(+), 412 deletions(-) diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 823ea97..8c7dc40 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c @@ -1,29 +1,29 @@ /* Keyspan USB to Serial Converter driver - + (C) Copyright (C) 2000-2001 Hugh Blemings <hugh@blemings.org> (C) Copyright (C) 2002 Greg Kroah-Hartman <greg@kroah.com> - + 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. See http://misc.nu/hugh/keyspan.html for more information. - + Code in this driver inspired by and in a number of places taken from Brian Warner's original Keyspan-PDA driver. This driver has been put together with the support of Innosys, Inc. and Keyspan, Inc the manufacturers of the Keyspan USB-serial products. Thanks Guys :) - + Thanks to Paulus for miscellaneous tidy ups, some largish chunks of much nicer and/or completely new code and (perhaps most uniquely) having the patience to sit down and explain why and where he'd changed - stuff. - - Tip 'o the hat to IBM (and previously Linuxcare :) for supporting + stuff. + + Tip 'o the hat to IBM (and previously Linuxcare :) for supporting staff in their work on open source projects. Change History @@ -70,21 +70,21 @@ Thu May 31 11:56:42 PDT 2001 gkh switched from using spinlock to a semaphore - + (04/08/2001) gb Identify version on module load. - + (11/01/2000) Adam J. Richter usb_device_id table support. - + Tue Oct 10 23:15:33 EST 2000 Hugh Merged Paul's changes ...
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/keyspan.c | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 8c7dc40..a90098a 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -575,7 +575,7 @@ static void usa26_glocont_callback(struct urb *urb)
static void usa28_indat_callback(struct urb *urb)
{
- int i, err;
+ int err;
struct usb_serial_port *port;
struct tty_struct *tty;
unsigned char *data;
@@ -604,8 +604,7 @@ static void usa28_indat_callback(struct urb *urb)
tty = port->port.tty;
if (urb->actual_length) {
- for (i = 0; i < urb->actual_length ; ++i)
- tty_insert_flip_char(tty, data[i], 0);
+ tty_insert_flip_string(tty, data, urb->actual_length);
tty_flip_buffer_push(tty);
}
@@ -831,8 +830,8 @@ static void usa49_indat_callback(struct urb *urb)
/* 0x80 bit is error flag */
if ((data[0] & 0x80) == 0) {
/* no error on any byte */
- for (i = 1; i < urb->actual_length ; ++i)
- tty_insert_flip_char(tty, data[i], 0);
+ tty_insert_flip_string(tty, data + 1,
+ urb->actual_length - 1);
} else {
/* some bytes had errors, every byte has status */
for (i = 0; i + 1 < urb->actual_length; i += 2) {
@@ -971,10 +970,9 @@ static void usa90_indat_callback(struct urb *urb)
/* if current mode is DMA, looks like usa28 format
otherwise looks like usa26 data format */
- if (p_priv->baud > 57600) {
- for (i = 0; i < urb->actual_length ; ++i)
- tty_insert_flip_char(tty, data[i], 0);
- } else {
+ if (p_priv->baud > 57600)
+ tty_insert_flip_string(tty, data, urb->actual_length);
+ else {
/* 0x80 bit is error flag */
if ((data[0] & 0x80) == 0) {
/* no errors on individual bytes, only
@@ -1665,7 +1663,7 @@ static int ...From: Alan Cox <alan@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/keyspan_pda.c | 168 +++++++++++++++++++++----------------- 1 files changed, 95 insertions(+), 73 deletions(-) diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index a7538d7..928f545 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -10,8 +10,9 @@ * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * See Documentation/usb/usb-serial.txt for more information on using this driver - * + * See Documentation/usb/usb-serial.txt for more information on using this + * driver + * * (09/07/2001) gkh * cleaned up the Xircom support. Added ids for Entregra device which is * the same as the Xircom device. Enabled the code to be compiled for @@ -21,23 +22,24 @@ * support for Xircom PGSDB9 * * (05/31/2001) gkh - * switched from using spinlock to a semaphore, which fixes lots of problems. + * switched from using spinlock to a semaphore, which fixes lots of + * problems. * * (04/08/2001) gb * Identify version on module load. - * + * * (11/01/2000) Adam J. Richter * usb_device_id table support - * + * * (10/05/2000) gkh * Fixed bug with urb->dev not being set properly, now that the usb * core needs it. - * + * * (08/28/2000) gkh * Added locks for SMP safeness. - * Fixed MOD_INC and MOD_DEC logic and the ability to open a port more + * Fixed MOD_INC and MOD_DEC logic and the ability to open a port more * than once. - * + * * (07/20/2000) borchers * - keyspan_pda_write no longer sleeps if it is called on interrupt time; * PPP and the line discipline with stty echo on can call write on @@ -55,14 +57,14 @@ * than done directly from the callback to avoid the race in write_chan * - keyspan_pda_chars_in_buffer also indicates its buffer is full if the * urb status is -EINPROGRESS, ...
From: Alan Cox <alan@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/kl5kusb105.c | 389 +++++++++++++++++++-------------------- 1 files changed, 188 insertions(+), 201 deletions(-) diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index 4c27ccc..d898dc4 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c @@ -15,12 +15,12 @@ * Neither Palm, nor their contractor (MCCI) or their supplier (KLSI) provided * information that was not already available. * - * It seems that KLSI bought some silicon-design information from ScanLogic, + * It seems that KLSI bought some silicon-design information from ScanLogic, * whose SL11R processor is at the core of the KL5KUSB chipset from KLSI. * KLSI has firmware available for their devices; it is probable that the * firmware differs from that used by KLSI in their products. If you have an - * original KLSI device and can provide some information on it, I would be - * most interested in adding support for it here. If you have any information + * original KLSI device and can provide some information on it, I would be + * most interested in adding support for it here. If you have any information * on the protocol used (or find errors in my reverse-engineered stuff), please * let me know. * @@ -40,7 +40,7 @@ * 0.2 - TIOCMGET works, so autopilot(1) can be used! * 0.1 - can be used to to pilot-xfer -p /dev/ttyUSB0 -l * - * The driver skeleton is mainly based on mct_u232.c and various other + * The driver skeleton is mainly based on mct_u232.c and various other * pieces of code shamelessly copied from the drivers/usb/serial/ directory. */ @@ -53,7 +53,7 @@ #include <linux/tty_driver.h> #include <linux/tty_flip.h> #include <linux/module.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <asm/unaligned.h> #include <linux/usb.h> #include <linux/usb/serial.h> @@ -72,37 +72,25 @@ ...
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/keyspan_pda.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index 928f545..b11329e 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -220,7 +220,6 @@ static void keyspan_pda_rx_interrupt(struct urb *urb)
struct usb_serial_port *port = urb->context;
struct tty_struct *tty = port->port.tty;
unsigned char *data = urb->transfer_buffer;
- int i;
int retval;
int status = urb->status;
struct keyspan_pda_private *priv;
@@ -248,8 +247,8 @@ static void keyspan_pda_rx_interrupt(struct urb *urb)
case 0:
/* rest of message is rx data */
if (urb->actual_length) {
- for (i = 1; i < urb->actual_length ; ++i)
- tty_insert_flip_char(tty, data[i], 0);
+ tty_insert_flip_string(tty, data + 1,
+ urb->actual_length - 1);
tty_flip_buffer_push(tty);
}
break;
--
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/kl5kusb105.c | 4
drivers/usb/serial/kobil_sct.c | 557 +++++++++++++++++++++------------------
2 files changed, 299 insertions(+), 262 deletions(-)
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index d898dc4..e7e3df6 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -88,7 +88,7 @@ static void klsi_105_set_termios(struct tty_struct *tty,
struct usb_serial_port *port, struct ktermios *old);
static void klsi_105_throttle(struct tty_struct *tty);
static void klsi_105_unthrottle(struct tty_struct *tty);
-static int klsi_105_tiocmget((struct tty_struct *tty, struct file *file);
+static int klsi_105_tiocmget(struct tty_struct *tty, struct file *file);
static int klsi_105_tiocmset(struct tty_struct *tty, struct file *file,
unsigned int set, unsigned int clear);
@@ -433,7 +433,7 @@ static int klsi_105_open(struct tty_struct *tty,
if (rc >= 0) {
spin_lock_irqsave(&priv->lock, flags);
priv->line_state = line_state;
- spin_unlock_irqrestore*&priv->lock, flags);
+ spin_unlock_irqrestore(&priv->lock, flags);
dbg("%s - read line state 0x%lx", __func__, line_state);
retval = 0;
} else
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index 40c67f0..f0f8353 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -1,7 +1,7 @@
/*
* KOBIL USB Smart Card Terminal Driver
*
- * Copyright (C) 2002 KOBIL Systems GmbH
+ * Copyright (C) 2002 KOBIL Systems GmbH
* Author: Thomas Wahrenbruch
*
* Contact: linuxusb@kobil.de
@@ -20,7 +20,7 @@
*
* Supported readers: USB TWIN, KAAN Standard Plus and SecOVID Reader Plus
* (Adapter K), B1 Professional and KAAN Professional (Adapter B)
- *
+ *
* (21/05/2004) tw
* Fix bug with P'n'P readers
*
@@ -44,7 +44,7 @@
#include ...From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/kobil_sct.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index f0f8353..deba28e 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -640,9 +640,11 @@ static void kobil_set_termios(struct tty_struct *tty,
priv = usb_get_serial_port_data(port);
if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID ||
- priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID)
+ priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID) {
/* This device doesn't support ioctl calls */
+ *tty->termios = *old;
return;
+ }
speed = tty_get_baud_rate(tty);
switch (speed) {
@@ -704,7 +706,7 @@ static int kobil_ioctl(struct tty_struct *tty, struct file *file,
if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID ||
priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID)
/* This device doesn't support ioctl calls */
- return 0;
+ return -ENOIOCTLCMD;
switch (cmd) {
case TCFLSH:
--
From: Alan Cox <alan@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/mct_u232.c | 273 +++++++++++++++++++++-------------------- 1 files changed, 141 insertions(+), 132 deletions(-) diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index 7bce430..7a804d6 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c @@ -33,10 +33,11 @@ * - Fixed an endianess problem with the baudrate selection for PowerPC. * * 06-Dec-2001 Martin Hamilton <martinh@gnu.org> - * Added support for the Belkin F5U109 DB9 adaptor + * - Added support for the Belkin F5U109 DB9 adaptor * * 30-May-2001 Greg Kroah-Hartman - * switched from using spinlock to a semaphore, which fixes lots of problems. + * - switched from using spinlock to a semaphore, which fixes lots of + * problems. * * 04-May-2001 Stelian Pop * - Set the maximum bulk output size for Sitecom U232-P25 model to 16 bytes @@ -49,7 +50,7 @@ * 08-Apr-2001 gb * - Identify version on module load. * - * 06-Jan-2001 Cornel Ciocirlan + * 06-Jan-2001 Cornel Ciocirlan * - Added support for Sitecom U232-P25 model (Product Id 0x0230) * - Added support for D-Link DU-H3SP USB BAY (Product Id 0x0200) * @@ -59,8 +60,8 @@ * (lots of things will change if/when the usb-serial core changes to * handle these issues. * - * 27-Nov-2000 Wolfgang Grandegger - * A version for kernel 2.4.0-test10 released to the Linux community + * 27-Nov-2000 Wolfgang Grandegge + * A version for kernel 2.4.0-test10 released to the Linux community * (via linux-usb-devel). */ @@ -73,7 +74,7 @@ #include <linux/tty_flip.h> #include <linux/module.h> #include <linux/spinlock.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <linux/usb.h> #include <linux/usb/serial.h> #include "mct_u232.h" @@ -90,27 +91,21 @@ static int debug; /* * Function prototypes */ -static int mct_u232_startup ...
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/mct_u232.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 7a804d6..0ded8bd 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -563,11 +563,9 @@ static void mct_u232_read_int_callback(struct urb *urb)
* Work-a-round: handle the 'usual' bulk-in pipe here
*/
if (urb->transfer_buffer_length > 2) {
- int i;
tty = port->port.tty;
if (urb->actual_length) {
- for (i = 0; i < urb->actual_length ; ++i)
- tty_insert_flip_char(tty, data[i], 0);
+ tty_insert_flip_string(tty, data, urb->actual_length);
tty_flip_buffer_push(tty);
}
goto exit;
--
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/pl2303.c | 64 ++++++++++++++++++++++++-------------------
1 files changed, 36 insertions(+), 28 deletions(-)
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 8eec785..a65328a 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -10,7 +10,8 @@
* modify it under the terms of the GNU General Public License version
* 2 as published by the Free Software Foundation.
*
- * See Documentation/usb/usb-serial.txt for more information on using this driver
+ * See Documentation/usb/usb-serial.txt for more information on using this
+ * driver
*
*/
@@ -25,7 +26,7 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/spinlock.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
#include "pl2303.h"
@@ -115,7 +116,7 @@ static struct usb_driver pl2303_driver = {
#define CONTROL_RTS 0x02
#define BREAK_REQUEST_TYPE 0x21
-#define BREAK_REQUEST 0x23
+#define BREAK_REQUEST 0x23
#define BREAK_ON 0xffff
#define BREAK_OFF 0x0000
@@ -221,7 +222,7 @@ static unsigned int pl2303_buf_data_avail(struct pl2303_buf *pb)
if (pb == NULL)
return 0;
- return ((pb->buf_size + pb->buf_put - pb->buf_get) % pb->buf_size);
+ return (pb->buf_size + pb->buf_put - pb->buf_get) % pb->buf_size;
}
/*
@@ -235,7 +236,7 @@ static unsigned int pl2303_buf_space_avail(struct pl2303_buf *pb)
if (pb == NULL)
return 0;
- return ((pb->buf_size + pb->buf_get - pb->buf_put - 1) % pb->buf_size);
+ return (pb->buf_size + pb->buf_get - pb->buf_put - 1) % pb->buf_size;
}
/*
@@ -394,7 +395,7 @@ static int pl2303_startup(struct usb_serial *serial)
cleanup:
kfree(buf);
- for (--i; i>=0; --i) {
+ for (--i; i >= 0; --i) {
priv = usb_get_serial_port_data(serial->port[i]);
pl2303_buf_free(priv->buf);
...From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/sierra.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 892020d..2f6f152 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -757,7 +757,7 @@ failed_device_register:
static void __exit sierra_exit(void)
{
- usb_deregister (&sierra_driver);
+ usb_deregister(&sierra_driver);
usb_serial_deregister(&sierra_device);
}
--
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/spcp8x5.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index 58495f5..283cf6b 100644
--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -208,7 +208,7 @@ static inline unsigned int ringbuf_avail_data(struct ringbuf *pb)
{
if (pb == NULL)
return 0;
- return ((pb->buf_size + pb->buf_put - pb->buf_get) % pb->buf_size);
+ return (pb->buf_size + pb->buf_put - pb->buf_get) % pb->buf_size;
}
/* get the number of space in the pipo */
@@ -216,7 +216,7 @@ static inline unsigned int ringbuf_avail_space(struct ringbuf *pb)
{
if (pb == NULL)
return 0;
- return ((pb->buf_size + pb->buf_get - pb->buf_put - 1) % pb->buf_size);
+ return (pb->buf_size + pb->buf_get - pb->buf_put - 1) % pb->buf_size;
}
/* put count data into pipo */
--
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/ti_usb_3410_5052.c | 270 +++++++++++++++++++--------------
1 files changed, 153 insertions(+), 117 deletions(-)
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 9f03dcd..3da1505 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -16,7 +16,7 @@
* For questions or problems with this driver, contact Texas Instruments
* technical support, or Al Borchers <alborchers@steinerpoint.com>, or
* Peter Berger <pberger@brimson.com>.
- *
+ *
* This driver needs this hotplug script in /etc/hotplug/usb/ti_usb_3410_5052
* or in /etc/hotplug.d/usb/ti_usb_3410_5052.hotplug to set the device
* configuration.
@@ -82,7 +82,7 @@
#include <linux/serial.h>
#include <linux/circ_buf.h>
#include <linux/mutex.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
@@ -158,21 +158,22 @@ struct ti_device {
static int ti_startup(struct usb_serial *serial);
static void ti_shutdown(struct usb_serial *serial);
static int ti_open(struct tty_struct *tty, struct usb_serial_port *port,
- struct file *file);
+ struct file *file);
static void ti_close(struct tty_struct *tty, struct usb_serial_port *port,
- struct file *file);
+ struct file *file);
static int ti_write(struct tty_struct *tty, struct usb_serial_port *port,
- const unsigned char *data, int count);
+ const unsigned char *data, int count);
static int ti_write_room(struct tty_struct *tty);
static int ti_chars_in_buffer(struct tty_struct *tty);
static void ti_throttle(struct tty_struct *tty);
static void ti_unthrottle(struct tty_struct *tty);
-static int ti_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg);
-static void ti_set_termios(struct tty_struct *tty, struct usb_serial_port *port,
- struct ktermios ...From: Alan Cox <alan@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/safe_serial.c | 290 +++++++++++++++++++++----------------- 1 files changed, 157 insertions(+), 133 deletions(-) diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c index f823e4d..def52d0 100644 --- a/drivers/usb/serial/safe_serial.c +++ b/drivers/usb/serial/safe_serial.c @@ -13,24 +13,25 @@ * Stuart Lynne <sl@lineo.com>, Tom Rushworth <tbr@lineo.com> */ -/* - * The encapsultaion is designed to overcome difficulties with some USB hardware. +/* + * The encapsultaion is designed to overcome difficulties with some USB + * hardware. * * While the USB protocol has a CRC over the data while in transit, i.e. while - * being carried over the bus, there is no end to end protection. If the hardware - * has any problems getting the data into or out of the USB transmit and receive - * FIFO's then data can be lost. + * being carried over the bus, there is no end to end protection. If the + * hardware has any problems getting the data into or out of the USB transmit + * and receive FIFO's then data can be lost. * - * This protocol adds a two byte trailer to each USB packet to specify the number - * of bytes of valid data and a 10 bit CRC that will allow the receiver to verify - * that the entire USB packet was received without error. + * This protocol adds a two byte trailer to each USB packet to specify the + * number of bytes of valid data and a 10 bit CRC that will allow the receiver + * to verify that the entire USB packet was received without error. * - * Because in this case the sender and receiver are the class and function drivers - * there is now end to end protection. + * Because in this case the sender and receiver are the class and function + * drivers there is now end to end protection. * - * There is an additional option that can be used to force all transmitted packets - * to be padded to the maximum packet ...
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/oti6858.c | 136 ++++++++++++++++++++++--------------------
1 files changed, 70 insertions(+), 66 deletions(-)
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index 069d276..81db571 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -25,7 +25,8 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
*
- * See Documentation/usb/usb-serial.txt for more information on using this driver
+ * See Documentation/usb/usb-serial.txt for more information on using this
+ * driver
*
* TODO:
* - implement correct flushing for ioctls and oti6858_close()
@@ -49,7 +50,7 @@
#include <linux/spinlock.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include "oti6858.h"
#define OTI6858_DESCRIPTION \
@@ -135,9 +136,9 @@ struct oti6858_control_pkt {
#define OTI6858_CTRL_PKT_SIZE sizeof(struct oti6858_control_pkt)
#define OTI6858_CTRL_EQUALS_PENDING(a, priv) \
- ( ((a)->divisor == (priv)->pending_setup.divisor) \
+ (((a)->divisor == (priv)->pending_setup.divisor) \
&& ((a)->control == (priv)->pending_setup.control) \
- && ((a)->frame_fmt == (priv)->pending_setup.frame_fmt) )
+ && ((a)->frame_fmt == (priv)->pending_setup.frame_fmt))
/* function prototypes */
static int oti6858_open(struct tty_struct *tty,
@@ -220,7 +221,7 @@ struct oti6858_private {
struct delayed_work delayed_setup_work;
wait_queue_head_t intr_wait;
- struct usb_serial_port *port; /* USB port with which associated */
+ struct usb_serial_port *port; /* USB port with which associated */
};
#undef dbg
@@ -229,7 +230,8 @@ struct oti6858_private {
static void setup_line(struct work_struct *work)
{
- struct oti6858_private *priv = container_of(work, ...From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/option.c | 65 +++++++++++++++++++++++--------------------
1 files changed, 35 insertions(+), 30 deletions(-)
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 0e60408..bc9f54f 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -43,8 +43,10 @@
#include <linux/usb/serial.h>
/* Function prototypes */
-static int option_open(struct tty_struct *tty, struct usb_serial_port *port, struct file *filp);
-static void option_close(struct tty_struct *tty, struct usb_serial_port *port, struct file *filp);
+static int option_open(struct tty_struct *tty, struct usb_serial_port *port,
+ struct file *filp);
+static void option_close(struct tty_struct *tty, struct usb_serial_port *port,
+ struct file *filp);
static int option_startup(struct usb_serial *serial);
static void option_shutdown(struct usb_serial *serial);
static int option_write_room(struct tty_struct *tty);
@@ -390,15 +392,15 @@ static int __init option_init(void)
return 0;
failed_driver_register:
- usb_serial_deregister (&option_1port_device);
+ usb_serial_deregister(&option_1port_device);
failed_1port_device_register:
return retval;
}
static void __exit option_exit(void)
{
- usb_deregister (&option_driver);
- usb_serial_deregister (&option_1port_device);
+ usb_deregister(&option_driver);
+ usb_serial_deregister(&option_1port_device);
}
module_init(option_init);
@@ -468,7 +470,7 @@ static int option_write(struct tty_struct *tty, struct usb_serial_port *port,
i = 0;
left = count;
- for (i=0; left > 0 && i < N_OUT_URB; i++) {
+ for (i = 0; left > 0 && i < N_OUT_URB; i++) {
todo = left;
if (todo > OUT_BUFLEN)
todo = OUT_BUFLEN;
@@ -489,7 +491,7 @@ static int option_write(struct tty_struct *tty, struct usb_serial_port *port,
usb_pipeendpoint(this_urb->pipe), i);
/* send the data ...From: Alan Cox <alan@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/usb/serial/omninet.c | 160 +++++++++++++++++++++++------------------- 1 files changed, 87 insertions(+), 73 deletions(-) diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 5a2d045..5a76f32 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c @@ -5,26 +5,28 @@ * modify it under the terms of the GNU General Public License version * 2 as published by the Free Software Foundation. * - * See Documentation/usb/usb-serial.txt for more information on using this driver + * See Documentation/usb/usb-serial.txt for more information on using this + * driver * * Please report both successes and troubles to the author at omninet@kroah.com - * + * * (05/30/2001) gkh - * switched from using spinlock to a semaphore, which fixes lots of problems. + * switched from using spinlock to a semaphore, which fixes lots of + * problems. * * (04/08/2001) gb * Identify version on module load. * * (11/01/2000) Adam J. Richter * usb_device_id table support - * + * * (10/05/2000) gkh * Fixed bug with urb->dev not being set properly, now that the usb * core needs it. - * + * * (08/28/2000) gkh * Added locks for SMP safeness. - * Fixed MOD_INC and MOD_DEC logic and the ability to open a port more + * Fixed MOD_INC and MOD_DEC logic and the ability to open a port more * than once. * Fixed potential race in omninet_write_bulk_callback * @@ -43,7 +45,7 @@ #include <linux/tty_flip.h> #include <linux/module.h> #include <linux/spinlock.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <linux/usb.h> #include <linux/usb/serial.h> @@ -58,25 +60,29 @@ static int debug; #define ZYXEL_VENDOR_ID 0x0586 #define ZYXEL_OMNINET_ID 0x1000 -#define BT_IGNITIONPRO_ID 0x2000 /* This one seems to be a re-branded ZyXEL device */ +/* This one seems to be a re-branded ZyXEL device ...
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/omninet.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index 5a76f32..ae8e227 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -206,8 +206,8 @@ static void omninet_read_bulk_callback(struct urb *urb)
unsigned char *data = urb->transfer_buffer;
struct omninet_header *header = (struct omninet_header *) &data[0];
int status = urb->status;
- int i;
int result;
+ int i;
dbg("%s - port %d", __func__, port->number);
@@ -229,9 +229,8 @@ static void omninet_read_bulk_callback(struct urb *urb)
}
if (urb->actual_length && header->oh_len) {
- for (i = 0; i < header->oh_len; i++)
- tty_insert_flip_char(port->port.tty,
- data[OMNINET_DATAOFFSET + i], 0);
+ tty_insert_flip_string(port->port.tty,
+ data + OMNINET_DATAOFFSET, header->oh_len);
tty_flip_buffer_push(port->port.tty);
}
--
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/mos7840.c | 400 +++++++++++++++++-------------------------
1 files changed, 164 insertions(+), 236 deletions(-)
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 2b1fded..09d8206 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -33,7 +33,7 @@
#include <linux/serial.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
/*
* Version Information
@@ -82,8 +82,8 @@
* Defines used for sending commands to port
*/
-#define WAIT_FOR_EVER (HZ * 0 ) /* timeout urb is wait for ever */
-#define MOS_WDR_TIMEOUT (HZ * 5 ) /* default urb timeout */
+#define WAIT_FOR_EVER (HZ * 0) /* timeout urb is wait for ever */
+#define MOS_WDR_TIMEOUT (HZ * 5) /* default urb timeout */
#define MOS_PORT1 0x0200
#define MOS_PORT2 0x0300
@@ -102,8 +102,8 @@
#define MAX_NAME_LEN 64
-#define ZLP_REG1 0x3A //Zero_Flag_Reg1 58
-#define ZLP_REG5 0x3E //Zero_Flag_Reg5 62
+#define ZLP_REG1 0x3A /* Zero_Flag_Reg1 58 */
+#define ZLP_REG5 0x3E /* Zero_Flag_Reg5 62 */
/* For higher baud Rates use TIOCEXBAUD */
#define TIOCEXBAUD 0x5462
@@ -142,7 +142,7 @@
#define MOS_MSR_DELTA_RI 0x40
#define MOS_MSR_DELTA_CD 0x80
-// Serial Port register Address
+/* Serial Port register Address */
#define INTERRUPT_ENABLE_REGISTER ((__u16)(0x01))
#define FIFO_CONTROL_REGISTER ((__u16)(0x02))
#define LINE_CONTROL_REGISTER ((__u16)(0x03))
@@ -201,11 +201,11 @@ struct moschip_port {
struct async_icount icount;
struct usb_serial_port *port; /* loop back to the owner of this object */
- /*Offsets */
+ /* Offsets */
__u8 SpRegOffset;
__u8 ControlRegOffset;
__u8 DcrRegOffset;
- //for processing control URBS in interrupt context
+ /* for processing control URBS in interrupt context */
...From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/whiteheat.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 0954191..afd1379 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -627,7 +627,6 @@ static int whiteheat_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
{
int retval = 0;
- struct ktermios old_term;
dbg("%s - port %d", __func__, port->number);
--
From: Alan Cox <alan@redhat.com>
Signed-off-by: Alan Cox <alan@redhat.com>
---
drivers/usb/serial/mos7720.c | 227 +++++++++++++++++++++---------------------
1 files changed, 116 insertions(+), 111 deletions(-)
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index d47f081..7c4917d 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -33,7 +33,7 @@
#include <linux/serial_reg.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
/*
@@ -64,8 +64,7 @@
#define URB_TRANSFER_BUFFER_SIZE 32 /* URB Size */
/* This structure holds all of the local port information */
-struct moschip_port
-{
+struct moschip_port {
__u8 shadowLCR; /* last LCR value received */
__u8 shadowMCR; /* last MCR value received */
__u8 shadowMSR; /* last MSR value received */
@@ -76,8 +75,7 @@ struct moschip_port
};
/* This structure holds all of the individual serial device information */
-struct moschip_serial
-{
+struct moschip_serial {
int interrupt_started;
};
@@ -88,7 +86,7 @@ static int debug;
#define MOSCHIP_DEVICE_ID_7715 0x7715
static struct usb_device_id moschip_port_id_table [] = {
- { USB_DEVICE(USB_VENDOR_ID_MOSCHIP,MOSCHIP_DEVICE_ID_7720) },
+ { USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7720) },
{ } /* terminating entry */
};
MODULE_DEVICE_TABLE(usb, moschip_port_id_table);
@@ -108,7 +106,7 @@ static void mos7720_interrupt_callback(struct urb *urb)
__u8 sp1;
__u8 sp2;
- dbg("%s"," : Entering\n");
+ dbg("%s", " : Entering\n");
switch (status) {
case 0:
@@ -208,7 +206,7 @@ static void mos7720_bulk_in_callback(struct urb *urb)
mos7720_port = urb->context;
if (!mos7720_port) {
- dbg("%s","NULL mos7720_port pointer \n");
+ dbg("%s", "NULL mos7720_port pointer \n");
return ;
}
@@ -284,17 +282,16 @@ static int send_mos_cmd(struct usb_serial *serial, __u8 request, __u16 value,
...I don't know what is more wicked, the size of this series or loading after you aimed :-) Hannes --
Ah, thanks for resending these, as they are primarily USB changes, any objection for me to take these through my USB tree? greg k-h --
None at all. I've attached 23/70 which got eaten originally by a size limit. Alan usb_serial: API all change From: Alan Cox <alan@redhat.com> USB serial likes to use port->tty back pointers for the real work it does and to do so without any actual locking. Unfortunately when you consider hangup events, hangup/parallel reopen or even worse hangup followed by parallel close events the tty->port and port->tty pointers are not guaranteed to be the same as port->tty is the active tty while tty->port is the port the tty may or may not still be attached to. So rework the entire API to pass the tty struct. For console cases we need to pass both for now. This shows up multiple drivers that immediately crash with USB console some of which have been fixed in the process. Longer term we need a proper tty as console abstraction --- drivers/usb/serial/Kconfig | 8 drivers/usb/serial/aircable.c | 19 drivers/usb/serial/airprime.c | 16 drivers/usb/serial/ark3116.c | 32 - drivers/usb/serial/belkin_sa.c | 69 - drivers/usb/serial/ch341.c | 10 drivers/usb/serial/console.c | 34 - drivers/usb/serial/cp2101.c | 73 + drivers/usb/serial/cyberjack.c | 47 - drivers/usb/serial/cypress_m8.c | 117 +- drivers/usb/serial/digi_acceleport.c | 127 +- drivers/usb/serial/empeg.c | 78 + drivers/usb/serial/ftdi_sio.c | 213 ++-- drivers/usb/serial/garmin_gps.c | 58 - drivers/usb/serial/generic.c | 39 - drivers/usb/serial/io_edgeport.c | 175 +-- drivers/usb/serial/io_fw_down3.h | 11 drivers/usb/serial/io_ti.c | 1924 +++++++++++++++------------------ drivers/usb/serial/ipaq.c | 48 - drivers/usb/serial/ipw.c | 15 drivers/usb/serial/ir-usb.c | 35 - drivers/usb/serial/iuu_phoenix.c | 43 - drivers/usb/serial/keyspan.c | 138 +- ...
The USB_SERIAL_TI_FIRMWARE bits don't seem to belong here?
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
--
> The USB_SERIAL_TI_FIRMWARE bits don't seem to belong here? They seem to have gotten merged together by accident - shouldn't do any harm and both want doing. I can take a look at splitting it if Greg wants ? Alan --
I'll look at them on Monday when I'm going through applying the series and see if it really matters or not :) thanks, greg k-h --
for everything that Alan touches in the Bluetooth drivers, you have an ack from me. I am happy if this goes in quickly and I only have to re-base my tree once. Regards Marcel --
| Greg KH | Og dreams of kernels |
| Jens Axboe | [PATCH 31/33] Fusion: sg chaining support |
| Arnd Bergmann | Re: finding your own dead "CONFIG_" variables |
| Mark Brown | [PATCH 2/2] Subject: natsemi: Allow users to disable workaround for DspCfg reset |
| Tony Breeds | [LGUEST] Look in object dir for .config |
git: | |
| Brian Downing | Re: Git in a Nutshell guide |
| John Benes | Re: master has some toys |
| Matthias Lederhofer | [PATCH 4/7] introduce GIT_WORK_TREE to specify the work tree |
| Alexander Sulfrian | [RFC/PATCH] RE: git calls SSH_ASKPASS even if DISPLAY is not set |
| Junio C Hamano | Re: Rss produced by git is not valid xml? |
| Linux Kernel Mailing List | iSeries: fix section mismatch in iseries_veth |
| Linux Kernel Mailing List | ixbge: remove TX lock and redo TX accounting. |
| Linux Kernel Mailing List | ixgbe: fix several counter register errata |
| Linux Kernel Mailing List |
