diff options
| author | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-17 11:19:57 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-17 11:19:57 -0700 |
| commit | 2d5ff9e1eb38e91b81259a7646c61890de6b360f (patch) | |
| tree | 851f1d65c9726bc2cccf99885efa8e92479cc662 | |
| parent | 0087373c250f825ce2e2bc4cf8fe9f8afbe33ce4 (diff) | |
| download | patches-2d5ff9e1eb38e91b81259a7646c61890de6b360f.tar.gz | |
bunch of usb patches
38 files changed, 6810 insertions, 0 deletions
diff --git a/driver-core/driver-core-fix-typo-in-drivers-base-core.c-for-config_module.patch b/driver-core/driver-core-fix-typo-in-drivers-base-core.c-for-config_module.patch new file mode 100644 index 00000000000000..480d1a319fdd22 --- /dev/null +++ b/driver-core/driver-core-fix-typo-in-drivers-base-core.c-for-config_module.patch @@ -0,0 +1,32 @@ +From siccegge@cs.fau.de Mon May 17 11:13:29 2010 +From: Christoph Egger <siccegge@cs.fau.de> +Date: Mon, 17 May 2010 16:57:58 +0200 +Subject: driver-core: fix Typo in drivers/base/core.c for CONFIG_MODULE +To: Greg Kroah-Hartman <gregkh@suse.de>, Kay Sievers <kay.sievers@vrfy.org>, Jan Blunck <jblunck@suse.de>, Emese Revfy <re.emese@gmail.com>, "Eric W. Biederman" <ebiederm@aristanetworks.com>, linux-kernel@vger.kernel.org +Cc: vamos@i4.informatik.uni-erlangen.de +Message-ID: <20100517145757.GA3686@faui49.informatik.uni-erlangen.de> +Content-Disposition: inline + + +In this code section the final S of CONFIG_MODULES was missed making +the whole check useless + +Signed-off-by: Christoph Egger <siccegge@cs.fau.de> +Cc: Mark McLoughlin <markmc@redhat.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/base/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -1420,7 +1420,7 @@ struct device *__root_device_register(co + return ERR_PTR(err); + } + +-#ifdef CONFIG_MODULE /* gotta find a "cleaner" way to do this */ ++#ifdef CONFIG_MODULES /* gotta find a "cleaner" way to do this */ + if (owner) { + struct module_kobject *mk = &owner->mkobj; + @@ -64,6 +64,7 @@ driver-core/sysfs-namespaces-add-a-high-level-documentation-file.patch driver-core/sysfs-don-t-use-enums-in-inline-function-declaration.patch driver-core/sysfs-add-struct-file-to-bin_attr-callbacks.patch driver-core/pci-check-caps-from-sysfs-file-open-to-read-device-dependent-config-space.patch +driver-core/driver-core-fix-typo-in-drivers-base-core.c-for-config_module.patch ##################################### # TTY patches for after 2.6.34 is out @@ -94,6 +95,7 @@ tty/tty-fix-obsolete-comment-on-tty_insert_flip_string_fixed_flag.patch tty/serial-bfin_sport_uart-use-resource-size-to-fix-off-by-one-error.patch tty/serial-isicomm-handle-running-out-of-slots.patch tty/serial-apbuart-let-boards-without-apbuart-boot.patch +tty/serial-tidy-remote_debug.patch ################################### @@ -280,6 +282,41 @@ usb/usb-ipw-reimplement-using-generic-framework.patch usb/usb-io_edgeport-use-kzalloc.patch usb/usb-cp210x-remove-redundant-disconnect.patch usb/usb-fhci-cq_get-should-check-kfifo_out-s-return-value.patch +usb/usb-mct_u232.h-checkpatch-cleanups.patch +usb/usb-belkin_sa.h-checkpatch-cleanups.patch +usb/usb-cypress_m8.h-checkpatch-cleanups.patch +usb/usb-ftdi_sio-checkpatch-cleanups.patch +usb/usb-io_edgeport-checkpatch-cleanups.patch +usb/usb-kl5kusb105.h-checkpatch-cleanups.patch +usb/usb-kobil_sct.h-checkpatch-cleanups.patch +usb/usb-pl2303.h-checkpatch-cleanups.patch +usb/usb-visor.h-checkpatch-cleanups.patch +usb/usb-usb.h-checkpatch-cleanups.patch +usb/usb-include-usb-.h-checkpatch-cleanup.patch +usb/usb-remove-match_device.patch +usb/usb-xhci-fix-compiler-warning.patch +usb/usb-option.c-olivetti-olicard100-support.patch +usb/usb-kobil-fix-memory-leak.patch +usb/usb-serial-add-special-case-for-processing-of-empty-read-urbs.patch +usb/usb-empeg-reimplement-using-generic-framework.patch +usb/usb-ipaq-reimplement-using-generic-framework.patch +usb/usb-spcp8x5-reimplement-using-generic-framework.patch +usb/usb-visor-fix-memory-leak.patch +usb/usb-visor-reimplement-using-generic-framework.patch +usb/usb-cp210x-use-generic-open-to-start-reading-from-device.patch +usb/usb-belkin_sa-minor-clean-ups.patch +usb/usb-belkin_sa-clean-up-open.patch +usb/usb-belkin_sa-implement-line-status-handling.patch +usb/usb-visor-increase-bulk-out-buffer-size.patch +usb/usb-cp210x-new-device-ids-11-new-device-ids.patch +usb/usb-gadget-use-kmemdup.patch +usb/usb-usb_debug-set-bulk-out-size-at-probe.patch +usb/usb-cypress_m8-remove-unused-drain-define.patch +usb/usb-cypress_m8-use-kfifo-to-implement-write-buffering.patch +usb/usb-oti6858-use-kfifo-to-implement-write-buffering.patch +usb/usb-oti6858-use-port-write-fifo.patch +usb/usb-usb-storage-trivial-debug-improvements.patch +usb/usb-storage-always-print-quirks.patch # this goes in last. usb/usb-remove-unused-usb_buffer_alloc-and-usb_buffer_free-macros.patch diff --git a/tty/serial-tidy-remote_debug.patch b/tty/serial-tidy-remote_debug.patch new file mode 100644 index 00000000000000..5afb8803d31202 --- /dev/null +++ b/tty/serial-tidy-remote_debug.patch @@ -0,0 +1,278 @@ +From siccegge@cs.fau.de Mon May 17 11:12:48 2010 +From: Christoph Egger <siccegge@cs.fau.de> +Date: Mon, 17 May 2010 17:25:54 +0200 +Subject: serial: Tidy REMOTE_DEBUG +To: Andrew Morton <akpm@linux-foundation.org>, Alexey Dobriyan <adobriyan@gmail.com>, Jiri Kosina <jkosina@suse.cz>, Greg Kroah-Hartman <gregkh@suse.de>, Anirban Sinha <asinha@zeugmasystems.com>, linux-kernel@vger.kernel.org +Cc: vamos@i4.informatik.uni-erlangen.de +Message-ID: <20100517152554.GB3686@faui49.informatik.uni-erlangen.de> + +REMOTE_DEBUG does already appear in 2.2 kernel sources but didn't +appear as a config Option in the initial git import 2.6.12-rc. It's +currently just used in one single place of the linux kernel and should +probably be dropped totally + +Signed-off-by: Christoph Egger <siccegge@cs.fau.de> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/char/serial167.c | 223 ----------------------------------------------- + 1 file changed, 1 insertion(+), 222 deletions(-) + +--- a/drivers/char/serial167.c ++++ b/drivers/char/serial167.c +@@ -176,23 +176,6 @@ static void config_setup(struct cyclades + static void show_status(int); + #endif + +-#ifdef CONFIG_REMOTE_DEBUG +-static void debug_setup(void); +-void queueDebugChar(int c); +-int getDebugChar(void); +- +-#define DEBUG_PORT 1 +-#define DEBUG_LEN 256 +- +-typedef struct { +- int in; +- int out; +- unsigned char buf[DEBUG_LEN]; +-} debugq; +- +-debugq debugiq; +-#endif +- + /* + * I have my own version of udelay(), as it is needed when initialising + * the chip, before the delay loop has been calibrated. Should probably +@@ -515,11 +498,6 @@ static irqreturn_t cd2401_tx_interrupt(i + /* determine the channel and change to that context */ + channel = (u_short) (base_addr[CyLICR] >> 2); + +-#ifdef CONFIG_REMOTE_DEBUG +- if (channel == DEBUG_PORT) { +- panic("TxInt on debug port!!!"); +- } +-#endif + /* validate the port number (as configured and open) */ + if ((channel < 0) || (NR_PORTS <= channel)) { + base_addr[CyIER] &= ~(CyTxMpty | CyTxRdy); +@@ -634,14 +612,6 @@ static irqreturn_t cd2401_rx_interrupt(i + info->last_active = jiffies; + save_cnt = char_count = base_addr[CyRFOC]; + +-#ifdef CONFIG_REMOTE_DEBUG +- if (channel == DEBUG_PORT) { +- while (char_count--) { +- data = base_addr[CyRDR]; +- queueDebugChar(data); +- } +- } else +-#endif + /* if there is nowhere to put the data, discard it */ + if (info->tty == 0) { + while (char_count--) { +@@ -2195,9 +2165,7 @@ static int __init serial167_init(void) + port_num++; + info++; + } +-#ifdef CONFIG_REMOTE_DEBUG +- debug_setup(); +-#endif ++ + ret = request_irq(MVME167_IRQ_SER_ERR, cd2401_rxerr_interrupt, 0, + "cd2401_errors", cd2401_rxerr_interrupt); + if (ret) { +@@ -2518,193 +2486,4 @@ static int __init serial167_console_init + + console_initcall(serial167_console_init); + +-#ifdef CONFIG_REMOTE_DEBUG +-void putDebugChar(int c) +-{ +- volatile unsigned char *base_addr = (u_char *) BASE_ADDR; +- unsigned long flags; +- volatile u_char sink; +- u_char ier; +- int port; +- +- local_irq_save(flags); +- +- /* Ensure transmitter is enabled! */ +- +- port = DEBUG_PORT; +- base_addr[CyCAR] = (u_char) port; +- while (base_addr[CyCCR]) +- ; +- base_addr[CyCCR] = CyENB_XMTR; +- +- ier = base_addr[CyIER]; +- base_addr[CyIER] = CyTxMpty; +- +- while (1) { +- if (pcc2chip[PccSCCTICR] & 0x20) { +- /* We have a Tx int. Acknowledge it */ +- sink = pcc2chip[PccTPIACKR]; +- if ((base_addr[CyLICR] >> 2) == port) { +- base_addr[CyTDR] = c; +- base_addr[CyTEOIR] = 0; +- break; +- } else +- base_addr[CyTEOIR] = CyNOTRANS; +- } +- } +- +- base_addr[CyIER] = ier; +- +- local_irq_restore(flags); +-} +- +-int getDebugChar() +-{ +- volatile unsigned char *base_addr = (u_char *) BASE_ADDR; +- unsigned long flags; +- volatile u_char sink; +- u_char ier; +- int port; +- int i, c; +- +- i = debugiq.out; +- if (i != debugiq.in) { +- c = debugiq.buf[i]; +- if (++i == DEBUG_LEN) +- i = 0; +- debugiq.out = i; +- return c; +- } +- /* OK, nothing in queue, wait in poll loop */ +- +- local_irq_save(flags); +- +- /* Ensure receiver is enabled! */ +- +- port = DEBUG_PORT; +- base_addr[CyCAR] = (u_char) port; +-#if 0 +- while (base_addr[CyCCR]) +- ; +- base_addr[CyCCR] = CyENB_RCVR; +-#endif +- ier = base_addr[CyIER]; +- base_addr[CyIER] = CyRxData; +- +- while (1) { +- if (pcc2chip[PccSCCRICR] & 0x20) { +- /* We have a Rx int. Acknowledge it */ +- sink = pcc2chip[PccRPIACKR]; +- if ((base_addr[CyLICR] >> 2) == port) { +- int cnt = base_addr[CyRFOC]; +- while (cnt-- > 0) { +- c = base_addr[CyRDR]; +- if (c == 0) +- printk +- ("!! debug char is null (cnt=%d) !!", +- cnt); +- else +- queueDebugChar(c); +- } +- base_addr[CyREOIR] = 0; +- i = debugiq.out; +- if (i == debugiq.in) +- panic("Debug input queue empty!"); +- c = debugiq.buf[i]; +- if (++i == DEBUG_LEN) +- i = 0; +- debugiq.out = i; +- break; +- } else +- base_addr[CyREOIR] = CyNOTRANS; +- } +- } +- +- base_addr[CyIER] = ier; +- +- local_irq_restore(flags); +- +- return (c); +-} +- +-void queueDebugChar(int c) +-{ +- int i; +- +- i = debugiq.in; +- debugiq.buf[i] = c; +- if (++i == DEBUG_LEN) +- i = 0; +- if (i != debugiq.out) +- debugiq.in = i; +-} +- +-static void debug_setup() +-{ +- unsigned long flags; +- volatile unsigned char *base_addr = (u_char *) BASE_ADDR; +- int i, cflag; +- +- cflag = B19200; +- +- local_irq_save(flags); +- +- for (i = 0; i < 4; i++) { +- base_addr[CyCAR] = i; +- base_addr[CyLICR] = i << 2; +- } +- +- debugiq.in = debugiq.out = 0; +- +- base_addr[CyCAR] = DEBUG_PORT; +- +- /* baud rate */ +- i = cflag & CBAUD; +- +- base_addr[CyIER] = 0; +- +- base_addr[CyCMR] = CyASYNC; +- base_addr[CyLICR] = DEBUG_PORT << 2; +- base_addr[CyLIVR] = 0x5c; +- +- /* tx and rx baud rate */ +- +- base_addr[CyTCOR] = baud_co[i]; +- base_addr[CyTBPR] = baud_bpr[i]; +- base_addr[CyRCOR] = baud_co[i] >> 5; +- base_addr[CyRBPR] = baud_bpr[i]; +- +- /* set line characteristics according configuration */ +- +- base_addr[CySCHR1] = 0; +- base_addr[CySCHR2] = 0; +- base_addr[CySCRL] = 0; +- base_addr[CySCRH] = 0; +- base_addr[CyCOR1] = Cy_8_BITS | CyPARITY_NONE; +- base_addr[CyCOR2] = 0; +- base_addr[CyCOR3] = Cy_1_STOP; +- base_addr[CyCOR4] = baud_cor4[i]; +- base_addr[CyCOR5] = 0; +- base_addr[CyCOR6] = 0; +- base_addr[CyCOR7] = 0; +- +- write_cy_cmd(base_addr, CyINIT_CHAN); +- write_cy_cmd(base_addr, CyENB_RCVR); +- +- base_addr[CyCAR] = DEBUG_PORT; /* !!! Is this needed? */ +- +- base_addr[CyRTPRL] = 2; +- base_addr[CyRTPRH] = 0; +- +- base_addr[CyMSVR1] = CyRTS; +- base_addr[CyMSVR2] = CyDTR; +- +- base_addr[CyIER] = CyRxData; +- +- local_irq_restore(flags); +- +-} /* debug_setup */ +- +-#endif +- + MODULE_LICENSE("GPL"); diff --git a/usb/usb-belkin_sa-clean-up-open.patch b/usb/usb-belkin_sa-clean-up-open.patch new file mode 100644 index 00000000000000..05d644b9f55413 --- /dev/null +++ b/usb/usb-belkin_sa-clean-up-open.patch @@ -0,0 +1,56 @@ +From jhovold@gmail.com Mon May 17 11:09:33 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sat, 15 May 2010 17:53:52 +0200 +Subject: USB: belkin_sa: clean up open +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com> +Message-ID: <1273938833-11366-11-git-send-email-jhovold@gmail.com> + + +Use generic open to submit read urb. + +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/belkin_sa.c | 21 ++++++--------------- + 1 file changed, 6 insertions(+), 15 deletions(-) + +--- a/drivers/usb/serial/belkin_sa.c ++++ b/drivers/usb/serial/belkin_sa.c +@@ -207,29 +207,20 @@ static void belkin_sa_release(struct usb + static int belkin_sa_open(struct tty_struct *tty, + struct usb_serial_port *port) + { +- int retval = 0; ++ int retval; + + dbg("%s port %d", __func__, port->number); + +- /*Start reading from the device*/ +- /* TODO: Look at possibility of submitting multiple URBs to device to +- * enhance buffering. Win trace shows 16 initial read URBs. +- */ +- port->read_urb->dev = port->serial->dev; +- retval = usb_submit_urb(port->read_urb, GFP_KERNEL); +- if (retval) { +- dev_err(&port->dev, "usb_submit_urb(read bulk) failed\n"); +- goto exit; +- } +- +- port->interrupt_in_urb->dev = port->serial->dev; + retval = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); + if (retval) { +- usb_kill_urb(port->read_urb); + dev_err(&port->dev, "usb_submit_urb(read int) failed\n"); ++ return retval; + } + +-exit: ++ retval = usb_serial_generic_open(tty, port); ++ if (retval) ++ usb_kill_urb(port->interrupt_in_urb); ++ + return retval; + } + diff --git a/usb/usb-belkin_sa-implement-line-status-handling.patch b/usb/usb-belkin_sa-implement-line-status-handling.patch new file mode 100644 index 00000000000000..74e5b99e0468ae --- /dev/null +++ b/usb/usb-belkin_sa-implement-line-status-handling.patch @@ -0,0 +1,142 @@ +From jhovold@gmail.com Mon May 17 11:09:45 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sat, 15 May 2010 17:53:53 +0200 +Subject: USB: belkin_sa: implement line status handling +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com> +Message-ID: <1273938833-11366-12-git-send-email-jhovold@gmail.com> + + +Use process_read_urb to implement line status handling. + +Compile-only tested. + +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/belkin_sa.c | 77 +++++++++++++++++++++++++++-------------- + 1 file changed, 51 insertions(+), 26 deletions(-) + +--- a/drivers/usb/serial/belkin_sa.c ++++ b/drivers/usb/serial/belkin_sa.c +@@ -3,6 +3,7 @@ + * + * Copyright (C) 2000 William Greathouse (wgreathouse@smva.com) + * Copyright (C) 2000-2001 Greg Kroah-Hartman (greg@kroah.com) ++ * Copyright (C) 2010 Johan Hovold (jhovold@gmail.com) + * + * This program is largely derived from work by the linux-usb group + * and associated source files. Please see the usb/serial files for +@@ -84,7 +85,7 @@ static int debug; + /* + * Version Information + */ +-#define DRIVER_VERSION "v1.2" ++#define DRIVER_VERSION "v1.3" + #define DRIVER_AUTHOR "William Greathouse <wgreathouse@smva.com>" + #define DRIVER_DESC "USB Belkin Serial converter driver" + +@@ -95,6 +96,7 @@ static int belkin_sa_open(struct tty_st + struct usb_serial_port *port); + static void belkin_sa_close(struct usb_serial_port *port); + static void belkin_sa_read_int_callback(struct urb *urb); ++static void belkin_sa_process_read_urb(struct urb *urb); + static void belkin_sa_set_termios(struct tty_struct *tty, + struct usb_serial_port *port, struct ktermios * old); + static void belkin_sa_break_ctl(struct tty_struct *tty, int break_state); +@@ -135,7 +137,7 @@ static struct usb_serial_driver belkin_d + .open = belkin_sa_open, + .close = belkin_sa_close, + .read_int_callback = belkin_sa_read_int_callback, +- /* How we get the status info */ ++ .process_read_urb = belkin_sa_process_read_urb, + .set_termios = belkin_sa_set_termios, + .break_ctl = belkin_sa_break_ctl, + .tiocmget = belkin_sa_tiocmget, +@@ -289,31 +291,7 @@ static void belkin_sa_read_int_callback( + else + priv->control_state &= ~TIOCM_CD; + +- /* Now to report any errors */ + priv->last_lsr = data[BELKIN_SA_LSR_INDEX]; +-#if 0 +- /* +- * fill in the flip buffer here, but I do not know the relation +- * to the current/next receive buffer or characters. I need +- * to look in to this before committing any code. +- */ +- if (priv->last_lsr & BELKIN_SA_LSR_ERR) { +- tty = tty_port_tty_get(&port->port); +- /* Overrun Error */ +- if (priv->last_lsr & BELKIN_SA_LSR_OE) { +- } +- /* Parity Error */ +- if (priv->last_lsr & BELKIN_SA_LSR_PE) { +- } +- /* Framing Error */ +- if (priv->last_lsr & BELKIN_SA_LSR_FE) { +- } +- /* Break Indicator */ +- if (priv->last_lsr & BELKIN_SA_LSR_BI) { +- } +- tty_kref_put(tty); +- } +-#endif + spin_unlock_irqrestore(&priv->lock, flags); + exit: + retval = usb_submit_urb(urb, GFP_ATOMIC); +@@ -322,6 +300,53 @@ exit: + "result %d\n", __func__, retval); + } + ++static void belkin_sa_process_read_urb(struct urb *urb) ++{ ++ struct usb_serial_port *port = urb->context; ++ struct belkin_sa_private *priv = usb_get_serial_port_data(port); ++ struct tty_struct *tty; ++ unsigned char *data = urb->transfer_buffer; ++ unsigned long flags; ++ unsigned char status; ++ char tty_flag; ++ ++ /* Update line status */ ++ tty_flag = TTY_NORMAL; ++ ++ spin_lock_irqsave(&priv->lock, flags); ++ status = priv->last_lsr; ++ priv->last_lsr &= ~BELKIN_SA_LSR_ERR; ++ spin_unlock_irqrestore(&priv->lock, flags); ++ ++ if (!urb->actual_length) ++ return; ++ ++ tty = tty_port_tty_get(&port->port); ++ if (!tty) ++ return; ++ ++ if (status & BELKIN_SA_LSR_ERR) { ++ /* Break takes precedence over parity, which takes precedence ++ * over framing errors. */ ++ if (status & BELKIN_SA_LSR_BI) ++ tty_flag = TTY_BREAK; ++ else if (status & BELKIN_SA_LSR_PE) ++ tty_flag = TTY_PARITY; ++ else if (status & BELKIN_SA_LSR_FE) ++ tty_flag = TTY_FRAME; ++ dev_dbg(&port->dev, "tty_flag = %d\n", tty_flag); ++ ++ /* Overrun is special, not associated with a char. */ ++ if (status & BELKIN_SA_LSR_OE) ++ tty_insert_flip_char(tty, 0, TTY_OVERRUN); ++ } ++ ++ tty_insert_flip_string_fixed_flag(tty, data, tty_flag, ++ urb->actual_length); ++ tty_flip_buffer_push(tty); ++ tty_kref_put(tty); ++} ++ + static void belkin_sa_set_termios(struct tty_struct *tty, + struct usb_serial_port *port, struct ktermios *old_termios) + { diff --git a/usb/usb-belkin_sa-minor-clean-ups.patch b/usb/usb-belkin_sa-minor-clean-ups.patch new file mode 100644 index 00000000000000..7824e335f89652 --- /dev/null +++ b/usb/usb-belkin_sa-minor-clean-ups.patch @@ -0,0 +1,127 @@ +From jhovold@gmail.com Mon May 17 11:09:22 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sat, 15 May 2010 17:53:51 +0200 +Subject: USB: belkin_sa: minor clean-ups +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com> +Message-ID: <1273938833-11366-10-git-send-email-jhovold@gmail.com> + + +Remove some whitepace and comments. +Clean up close. + +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/belkin_sa.c | 28 +++++++--------------------- + 1 file changed, 7 insertions(+), 21 deletions(-) + +--- a/drivers/usb/serial/belkin_sa.c ++++ b/drivers/usb/serial/belkin_sa.c +@@ -112,7 +112,6 @@ static const struct usb_device_id id_tab + { USB_DEVICE(BELKIN_DOCKSTATION_VID, BELKIN_DOCKSTATION_PID) }, + { } /* Terminating entry */ + }; +- + MODULE_DEVICE_TABLE(usb, id_table_combined); + + static struct usb_driver belkin_driver = { +@@ -120,7 +119,7 @@ static struct usb_driver belkin_driver = + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table_combined, +- .no_dynamic_id = 1, ++ .no_dynamic_id = 1, + }; + + /* All of the device info needed for the serial converters */ +@@ -145,7 +144,6 @@ static struct usb_serial_driver belkin_d + .release = belkin_sa_release, + }; + +- + struct belkin_sa_private { + spinlock_t lock; + unsigned long control_state; +@@ -196,23 +194,17 @@ static int belkin_sa_startup(struct usb_ + return 0; + } + +- + static void belkin_sa_release(struct usb_serial *serial) + { +- struct belkin_sa_private *priv; + int i; + + dbg("%s", __func__); + +- for (i = 0; i < serial->num_ports; ++i) { +- /* My special items, the standard routines free my urbs */ +- priv = usb_get_serial_port_data(serial->port[i]); +- kfree(priv); +- } ++ for (i = 0; i < serial->num_ports; ++i) ++ kfree(usb_get_serial_port_data(serial->port[i])); + } + +- +-static int belkin_sa_open(struct tty_struct *tty, ++static int belkin_sa_open(struct tty_struct *tty, + struct usb_serial_port *port) + { + int retval = 0; +@@ -239,8 +231,7 @@ static int belkin_sa_open(struct tty_st + + exit: + return retval; +-} /* belkin_sa_open */ +- ++} + + static void belkin_sa_close(struct usb_serial_port *port) + { +@@ -248,8 +239,7 @@ static void belkin_sa_close(struct usb_s + + usb_serial_generic_close(port); + usb_kill_urb(port->interrupt_in_urb); +-} /* belkin_sa_close */ +- ++} + + static void belkin_sa_read_int_callback(struct urb *urb) + { +@@ -480,8 +470,7 @@ static void belkin_sa_set_termios(struct + spin_lock_irqsave(&priv->lock, flags); + priv->control_state = control_state; + spin_unlock_irqrestore(&priv->lock, flags); +-} /* belkin_sa_set_termios */ +- ++} + + static void belkin_sa_break_ctl(struct tty_struct *tty, int break_state) + { +@@ -492,7 +481,6 @@ static void belkin_sa_break_ctl(struct t + dev_err(&port->dev, "Set break_ctl %d\n", break_state); + } + +- + static int belkin_sa_tiocmget(struct tty_struct *tty, struct file *file) + { + struct usb_serial_port *port = tty->driver_data; +@@ -509,7 +497,6 @@ static int belkin_sa_tiocmget(struct tty + return control_state; + } + +- + static int belkin_sa_tiocmset(struct tty_struct *tty, struct file *file, + unsigned int set, unsigned int clear) + { +@@ -581,7 +568,6 @@ failed_usb_serial_register: + return retval; + } + +- + static void __exit belkin_sa_exit (void) + { + usb_deregister(&belkin_driver); diff --git a/usb/usb-belkin_sa.h-checkpatch-cleanups.patch b/usb/usb-belkin_sa.h-checkpatch-cleanups.patch new file mode 100644 index 00000000000000..db8e43a35d0e73 --- /dev/null +++ b/usb/usb-belkin_sa.h-checkpatch-cleanups.patch @@ -0,0 +1,39 @@ +From foo@baz Mon May 17 10:33:41 PDT 2010 +Date: Mon, 17 May 2010 10:33:41 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: USB: belkin_sa.h: checkpatch cleanups + +Minor whitespace cleanups to make checkpatch happy. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/usb/serial/belkin_sa.h | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/usb/serial/belkin_sa.h ++++ b/drivers/usb/serial/belkin_sa.h +@@ -8,10 +8,10 @@ + * 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. ++ * 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 +@@ -66,7 +66,7 @@ + #ifdef WHEN_I_LEARN_THIS + #define BELKIN_SA_SET_MAGIC_REQUEST 17 /* I don't know, possibly flush */ + /* (always in Wininit sequence before flow control) */ +-#define BELKIN_SA_RESET xx /* Reset the port */ ++#define BELKIN_SA_RESET xx /* Reset the port */ + #define BELKIN_SA_GET_MODEM_STATUS xx /* Force return of modem status register */ + #endif + diff --git a/usb/usb-cp210x-new-device-ids-11-new-device-ids.patch b/usb/usb-cp210x-new-device-ids-11-new-device-ids.patch new file mode 100644 index 00000000000000..e97a374268ec64 --- /dev/null +++ b/usb/usb-cp210x-new-device-ids-11-new-device-ids.patch @@ -0,0 +1,75 @@ +From craig@microtron.org.uk Mon May 17 11:10:11 2010 +From: Craig Shelley <craig@microtron.org.uk> +Date: Sat, 15 May 2010 13:36:38 +0100 +Subject: USB: CP210x New Device IDs 11 New device IDs +To: greg@kroah.com +Cc: linux-usb@vger.kernel.org +Message-ID: <1273927209179538039@teratron> + + + +Signed-off-by: Craig Shelley <craig@microtron.org.uk> +Cc: stable <stable@kernel.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/cp210x.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/usb/serial/cp210x.c ++++ b/drivers/usb/serial/cp210x.c +@@ -59,6 +59,8 @@ static const struct usb_device_id id_tab + { USB_DEVICE(0x0745, 0x1000) }, /* CipherLab USB CCD Barcode Scanner 1000 */ + { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ + { USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */ ++ { USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */ ++ { USB_DEVICE(0x0BED, 0x1101) }, /* MEI series 2000 Combo Acceptor */ + { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ + { USB_DEVICE(0x0FCF, 0x1004) }, /* Dynastream ANT2USB */ + { USB_DEVICE(0x0FCF, 0x1006) }, /* Dynastream ANT development board */ +@@ -70,9 +72,12 @@ static const struct usb_device_id id_tab + { USB_DEVICE(0x10C4, 0x1601) }, /* Arkham Technology DS101 Adapter */ + { USB_DEVICE(0x10C4, 0x800A) }, /* SPORTident BSM7-D-USB main station */ + { USB_DEVICE(0x10C4, 0x803B) }, /* Pololu USB-serial converter */ ++ { USB_DEVICE(0x10C4, 0x8044) }, /* Cygnal Debug Adapter */ ++ { USB_DEVICE(0x10C4, 0x804E) }, /* Software Bisque Paramount ME build-in converter */ + { USB_DEVICE(0x10C4, 0x8053) }, /* Enfora EDG1228 */ + { USB_DEVICE(0x10C4, 0x8054) }, /* Enfora GSM2228 */ + { USB_DEVICE(0x10C4, 0x8066) }, /* Argussoft In-System Programmer */ ++ { USB_DEVICE(0x10C4, 0x806F) }, /* IMS USB to RS422 Converter Cable */ + { USB_DEVICE(0x10C4, 0x807A) }, /* Crumb128 board */ + { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ + { USB_DEVICE(0x10C4, 0x80DD) }, /* Tracient RFID */ +@@ -80,12 +85,15 @@ static const struct usb_device_id id_tab + { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */ + { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ + { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ ++ { USB_DEVICE(0x10C4, 0x8149) }, /* West Mountain Radio Computerized Battery Analyzer */ + { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ + { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ + { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ ++ { USB_DEVICE(0x10C4, 0x818B) }, /* AVIT Research USB to TTL */ + { USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */ + { USB_DEVICE(0x10C4, 0x81A6) }, /* ThinkOptics WavIt */ + { USB_DEVICE(0x10C4, 0x81AC) }, /* MSD Dash Hawk */ ++ { USB_DEVICE(0x10C4, 0x81AD) }, /* INSYS USB Modem */ + { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */ + { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */ + { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */ +@@ -103,6 +111,7 @@ static const struct usb_device_id id_tab + { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ + { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ + { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ ++ { USB_DEVICE(0x10C4, 0xEA71) }, /* Infinity GPS-MIC-1 Radio Monophone */ + { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */ + { USB_DEVICE(0x10C4, 0xF002) }, /* Elan Digital Systems USBwave12 */ + { USB_DEVICE(0x10C4, 0xF003) }, /* Elan Digital Systems USBpulse100 */ +@@ -113,6 +122,8 @@ static const struct usb_device_id id_tab + { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ + { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */ + { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ ++ { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */ ++ { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ + { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ + { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ + { } /* Terminating Entry */ diff --git a/usb/usb-cp210x-use-generic-open-to-start-reading-from-device.patch b/usb/usb-cp210x-use-generic-open-to-start-reading-from-device.patch new file mode 100644 index 00000000000000..6222d4c052f549 --- /dev/null +++ b/usb/usb-cp210x-use-generic-open-to-start-reading-from-device.patch @@ -0,0 +1,28 @@ +From jhovold@gmail.com Mon May 17 11:09:09 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sat, 15 May 2010 17:53:50 +0200 +Subject: USB: cp210x: use generic open to start reading from device +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com> +Message-ID: <1273938833-11366-9-git-send-email-jhovold@gmail.com> + + + +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/cp210x.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/serial/cp210x.c ++++ b/drivers/usb/serial/cp210x.c +@@ -379,7 +379,7 @@ static int cp210x_open(struct tty_struct + return -EPROTO; + } + +- result = usb_serial_generic_submit_read_urb(port, GFP_KERNEL); ++ result = usb_serial_generic_open(tty, port); + if (result) + return result; + diff --git a/usb/usb-cypress_m8-remove-unused-drain-define.patch b/usb/usb-cypress_m8-remove-unused-drain-define.patch new file mode 100644 index 00000000000000..829dfaddccac5d --- /dev/null +++ b/usb/usb-cypress_m8-remove-unused-drain-define.patch @@ -0,0 +1,28 @@ +From jhovold@gmail.com Mon May 17 11:14:15 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sun, 16 May 2010 20:33:49 +0200 +Subject: USB: cypress_m8: remove unused drain define +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com> +Message-ID: <1274034832-27301-3-git-send-email-jhovold@gmail.com> + + +Driver uses tty-port drain these days. + +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/cypress_m8.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/usb/serial/cypress_m8.c ++++ b/drivers/usb/serial/cypress_m8.c +@@ -85,7 +85,6 @@ static int unstable_bauds; + + /* write buffer size defines */ + #define CYPRESS_BUF_SIZE 1024 +-#define CYPRESS_CLOSING_WAIT (30*HZ) + + static const struct usb_device_id id_table_earthmate[] = { + { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB) }, diff --git a/usb/usb-cypress_m8-use-kfifo-to-implement-write-buffering.patch b/usb/usb-cypress_m8-use-kfifo-to-implement-write-buffering.patch new file mode 100644 index 00000000000000..056112f66175ee --- /dev/null +++ b/usb/usb-cypress_m8-use-kfifo-to-implement-write-buffering.patch @@ -0,0 +1,373 @@ +From jhovold@gmail.com Mon May 17 11:14:27 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sun, 16 May 2010 20:33:50 +0200 +Subject: USB: cypress_m8: use kfifo to implement write buffering +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com> +Message-ID: <1274034832-27301-4-git-send-email-jhovold@gmail.com> + + +Kill custom fifo implementation. + +Note that cypress_m8 has no port write fifo as it has no bulk-out +endpoint. + +Compile-only tested. + +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/cypress_m8.c | 239 ++-------------------------------------- + 1 file changed, 17 insertions(+), 222 deletions(-) + +--- a/drivers/usb/serial/cypress_m8.c ++++ b/drivers/usb/serial/cypress_m8.c +@@ -64,6 +64,7 @@ + #include <linux/usb.h> + #include <linux/usb/serial.h> + #include <linux/serial.h> ++#include <linux/kfifo.h> + #include <linux/delay.h> + #include <linux/uaccess.h> + #include <asm/unaligned.h> +@@ -79,7 +80,7 @@ static int unstable_bauds; + /* + * Version Information + */ +-#define DRIVER_VERSION "v1.09" ++#define DRIVER_VERSION "v1.10" + #define DRIVER_AUTHOR "Lonnie Mendez <dignome@gmail.com>, Neil Whelchel <koyama@firstlight.net>" + #define DRIVER_DESC "Cypress USB to Serial Driver" + +@@ -134,7 +135,7 @@ struct cypress_private { + int bytes_out; /* used for statistics */ + int cmd_count; /* used for statistics */ + int cmd_ctrl; /* always set this to 1 before issuing a command */ +- struct cypress_buf *buf; /* write buffer */ ++ struct kfifo write_fifo; /* write fifo */ + int write_urb_in_use; /* write urb in use indicator */ + int write_urb_interval; /* interval to use for write urb */ + int read_urb_interval; /* interval to use for read urb */ +@@ -156,14 +157,6 @@ struct cypress_private { + struct ktermios tmp_termios; /* stores the old termios settings */ + }; + +-/* write buffer structure */ +-struct cypress_buf { +- unsigned int buf_size; +- char *buf_buf; +- char *buf_get; +- char *buf_put; +-}; +- + /* function prototypes for the Cypress USB to serial device */ + static int cypress_earthmate_startup(struct usb_serial *serial); + static int cypress_hidcom_startup(struct usb_serial *serial); +@@ -189,17 +182,6 @@ static void cypress_unthrottle(struct tt + static void cypress_set_dead(struct usb_serial_port *port); + static void cypress_read_int_callback(struct urb *urb); + static void cypress_write_int_callback(struct urb *urb); +-/* write buffer functions */ +-static struct cypress_buf *cypress_buf_alloc(unsigned int size); +-static void cypress_buf_free(struct cypress_buf *cb); +-static void cypress_buf_clear(struct cypress_buf *cb); +-static unsigned int cypress_buf_data_avail(struct cypress_buf *cb); +-static unsigned int cypress_buf_space_avail(struct cypress_buf *cb); +-static unsigned int cypress_buf_put(struct cypress_buf *cb, +- const char *buf, unsigned int count); +-static unsigned int cypress_buf_get(struct cypress_buf *cb, +- char *buf, unsigned int count); +- + + static struct usb_serial_driver cypress_earthmate_device = { + .driver = { +@@ -502,8 +484,7 @@ static int generic_startup(struct usb_se + + priv->comm_is_ok = !0; + spin_lock_init(&priv->lock); +- priv->buf = cypress_buf_alloc(CYPRESS_BUF_SIZE); +- if (priv->buf == NULL) { ++ if (kfifo_alloc(&priv->write_fifo, CYPRESS_BUF_SIZE, GFP_KERNEL)) { + kfree(priv); + return -ENOMEM; + } +@@ -626,7 +607,7 @@ static void cypress_release(struct usb_s + priv = usb_get_serial_port_data(serial->port[0]); + + if (priv) { +- cypress_buf_free(priv->buf); ++ kfifo_free(&priv->write_fifo); + kfree(priv); + } + } +@@ -703,6 +684,7 @@ static void cypress_dtr_rts(struct usb_s + static void cypress_close(struct usb_serial_port *port) + { + struct cypress_private *priv = usb_get_serial_port_data(port); ++ unsigned long flags; + + dbg("%s - port %d", __func__, port->number); + +@@ -712,12 +694,14 @@ static void cypress_close(struct usb_ser + mutex_unlock(&port->serial->disc_mutex); + return; + } +- cypress_buf_clear(priv->buf); ++ spin_lock_irqsave(&priv->lock, flags); ++ kfifo_reset_out(&priv->write_fifo); ++ spin_unlock_irqrestore(&priv->lock, flags); ++ + dbg("%s - stopping urbs", __func__); + usb_kill_urb(port->interrupt_in_urb); + usb_kill_urb(port->interrupt_out_urb); + +- + if (stats) + dev_info(&port->dev, "Statistics: %d Bytes In | %d Bytes Out | %d Commands Issued\n", + priv->bytes_in, priv->bytes_out, priv->cmd_count); +@@ -729,7 +713,6 @@ static int cypress_write(struct tty_stru + const unsigned char *buf, int count) + { + struct cypress_private *priv = usb_get_serial_port_data(port); +- unsigned long flags; + + dbg("%s - port %d, %d bytes", __func__, port->number, count); + +@@ -744,9 +727,7 @@ static int cypress_write(struct tty_stru + if (!count) + return count; + +- spin_lock_irqsave(&priv->lock, flags); +- count = cypress_buf_put(priv->buf, buf, count); +- spin_unlock_irqrestore(&priv->lock, flags); ++ count = kfifo_in_locked(&priv->write_fifo, buf, count, &priv->lock); + + finish: + cypress_send(port); +@@ -806,9 +787,10 @@ static void cypress_send(struct usb_seri + } else + spin_unlock_irqrestore(&priv->lock, flags); + +- count = cypress_buf_get(priv->buf, &port->interrupt_out_buffer[offset], +- port->interrupt_out_size-offset); +- ++ count = kfifo_out_locked(&priv->write_fifo, ++ &port->interrupt_out_buffer[offset], ++ port->interrupt_out_size - offset, ++ &priv->lock); + if (count == 0) + return; + +@@ -874,7 +856,7 @@ static int cypress_write_room(struct tty + dbg("%s - port %d", __func__, port->number); + + spin_lock_irqsave(&priv->lock, flags); +- room = cypress_buf_space_avail(priv->buf); ++ room = kfifo_avail(&priv->write_fifo); + spin_unlock_irqrestore(&priv->lock, flags); + + dbg("%s - returns %d", __func__, room); +@@ -1142,7 +1124,7 @@ static int cypress_chars_in_buffer(struc + dbg("%s - port %d", __func__, port->number); + + spin_lock_irqsave(&priv->lock, flags); +- chars = cypress_buf_data_avail(priv->buf); ++ chars = kfifo_len(&priv->write_fifo); + spin_unlock_irqrestore(&priv->lock, flags); + + dbg("%s - returns %d", __func__, chars); +@@ -1396,193 +1378,6 @@ static void cypress_write_int_callback(s + + + /***************************************************************************** +- * Write buffer functions - buffering code from pl2303 used +- *****************************************************************************/ +- +-/* +- * cypress_buf_alloc +- * +- * Allocate a circular buffer and all associated memory. +- */ +- +-static struct cypress_buf *cypress_buf_alloc(unsigned int size) +-{ +- +- struct cypress_buf *cb; +- +- +- if (size == 0) +- return NULL; +- +- cb = kmalloc(sizeof(struct cypress_buf), GFP_KERNEL); +- if (cb == NULL) +- return NULL; +- +- cb->buf_buf = kmalloc(size, GFP_KERNEL); +- if (cb->buf_buf == NULL) { +- kfree(cb); +- return NULL; +- } +- +- cb->buf_size = size; +- cb->buf_get = cb->buf_put = cb->buf_buf; +- +- return cb; +- +-} +- +- +-/* +- * cypress_buf_free +- * +- * Free the buffer and all associated memory. +- */ +- +-static void cypress_buf_free(struct cypress_buf *cb) +-{ +- if (cb) { +- kfree(cb->buf_buf); +- kfree(cb); +- } +-} +- +- +-/* +- * cypress_buf_clear +- * +- * Clear out all data in the circular buffer. +- */ +- +-static void cypress_buf_clear(struct cypress_buf *cb) +-{ +- if (cb != NULL) +- cb->buf_get = cb->buf_put; +- /* equivalent to a get of all data available */ +-} +- +- +-/* +- * cypress_buf_data_avail +- * +- * Return the number of bytes of data available in the circular +- * buffer. +- */ +- +-static unsigned int cypress_buf_data_avail(struct cypress_buf *cb) +-{ +- if (cb != NULL) +- return (cb->buf_size + cb->buf_put - cb->buf_get) +- % cb->buf_size; +- else +- return 0; +-} +- +- +-/* +- * cypress_buf_space_avail +- * +- * Return the number of bytes of space available in the circular +- * buffer. +- */ +- +-static unsigned int cypress_buf_space_avail(struct cypress_buf *cb) +-{ +- if (cb != NULL) +- return (cb->buf_size + cb->buf_get - cb->buf_put - 1) +- % cb->buf_size; +- else +- return 0; +-} +- +- +-/* +- * cypress_buf_put +- * +- * Copy data data from a user buffer and put it into the circular buffer. +- * Restrict to the amount of space available. +- * +- * Return the number of bytes copied. +- */ +- +-static unsigned int cypress_buf_put(struct cypress_buf *cb, const char *buf, +- unsigned int count) +-{ +- +- unsigned int len; +- +- +- if (cb == NULL) +- return 0; +- +- len = cypress_buf_space_avail(cb); +- if (count > len) +- count = len; +- +- if (count == 0) +- return 0; +- +- len = cb->buf_buf + cb->buf_size - cb->buf_put; +- if (count > len) { +- memcpy(cb->buf_put, buf, len); +- memcpy(cb->buf_buf, buf+len, count - len); +- cb->buf_put = cb->buf_buf + count - len; +- } else { +- memcpy(cb->buf_put, buf, count); +- if (count < len) +- cb->buf_put += count; +- else /* count == len */ +- cb->buf_put = cb->buf_buf; +- } +- +- return count; +- +-} +- +- +-/* +- * cypress_buf_get +- * +- * Get data from the circular buffer and copy to the given buffer. +- * Restrict to the amount of data available. +- * +- * Return the number of bytes copied. +- */ +- +-static unsigned int cypress_buf_get(struct cypress_buf *cb, char *buf, +- unsigned int count) +-{ +- +- unsigned int len; +- +- +- if (cb == NULL) +- return 0; +- +- len = cypress_buf_data_avail(cb); +- if (count > len) +- count = len; +- +- if (count == 0) +- return 0; +- +- len = cb->buf_buf + cb->buf_size - cb->buf_get; +- if (count > len) { +- memcpy(buf, cb->buf_get, len); +- memcpy(buf+len, cb->buf_buf, count - len); +- cb->buf_get = cb->buf_buf + count - len; +- } else { +- memcpy(buf, cb->buf_get, count); +- if (count < len) +- cb->buf_get += count; +- else /* count == len */ +- cb->buf_get = cb->buf_buf; +- } +- +- return count; +- +-} +- +-/***************************************************************************** + * Module functions + *****************************************************************************/ + diff --git a/usb/usb-cypress_m8.h-checkpatch-cleanups.patch b/usb/usb-cypress_m8.h-checkpatch-cleanups.patch new file mode 100644 index 00000000000000..793b1c53311325 --- /dev/null +++ b/usb/usb-cypress_m8.h-checkpatch-cleanups.patch @@ -0,0 +1,106 @@ +From foo@baz Mon May 17 10:33:41 PDT 2010 +Date: Mon, 17 May 2010 10:33:41 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: USB: cypress_m8.h: checkpatch cleanups + +Minor whitespace cleanups to make checkpatch happy. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/usb/serial/cypress_m8.h | 53 +++++++++++++++++++++------------------- + 1 file changed, 29 insertions(+), 24 deletions(-) + +--- a/drivers/usb/serial/cypress_m8.h ++++ b/drivers/usb/serial/cypress_m8.h +@@ -1,27 +1,32 @@ + #ifndef CYPRESS_M8_H + #define CYPRESS_M8_H + +-/* definitions and function prototypes used for the cypress USB to Serial controller */ ++/* ++ * definitions and function prototypes used for the cypress USB to Serial ++ * controller ++ */ + +-/* For sending our feature buffer - controlling serial communication states */ +-/* Linux HID has no support for serial devices so we do this through the driver */ +-#define HID_REQ_GET_REPORT 0x01 +-#define HID_REQ_SET_REPORT 0x09 ++/* ++ * For sending our feature buffer - controlling serial communication states. ++ * Linux HID has no support for serial devices so we do this through the driver ++ */ ++#define HID_REQ_GET_REPORT 0x01 ++#define HID_REQ_SET_REPORT 0x09 + + /* List other cypress USB to Serial devices here, and add them to the id_table */ + + /* DeLorme Earthmate USB - a GPS device */ +-#define VENDOR_ID_DELORME 0x1163 +-#define PRODUCT_ID_EARTHMATEUSB 0x0100 +-#define PRODUCT_ID_EARTHMATEUSB_LT20 0x0200 ++#define VENDOR_ID_DELORME 0x1163 ++#define PRODUCT_ID_EARTHMATEUSB 0x0100 ++#define PRODUCT_ID_EARTHMATEUSB_LT20 0x0200 + + /* Cypress HID->COM RS232 Adapter */ +-#define VENDOR_ID_CYPRESS 0x04b4 +-#define PRODUCT_ID_CYPHIDCOM 0x5500 ++#define VENDOR_ID_CYPRESS 0x04b4 ++#define PRODUCT_ID_CYPHIDCOM 0x5500 + + /* Powercom UPS, chip CY7C63723 */ +-#define VENDOR_ID_POWERCOM 0x0d9f +-#define PRODUCT_ID_UPS 0x0002 ++#define VENDOR_ID_POWERCOM 0x0d9f ++#define PRODUCT_ID_UPS 0x0002 + + /* Nokia CA-42 USB to serial cable */ + #define VENDOR_ID_DAZZLE 0x07d0 +@@ -29,17 +34,17 @@ + /* End of device listing */ + + /* Used for setting / requesting serial line settings */ +-#define CYPRESS_SET_CONFIG 0x01 +-#define CYPRESS_GET_CONFIG 0x02 ++#define CYPRESS_SET_CONFIG 0x01 ++#define CYPRESS_GET_CONFIG 0x02 + + /* Used for throttle control */ +-#define THROTTLED 0x1 +-#define ACTUALLY_THROTTLED 0x2 ++#define THROTTLED 0x1 ++#define ACTUALLY_THROTTLED 0x2 + +-/* chiptypes - used in case firmware differs from the generic form ... offering +- * different baud speeds/etc. ++/* ++ * chiptypes - used in case firmware differs from the generic form ... offering ++ * different baud speeds/etc. + */ +- + #define CT_EARTHMATE 0x01 + #define CT_CYPHIDCOM 0x02 + #define CT_CA42V2 0x03 +@@ -50,15 +55,15 @@ + /* these are sent / read at byte 0 of the input/output hid reports */ + /* You can find these values defined in the CY4601 USB to Serial design notes */ + +-#define CONTROL_DTR 0x20 /* data terminal ready - flow control - host to device */ ++#define CONTROL_DTR 0x20 /* data terminal ready - flow control - host to device */ + #define UART_DSR 0x20 /* data set ready - flow control - device to host */ +-#define CONTROL_RTS 0x10 /* request to send - flow control - host to device */ ++#define CONTROL_RTS 0x10 /* request to send - flow control - host to device */ + #define UART_CTS 0x10 /* clear to send - flow control - device to host */ +-#define UART_RI 0x10 /* ring indicator - modem - device to host */ ++#define UART_RI 0x10 /* ring indicator - modem - device to host */ + #define UART_CD 0x40 /* carrier detect - modem - device to host */ +-#define CYP_ERROR 0x08 /* received from input report - device to host */ ++#define CYP_ERROR 0x08 /* received from input report - device to host */ + /* Note - the below has nothing to do with the "feature report" reset */ +-#define CONTROL_RESET 0x08 /* sent with output report - host to device */ ++#define CONTROL_RESET 0x08 /* sent with output report - host to device */ + + /* End of RS-232 protocol definitions */ + diff --git a/usb/usb-empeg-reimplement-using-generic-framework.patch b/usb/usb-empeg-reimplement-using-generic-framework.patch new file mode 100644 index 00000000000000..f5b605b61dc4ca --- /dev/null +++ b/usb/usb-empeg-reimplement-using-generic-framework.patch @@ -0,0 +1,501 @@ +From jhovold@gmail.com Mon May 17 11:07:31 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sat, 15 May 2010 17:53:45 +0200 +Subject: USB: empeg: reimplement using generic framework +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com> +Message-ID: <1273938833-11366-4-git-send-email-jhovold@gmail.com> + + +Kill custom read and write implementations (static 16*4k write-urb pool +shared among all ports in system). + +Also remove old changelog entries in header (code is now gone, and +these entries can still be retrieved through git). + +Compile-only tested. + +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/empeg.c | 401 +-------------------------------------------- + 1 file changed, 13 insertions(+), 388 deletions(-) + +--- a/drivers/usb/serial/empeg.c ++++ b/drivers/usb/serial/empeg.c +@@ -13,44 +13,6 @@ + * + * 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(). +- * +- * (05/30/2001) gkh +- * 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. +- * +- * (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 tty->ldisc.set_termios(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 - Doh!) +- * +- * (11/11/2000) gb +- * Updated to work with id_table structure. +- * +- * (11/04/2000) gb +- * Forked this from visor.c, and hacked it up to work with an +- * Empeg ltd. empeg-car player. Constructive criticism welcomed. +- * I would like to say, 'Thank You' to Greg Kroah-Hartman for the +- * use of his code, and for his guidance, advice and patience. :) +- * A 'Thank You' is in order for John Ripley of Empeg ltd for his +- * advice, and patience too. +- * + */ + + #include <linux/kernel.h> +@@ -71,7 +33,7 @@ static int debug; + /* + * Version Information + */ +-#define DRIVER_VERSION "v1.2" ++#define DRIVER_VERSION "v1.3" + #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Gary Brubaker <xavyer@ix.netcom.com>" + #define DRIVER_DESC "USB Empeg Mark I/II Driver" + +@@ -79,19 +41,8 @@ static int debug; + #define EMPEG_PRODUCT_ID 0x0001 + + /* function prototypes for an empeg-car player */ +-static int empeg_open(struct tty_struct *tty, struct usb_serial_port *port); +-static void empeg_close(struct usb_serial_port *port); +-static int empeg_write(struct tty_struct *tty, struct usb_serial_port *port, +- const unsigned char *buf, +- int count); +-static int empeg_write_room(struct tty_struct *tty); +-static int empeg_chars_in_buffer(struct tty_struct *tty); +-static void empeg_throttle(struct tty_struct *tty); +-static void empeg_unthrottle(struct tty_struct *tty); + static int empeg_startup(struct usb_serial *serial); + static void empeg_init_termios(struct tty_struct *tty); +-static void empeg_write_bulk_callback(struct urb *urb); +-static void empeg_read_bulk_callback(struct urb *urb); + + static const struct usb_device_id id_table[] = { + { USB_DEVICE(EMPEG_VENDOR_ID, EMPEG_PRODUCT_ID) }, +@@ -105,7 +56,7 @@ static struct usb_driver empeg_driver = + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table, +- .no_dynamic_id = 1, ++ .no_dynamic_id = 1, + }; + + static struct usb_serial_driver empeg_device = { +@@ -114,291 +65,16 @@ static struct usb_serial_driver empeg_de + .name = "empeg", + }, + .id_table = id_table, +- .usb_driver = &empeg_driver, ++ .usb_driver = &empeg_driver, + .num_ports = 1, +- .open = empeg_open, +- .close = empeg_close, +- .throttle = empeg_throttle, +- .unthrottle = empeg_unthrottle, ++ .bulk_out_size = 256, ++ .throttle = usb_serial_generic_throttle, ++ .unthrottle = usb_serial_generic_unthrottle, + .attach = empeg_startup, + .init_termios = empeg_init_termios, +- .write = empeg_write, +- .write_room = empeg_write_room, +- .chars_in_buffer = empeg_chars_in_buffer, +- .write_bulk_callback = empeg_write_bulk_callback, +- .read_bulk_callback = empeg_read_bulk_callback, + }; + +-#define NUM_URBS 16 +-#define URB_TRANSFER_BUFFER_SIZE 4096 +- +-static struct urb *write_urb_pool[NUM_URBS]; +-static spinlock_t write_urb_pool_lock; +-static int bytes_in; +-static int bytes_out; +- +-/****************************************************************************** +- * Empeg specific driver functions +- ******************************************************************************/ +-static int empeg_open(struct tty_struct *tty,struct usb_serial_port *port) +-{ +- struct usb_serial *serial = port->serial; +- int result = 0; +- +- dbg("%s - port %d", __func__, port->number); +- +- bytes_in = 0; +- bytes_out = 0; +- +- /* Start reading from the device */ +- usb_fill_bulk_urb( +- port->read_urb, +- serial->dev, +- usb_rcvbulkpipe(serial->dev, +- port->bulk_in_endpointAddress), +- port->read_urb->transfer_buffer, +- port->read_urb->transfer_buffer_length, +- empeg_read_bulk_callback, +- port); +- +- result = usb_submit_urb(port->read_urb, GFP_KERNEL); +- +- if (result) +- dev_err(&port->dev, +- "%s - failed submitting read urb, error %d\n", +- __func__, result); +- +- return result; +-} +- +- +-static void empeg_close(struct usb_serial_port *port) +-{ +- dbg("%s - port %d", __func__, port->number); +- +- /* shutdown our bulk read */ +- usb_kill_urb(port->read_urb); +- /* Uncomment the following line if you want to see some statistics in your syslog */ +- /* dev_info (&port->dev, "Bytes In = %d Bytes Out = %d\n", bytes_in, bytes_out); */ +-} +- +- +-static int empeg_write(struct tty_struct *tty, struct usb_serial_port *port, +- const unsigned char *buf, int count) +-{ +- struct usb_serial *serial = port->serial; +- struct urb *urb; +- const unsigned char *current_position = buf; +- unsigned long flags; +- int status; +- int i; +- int bytes_sent = 0; +- int transfer_size; +- +- dbg("%s - port %d", __func__, port->number); +- +- while (count > 0) { +- /* try to find a free urb in our list of them */ +- urb = NULL; +- +- spin_lock_irqsave(&write_urb_pool_lock, flags); +- +- for (i = 0; i < NUM_URBS; ++i) { +- if (write_urb_pool[i]->status != -EINPROGRESS) { +- urb = write_urb_pool[i]; +- break; +- } +- } +- +- spin_unlock_irqrestore(&write_urb_pool_lock, flags); +- +- if (urb == NULL) { +- dbg("%s - no more free urbs", __func__); +- goto exit; +- } +- +- if (urb->transfer_buffer == NULL) { +- urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_ATOMIC); +- if (urb->transfer_buffer == NULL) { +- dev_err(&port->dev, +- "%s no more kernel memory...\n", +- __func__); +- goto exit; +- } +- } +- +- transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE); +- +- memcpy(urb->transfer_buffer, current_position, transfer_size); +- +- usb_serial_debug_data(debug, &port->dev, __func__, transfer_size, urb->transfer_buffer); +- +- /* build up our urb */ +- usb_fill_bulk_urb( +- urb, +- serial->dev, +- usb_sndbulkpipe(serial->dev, +- port->bulk_out_endpointAddress), +- urb->transfer_buffer, +- transfer_size, +- empeg_write_bulk_callback, +- port); +- +- /* send it down the pipe */ +- status = usb_submit_urb(urb, GFP_ATOMIC); +- if (status) { +- dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed with status = %d\n", __func__, status); +- bytes_sent = status; +- break; +- } +- +- current_position += transfer_size; +- bytes_sent += transfer_size; +- count -= transfer_size; +- bytes_out += transfer_size; +- +- } +-exit: +- return bytes_sent; +-} +- +- +-static int empeg_write_room(struct tty_struct *tty) +-{ +- struct usb_serial_port *port = tty->driver_data; +- unsigned long flags; +- int i; +- int room = 0; +- +- dbg("%s - port %d", __func__, port->number); +- +- spin_lock_irqsave(&write_urb_pool_lock, flags); +- /* tally up the number of bytes available */ +- for (i = 0; i < NUM_URBS; ++i) { +- if (write_urb_pool[i]->status != -EINPROGRESS) +- room += URB_TRANSFER_BUFFER_SIZE; +- } +- spin_unlock_irqrestore(&write_urb_pool_lock, flags); +- dbg("%s - returns %d", __func__, room); +- return room; +- +-} +- +- +-static int empeg_chars_in_buffer(struct tty_struct *tty) +-{ +- struct usb_serial_port *port = tty->driver_data; +- unsigned long flags; +- int i; +- int chars = 0; +- +- dbg("%s - port %d", __func__, port->number); +- +- spin_lock_irqsave(&write_urb_pool_lock, flags); +- +- /* tally up the number of bytes waiting */ +- for (i = 0; i < NUM_URBS; ++i) { +- if (write_urb_pool[i]->status == -EINPROGRESS) +- chars += URB_TRANSFER_BUFFER_SIZE; +- } +- +- spin_unlock_irqrestore(&write_urb_pool_lock, flags); +- dbg("%s - returns %d", __func__, chars); +- return chars; +-} +- +- +-static void empeg_write_bulk_callback(struct urb *urb) +-{ +- struct usb_serial_port *port = urb->context; +- int status = urb->status; +- +- dbg("%s - port %d", __func__, port->number); +- +- if (status) { +- dbg("%s - nonzero write bulk status received: %d", +- __func__, status); +- return; +- } +- +- usb_serial_port_softint(port); +-} +- +- +-static void empeg_read_bulk_callback(struct urb *urb) +-{ +- struct usb_serial_port *port = urb->context; +- struct tty_struct *tty; +- unsigned char *data = urb->transfer_buffer; +- int result; +- int status = urb->status; +- +- dbg("%s - port %d", __func__, port->number); +- +- if (status) { +- dbg("%s - nonzero read bulk status received: %d", +- __func__, status); +- return; +- } +- +- usb_serial_debug_data(debug, &port->dev, __func__, +- urb->actual_length, data); +- tty = tty_port_tty_get(&port->port); +- +- if (urb->actual_length) { +- tty_insert_flip_string(tty, data, urb->actual_length); +- tty_flip_buffer_push(tty); +- bytes_in += urb->actual_length; +- } +- tty_kref_put(tty); +- +- /* Continue trying to always read */ +- usb_fill_bulk_urb( +- port->read_urb, +- port->serial->dev, +- usb_rcvbulkpipe(port->serial->dev, +- port->bulk_in_endpointAddress), +- port->read_urb->transfer_buffer, +- port->read_urb->transfer_buffer_length, +- empeg_read_bulk_callback, +- port); +- +- result = usb_submit_urb(port->read_urb, GFP_ATOMIC); +- +- if (result) +- dev_err(&urb->dev->dev, +- "%s - failed resubmitting read urb, error %d\n", +- __func__, result); +- +- return; +- +-} +- +- +-static void empeg_throttle(struct tty_struct *tty) +-{ +- struct usb_serial_port *port = tty->driver_data; +- dbg("%s - port %d", __func__, port->number); +- usb_kill_urb(port->read_urb); +-} +- +- +-static void empeg_unthrottle(struct tty_struct *tty) +-{ +- struct usb_serial_port *port = tty->driver_data; +- int result; +- dbg("%s - port %d", __func__, port->number); +- +- port->read_urb->dev = port->serial->dev; +- result = usb_submit_urb(port->read_urb, GFP_KERNEL); +- if (result) +- dev_err(&port->dev, +- "%s - failed submitting read urb, error %d\n", +- __func__, result); +-} +- +- +-static int empeg_startup(struct usb_serial *serial) ++static int empeg_startup(struct usb_serial *serial) + { + int r; + +@@ -414,10 +90,8 @@ static int empeg_startup(struct usb_ser + + /* continue on with initialization */ + return r; +- + } + +- + static void empeg_init_termios(struct tty_struct *tty) + { + struct ktermios *termios = tty->termios; +@@ -462,77 +136,28 @@ static void empeg_init_termios(struct tt + tty_encode_baud_rate(tty, 115200, 115200); + } + +- + static int __init empeg_init(void) + { +- struct urb *urb; +- int i, retval; +- +- /* create our write urb pool and transfer buffers */ +- spin_lock_init(&write_urb_pool_lock); +- for (i = 0; i < NUM_URBS; ++i) { +- urb = usb_alloc_urb(0, GFP_KERNEL); +- write_urb_pool[i] = urb; +- if (urb == NULL) { +- printk(KERN_ERR "empeg: No more urbs???\n"); +- continue; +- } +- +- urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, +- GFP_KERNEL); +- if (!urb->transfer_buffer) { +- printk(KERN_ERR "empeg: %s - out of memory for urb " +- "buffers.", __func__); +- continue; +- } +- } ++ int retval; + + retval = usb_serial_register(&empeg_device); + if (retval) +- goto failed_usb_serial_register; ++ return retval; + retval = usb_register(&empeg_driver); +- if (retval) +- goto failed_usb_register; +- ++ if (retval) { ++ usb_serial_deregister(&empeg_device); ++ return retval; ++ } + printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" + DRIVER_DESC "\n"); + + return 0; +-failed_usb_register: +- usb_serial_deregister(&empeg_device); +-failed_usb_serial_register: +- for (i = 0; i < NUM_URBS; ++i) { +- if (write_urb_pool[i]) { +- kfree(write_urb_pool[i]->transfer_buffer); +- usb_free_urb(write_urb_pool[i]); +- } +- } +- return retval; + } + +- + static void __exit empeg_exit(void) + { +- int i; +- unsigned long flags; +- + usb_deregister(&empeg_driver); + usb_serial_deregister(&empeg_device); +- +- spin_lock_irqsave(&write_urb_pool_lock, flags); +- +- for (i = 0; i < NUM_URBS; ++i) { +- if (write_urb_pool[i]) { +- /* FIXME - uncomment the following usb_kill_urb call +- * when the host controllers get fixed to set urb->dev +- * = NULL after the urb is finished. Otherwise this +- * call oopses. */ +- /* usb_kill_urb(write_urb_pool[i]); */ +- kfree(write_urb_pool[i]->transfer_buffer); +- usb_free_urb(write_urb_pool[i]); +- } +- } +- spin_unlock_irqrestore(&write_urb_pool_lock, flags); + } + + diff --git a/usb/usb-ftdi_sio-checkpatch-cleanups.patch b/usb/usb-ftdi_sio-checkpatch-cleanups.patch new file mode 100644 index 00000000000000..5b5c77ae81f45e --- /dev/null +++ b/usb/usb-ftdi_sio-checkpatch-cleanups.patch @@ -0,0 +1,314 @@ +From foo@baz Mon May 17 10:33:41 PDT 2010 +Date: Mon, 17 May 2010 10:33:41 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: USB: ftdi_sio: checkpatch cleanups + +Minor whitespace cleanups to make checkpatch happy. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/usb/serial/ftdi_sio.c | 2 + drivers/usb/serial/ftdi_sio.h | 130 +++++++++++++++++++------------------- + drivers/usb/serial/ftdi_sio_ids.h | 42 ++++++------ + 3 files changed, 90 insertions(+), 84 deletions(-) + +--- a/drivers/usb/serial/ftdi_sio.c ++++ b/drivers/usb/serial/ftdi_sio.c +@@ -61,7 +61,7 @@ static __u16 product; + + struct ftdi_private { + struct kref kref; +- ftdi_chip_type_t chip_type; ++ enum ftdi_chip_type chip_type; + /* 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 +--- a/drivers/usb/serial/ftdi_sio.h ++++ b/drivers/usb/serial/ftdi_sio.h +@@ -23,14 +23,16 @@ + */ + + /* Commands */ +-#define FTDI_SIO_RESET 0 /* Reset the port */ +-#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ +-#define FTDI_SIO_SET_FLOW_CTRL 2 /* Set flow control register */ +-#define FTDI_SIO_SET_BAUD_RATE 3 /* Set baud rate */ +-#define FTDI_SIO_SET_DATA 4 /* Set the data characteristics of the port */ +-#define FTDI_SIO_GET_MODEM_STATUS 5 /* Retrieve current value of modem status register */ +-#define FTDI_SIO_SET_EVENT_CHAR 6 /* Set the event character */ +-#define FTDI_SIO_SET_ERROR_CHAR 7 /* Set the error character */ ++#define FTDI_SIO_RESET 0 /* Reset the port */ ++#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ ++#define FTDI_SIO_SET_FLOW_CTRL 2 /* Set flow control register */ ++#define FTDI_SIO_SET_BAUD_RATE 3 /* Set baud rate */ ++#define FTDI_SIO_SET_DATA 4 /* Set the data characteristics of ++ the port */ ++#define FTDI_SIO_GET_MODEM_STATUS 5 /* Retrieve current value of modem ++ status register */ ++#define FTDI_SIO_SET_EVENT_CHAR 6 /* Set the event character */ ++#define FTDI_SIO_SET_ERROR_CHAR 7 /* Set the error character */ + #define FTDI_SIO_SET_LATENCY_TIMER 9 /* Set the latency timer */ + #define FTDI_SIO_GET_LATENCY_TIMER 10 /* Get the latency timer */ + +@@ -52,7 +54,7 @@ + */ + + /* Port Identifier Table */ +-#define PIT_DEFAULT 0 /* SIOA */ ++#define PIT_DEFAULT 0 /* SIOA */ + #define PIT_SIOA 1 /* SIOA */ + /* The device this driver is tested with one has only one port */ + #define PIT_SIOB 2 /* SIOB */ +@@ -103,20 +105,21 @@ + * wLength: 0 + * Data: None + * The BaudDivisor values are calculated as follows: +- * - BaseClock is either 12000000 or 48000000 depending on the device. FIXME: I wish +- * I knew how to detect old chips to select proper base clock! ++ * - BaseClock is either 12000000 or 48000000 depending on the device. ++ * FIXME: I wish I knew how to detect old chips to select proper base clock! + * - BaudDivisor is a fixed point number encoded in a funny way. + * (--WRONG WAY OF THINKING--) + * BaudDivisor is a fixed point number encoded with following bit weighs: + * (-2)(-1)(13..0). It is a radical with a denominator of 4, so values + * end with 0.0 (00...), 0.25 (10...), 0.5 (01...), and 0.75 (11...). + * (--THE REALITY--) +- * The both-bits-set has quite different meaning from 0.75 - the chip designers +- * have decided it to mean 0.125 instead of 0.75. ++ * The both-bits-set has quite different meaning from 0.75 - the chip ++ * designers have decided it to mean 0.125 instead of 0.75. + * This info looked up in FTDI application note "FT8U232 DEVICES \ Data Rates + * and Flow Control Consideration for USB to RS232". + * - BaudDivisor = (BaseClock / 16) / BaudRate, where the (=) operation should +- * automagically re-encode the resulting value to take fractions into consideration. ++ * automagically re-encode the resulting value to take fractions into ++ * consideration. + * As all values are integers, some bit twiddling is in order: + * BaudDivisor = (BaseClock / 16 / BaudRate) | + * (((BaseClock / 2 / BaudRate) & 4) ? 0x4000 // 0.5 +@@ -146,7 +149,7 @@ + * not supported by the FT8U232AM). + */ + +-typedef enum { ++enum ftdi_chip_type { + SIO = 1, + FT8U232AM = 2, + FT232BM = 3, +@@ -154,37 +157,36 @@ typedef enum { + FT232RL = 5, + FT2232H = 6, + FT4232H = 7 +-} ftdi_chip_type_t; ++}; + +-typedef enum { +- ftdi_sio_b300 = 0, +- ftdi_sio_b600 = 1, +- ftdi_sio_b1200 = 2, +- ftdi_sio_b2400 = 3, +- ftdi_sio_b4800 = 4, +- ftdi_sio_b9600 = 5, +- ftdi_sio_b19200 = 6, +- ftdi_sio_b38400 = 7, +- ftdi_sio_b57600 = 8, +- ftdi_sio_b115200 = 9 +-} FTDI_SIO_baudrate_t; +- +-/* +- * The ftdi_8U232AM_xxMHz_byyy constants have been removed. The encoded divisor values +- * are calculated internally. +- */ +- +-#define FTDI_SIO_SET_DATA_REQUEST FTDI_SIO_SET_DATA +-#define FTDI_SIO_SET_DATA_REQUEST_TYPE 0x40 +-#define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8) +-#define FTDI_SIO_SET_DATA_PARITY_ODD (0x1 << 8) +-#define FTDI_SIO_SET_DATA_PARITY_EVEN (0x2 << 8) +-#define FTDI_SIO_SET_DATA_PARITY_MARK (0x3 << 8) +-#define FTDI_SIO_SET_DATA_PARITY_SPACE (0x4 << 8) +-#define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11) +-#define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11) +-#define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11) +-#define FTDI_SIO_SET_BREAK (0x1 << 14) ++enum ftdi_sio_baudrate { ++ ftdi_sio_b300 = 0, ++ ftdi_sio_b600 = 1, ++ ftdi_sio_b1200 = 2, ++ ftdi_sio_b2400 = 3, ++ ftdi_sio_b4800 = 4, ++ ftdi_sio_b9600 = 5, ++ ftdi_sio_b19200 = 6, ++ ftdi_sio_b38400 = 7, ++ ftdi_sio_b57600 = 8, ++ ftdi_sio_b115200 = 9 ++}; ++ ++/* ++ * The ftdi_8U232AM_xxMHz_byyy constants have been removed. The encoded divisor ++ * values are calculated internally. ++ */ ++#define FTDI_SIO_SET_DATA_REQUEST FTDI_SIO_SET_DATA ++#define FTDI_SIO_SET_DATA_REQUEST_TYPE 0x40 ++#define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8) ++#define FTDI_SIO_SET_DATA_PARITY_ODD (0x1 << 8) ++#define FTDI_SIO_SET_DATA_PARITY_EVEN (0x2 << 8) ++#define FTDI_SIO_SET_DATA_PARITY_MARK (0x3 << 8) ++#define FTDI_SIO_SET_DATA_PARITY_SPACE (0x4 << 8) ++#define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11) ++#define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11) ++#define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11) ++#define FTDI_SIO_SET_BREAK (0x1 << 14) + /* FTDI_SIO_SET_DATA */ + + /* +@@ -287,8 +289,8 @@ typedef enum { + * + * A value of zero in the hIndex field disables handshaking + * +- * If Xon/Xoff handshaking is specified, the hValue field should contain the XOFF character +- * and the lValue field contains the XON character. ++ * If Xon/Xoff handshaking is specified, the hValue field should contain the ++ * XOFF character and the lValue field contains the XON character. + */ + + /* +@@ -373,7 +375,10 @@ typedef enum { + + /* FTDI_SIO_SET_ERROR_CHAR */ + +-/* Set the parity error replacement character for the specified communications port */ ++/* ++ * Set the parity error replacement character for the specified communications ++ * port ++ */ + + /* + * BmRequestType: 0100 0000b +@@ -496,9 +501,10 @@ typedef enum { + * + * IN Endpoint + * +- * The device reserves the first two bytes of data on this endpoint to contain the current +- * values of the modem and line status registers. In the absence of data, the device +- * generates a message consisting of these two status bytes every 40 ms ++ * The device reserves the first two bytes of data on this endpoint to contain ++ * the current values of the modem and line status registers. In the absence of ++ * data, the device generates a message consisting of these two status bytes ++ * every 40 ms + * + * Byte 0: Modem Status + * +@@ -530,21 +536,21 @@ typedef enum { + #define FTDI_RS0_RI (1 << 6) + #define FTDI_RS0_RLSD (1 << 7) + +-#define FTDI_RS_DR 1 +-#define FTDI_RS_OE (1<<1) +-#define FTDI_RS_PE (1<<2) +-#define FTDI_RS_FE (1<<3) +-#define FTDI_RS_BI (1<<4) +-#define FTDI_RS_THRE (1<<5) +-#define FTDI_RS_TEMT (1<<6) +-#define FTDI_RS_FIFO (1<<7) ++#define FTDI_RS_DR 1 ++#define FTDI_RS_OE (1<<1) ++#define FTDI_RS_PE (1<<2) ++#define FTDI_RS_FE (1<<3) ++#define FTDI_RS_BI (1<<4) ++#define FTDI_RS_THRE (1<<5) ++#define FTDI_RS_TEMT (1<<6) ++#define FTDI_RS_FIFO (1<<7) + + /* + * OUT Endpoint + * +- * This device reserves the first bytes of data on this endpoint contain the length +- * and port identifier of the message. For the FTDI USB Serial converter the port +- * identifier is always 1. ++ * This device reserves the first bytes of data on this endpoint contain the ++ * length and port identifier of the message. For the FTDI USB Serial converter ++ * the port identifier is always 1. + * + * Byte 0: Line Status + * +--- a/drivers/usb/serial/ftdi_sio_ids.h ++++ b/drivers/usb/serial/ftdi_sio_ids.h +@@ -275,8 +275,8 @@ + /* + * Hameg HO820 and HO870 interface (using VID 0x0403) + */ +-#define HAMEG_HO820_PID 0xed74 +-#define HAMEG_HO870_PID 0xed71 ++#define HAMEG_HO820_PID 0xed74 ++#define HAMEG_HO870_PID 0xed71 + + /* + * MaxStream devices www.maxstream.net +@@ -289,14 +289,14 @@ + * and Mike Studer (K6EEP) <k6eep@hamsoftware.org>. + * Ian Abbott <abbotti@mev.co.uk> added a few more from the driver INF file. + */ +-#define FTDI_MHAM_KW_PID 0xEEE8 /* USB-KW interface */ +-#define FTDI_MHAM_YS_PID 0xEEE9 /* USB-YS interface */ +-#define FTDI_MHAM_Y6_PID 0xEEEA /* USB-Y6 interface */ +-#define FTDI_MHAM_Y8_PID 0xEEEB /* USB-Y8 interface */ +-#define FTDI_MHAM_IC_PID 0xEEEC /* USB-IC interface */ +-#define FTDI_MHAM_DB9_PID 0xEEED /* USB-DB9 interface */ +-#define FTDI_MHAM_RS232_PID 0xEEEE /* USB-RS232 interface */ +-#define FTDI_MHAM_Y9_PID 0xEEEF /* USB-Y9 interface */ ++#define FTDI_MHAM_KW_PID 0xEEE8 /* USB-KW interface */ ++#define FTDI_MHAM_YS_PID 0xEEE9 /* USB-YS interface */ ++#define FTDI_MHAM_Y6_PID 0xEEEA /* USB-Y6 interface */ ++#define FTDI_MHAM_Y8_PID 0xEEEB /* USB-Y8 interface */ ++#define FTDI_MHAM_IC_PID 0xEEEC /* USB-IC interface */ ++#define FTDI_MHAM_DB9_PID 0xEEED /* USB-DB9 interface */ ++#define FTDI_MHAM_RS232_PID 0xEEEE /* USB-RS232 interface */ ++#define FTDI_MHAM_Y9_PID 0xEEEF /* USB-Y9 interface */ + + /* Domintell products http://www.domintell.com */ + #define FTDI_DOMINTELL_DGQG_PID 0xEF50 /* Master */ +@@ -483,9 +483,9 @@ + * Blackfin gnICE JTAG + * http://docs.blackfin.uclinux.org/doku.php?id=hw:jtag:gnice + */ +-#define ADI_VID 0x0456 +-#define ADI_GNICE_PID 0xF000 +-#define ADI_GNICEPLUS_PID 0xF001 ++#define ADI_VID 0x0456 ++#define ADI_GNICE_PID 0xF000 ++#define ADI_GNICEPLUS_PID 0xF001 + + /* + * RATOC REX-USB60F +@@ -611,13 +611,13 @@ + #define SEALEVEL_2802_7_PID 0X2872 /* SeaLINK+8/485 (2802) Port 7 */ + #define SEALEVEL_2802_8_PID 0X2882 /* SeaLINK+8/485 (2802) Port 8 */ + #define SEALEVEL_2803_1_PID 0X2813 /* SeaLINK+8 (2803) Port 1 */ +-#define SEALEVEL_2803_2_PID 0X2823 /* SeaLINK+8 (2803) Port 2 */ +-#define SEALEVEL_2803_3_PID 0X2833 /* SeaLINK+8 (2803) Port 3 */ +-#define SEALEVEL_2803_4_PID 0X2843 /* SeaLINK+8 (2803) Port 4 */ +-#define SEALEVEL_2803_5_PID 0X2853 /* SeaLINK+8 (2803) Port 5 */ +-#define SEALEVEL_2803_6_PID 0X2863 /* SeaLINK+8 (2803) Port 6 */ +-#define SEALEVEL_2803_7_PID 0X2873 /* SeaLINK+8 (2803) Port 7 */ +-#define SEALEVEL_2803_8_PID 0X2883 /* SeaLINK+8 (2803) Port 8 */ ++#define SEALEVEL_2803_2_PID 0X2823 /* SeaLINK+8 (2803) Port 2 */ ++#define SEALEVEL_2803_3_PID 0X2833 /* SeaLINK+8 (2803) Port 3 */ ++#define SEALEVEL_2803_4_PID 0X2843 /* SeaLINK+8 (2803) Port 4 */ ++#define SEALEVEL_2803_5_PID 0X2853 /* SeaLINK+8 (2803) Port 5 */ ++#define SEALEVEL_2803_6_PID 0X2863 /* SeaLINK+8 (2803) Port 6 */ ++#define SEALEVEL_2803_7_PID 0X2873 /* SeaLINK+8 (2803) Port 7 */ ++#define SEALEVEL_2803_8_PID 0X2883 /* SeaLINK+8 (2803) Port 8 */ + + /* + * JETI SPECTROMETER SPECBOS 1201 +@@ -1013,7 +1013,7 @@ + */ + #define EVOLUTION_VID 0xDEEE /* Vendor ID */ + #define EVOLUTION_ER1_PID 0x0300 /* ER1 Control Module */ +-#define EVO_8U232AM_PID 0x02FF /* Evolution robotics RCM2 (FT232AM)*/ ++#define EVO_8U232AM_PID 0x02FF /* Evolution robotics RCM2 (FT232AM)*/ + #define EVO_HYBRID_PID 0x0302 /* Evolution robotics RCM4 PID (FT232BM)*/ + #define EVO_RCM4_PID 0x0303 /* Evolution robotics RCM4 PID */ + diff --git a/usb/usb-gadget-use-kmemdup.patch b/usb/usb-gadget-use-kmemdup.patch new file mode 100644 index 00000000000000..7c608c84352419 --- /dev/null +++ b/usb/usb-gadget-use-kmemdup.patch @@ -0,0 +1,49 @@ +From julia@diku.dk Mon May 17 11:12:09 2010 +From: Julia Lawall <julia@diku.dk> +Date: Sat, 15 May 2010 23:15:44 +0200 (CEST) +Subject: USB: gadget: Use kmemdup +To: Haavard Skinnemoen <hskinnemoen@atmel.com>, David Brownell <dbrownell@users.sourceforge.net>, Greg Kroah-Hartman <gregkh@suse.de>, kernel@avr32linux.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org +Message-ID: <Pine.LNX.4.64.1005152315280.21345@ask.diku.dk> + + +From: Julia Lawall <julia@diku.dk> + +Use kmemdup when some other buffer is immediately copied into the +allocated region. + +A simplified version of the semantic patch that makes this change is as +follows: (http://coccinelle.lip6.fr/) + +// <smpl> +@@ +expression from,to,size,flag; +statement S; +@@ + +- to = \(kmalloc\|kzalloc\)(size,flag); ++ to = kmemdup(from,size,flag); + if (to==NULL || ...) S +- memcpy(to, from, size); +// </smpl> + +Signed-off-by: Julia Lawall <julia@diku.dk> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/gadget/atmel_usba_udc.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/usb/gadget/atmel_usba_udc.c ++++ b/drivers/usb/gadget/atmel_usba_udc.c +@@ -48,10 +48,9 @@ static int queue_dbg_open(struct inode * + + spin_lock_irq(&ep->udc->lock); + list_for_each_entry(req, &ep->queue, queue) { +- req_copy = kmalloc(sizeof(*req_copy), GFP_ATOMIC); ++ req_copy = kmemdup(req, sizeof(*req_copy), GFP_ATOMIC); + if (!req_copy) + goto fail; +- memcpy(req_copy, req, sizeof(*req_copy)); + list_add_tail(&req_copy->queue, queue_data); + } + spin_unlock_irq(&ep->udc->lock); diff --git a/usb/usb-include-usb-.h-checkpatch-cleanup.patch b/usb/usb-include-usb-.h-checkpatch-cleanup.patch new file mode 100644 index 00000000000000..bba35d417b473f --- /dev/null +++ b/usb/usb-include-usb-.h-checkpatch-cleanup.patch @@ -0,0 +1,572 @@ +From foo@baz Mon May 17 10:58:12 PDT 2010 +Date: Mon, 17 May 2010 10:58:12 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: USB: include/usb/*.h checkpatch cleanup + +Lots of minor formatting cleanups in includes/usb/ to make checkpatch +happier. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + include/linux/usb/atmel_usba_udc.h | 2 - + include/linux/usb/audio.h | 6 +-- + include/linux/usb/ch9.h | 12 +++--- + include/linux/usb/ehci_def.h | 6 +-- + include/linux/usb/gadget.h | 2 - + include/linux/usb/gadgetfs.h | 2 - + include/linux/usb/hcd.h | 28 +++++++------- + include/linux/usb/langwell_udc.h | 2 - + include/linux/usb/musb.h | 4 +- + include/linux/usb/net2280.h | 6 +-- + include/linux/usb/rndis_host.h | 70 ++++++++++++++++++------------------- + include/linux/usb/serial.h | 2 - + include/linux/usb/usbnet.h | 40 +++++++++++---------- + include/linux/usb/wusb-wa.h | 2 - + 14 files changed, 94 insertions(+), 90 deletions(-) + +--- a/include/linux/usb/atmel_usba_udc.h ++++ b/include/linux/usb/atmel_usba_udc.h +@@ -15,7 +15,7 @@ struct usba_ep_data { + + struct usba_platform_data { + int vbus_pin; +- int vbus_pin_inverted; ++ int vbus_pin_inverted; + int num_ep; + struct usba_ep_data ep[0]; + }; +--- a/include/linux/usb/audio.h ++++ b/include/linux/usb/audio.h +@@ -110,7 +110,7 @@ struct uac_ac_header_descriptor_v1 { + #define UAC_DT_AC_HEADER_SIZE(n) (8 + (n)) + + /* As above, but more useful for defining your own descriptors: */ +-#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ ++#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ + struct uac_ac_header_descriptor_v1_##n { \ + __u8 bLength; \ + __u8 bDescriptorType; \ +@@ -178,7 +178,7 @@ struct uac_output_terminal_descriptor_v1 + #define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) + + /* As above, but more useful for defining your own descriptors: */ +-#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \ ++#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \ + struct uac_feature_unit_descriptor_##ch { \ + __u8 bLength; \ + __u8 bDescriptorType; \ +@@ -250,7 +250,7 @@ struct uac_format_type_i_discrete_descri + __u8 tSamFreq[][3]; + } __attribute__ ((packed)); + +-#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \ ++#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \ + struct uac_format_type_i_discrete_descriptor_##n { \ + __u8 bLength; \ + __u8 bDescriptorType; \ +--- a/include/linux/usb/ch9.h ++++ b/include/linux/usb/ch9.h +@@ -477,7 +477,7 @@ static inline int usb_endpoint_xfer_isoc + static inline int usb_endpoint_is_bulk_in( + const struct usb_endpoint_descriptor *epd) + { +- return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); ++ return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd); + } + + /** +@@ -490,7 +490,7 @@ static inline int usb_endpoint_is_bulk_i + static inline int usb_endpoint_is_bulk_out( + const struct usb_endpoint_descriptor *epd) + { +- return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); ++ return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd); + } + + /** +@@ -503,7 +503,7 @@ static inline int usb_endpoint_is_bulk_o + static inline int usb_endpoint_is_int_in( + const struct usb_endpoint_descriptor *epd) + { +- return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); ++ return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd); + } + + /** +@@ -516,7 +516,7 @@ static inline int usb_endpoint_is_int_in + static inline int usb_endpoint_is_int_out( + const struct usb_endpoint_descriptor *epd) + { +- return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); ++ return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd); + } + + /** +@@ -529,7 +529,7 @@ static inline int usb_endpoint_is_int_ou + static inline int usb_endpoint_is_isoc_in( + const struct usb_endpoint_descriptor *epd) + { +- return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); ++ return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd); + } + + /** +@@ -542,7 +542,7 @@ static inline int usb_endpoint_is_isoc_i + static inline int usb_endpoint_is_isoc_out( + const struct usb_endpoint_descriptor *epd) + { +- return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); ++ return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd); + } + + /*-------------------------------------------------------------------------*/ +--- a/include/linux/usb/ehci_def.h ++++ b/include/linux/usb/ehci_def.h +@@ -45,7 +45,7 @@ struct ehci_caps { + #define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */ + #define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/ + #define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */ +- u8 portroute [8]; /* nibbles for routing - offset 0xC */ ++ u8 portroute[8]; /* nibbles for routing - offset 0xC */ + } __attribute__ ((packed)); + + +@@ -92,14 +92,14 @@ struct ehci_regs { + /* ASYNCLISTADDR: offset 0x18 */ + u32 async_next; /* address of next async queue head */ + +- u32 reserved [9]; ++ u32 reserved[9]; + + /* CONFIGFLAG: offset 0x40 */ + u32 configured_flag; + #define FLAG_CF (1<<0) /* true: we'll support "high speed" */ + + /* PORTSC: offset 0x44 */ +- u32 port_status [0]; /* up to N_PORTS */ ++ u32 port_status[0]; /* up to N_PORTS */ + /* 31:23 reserved */ + #define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */ + #define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ +--- a/include/linux/usb/gadget.h ++++ b/include/linux/usb/gadget.h +@@ -500,7 +500,7 @@ static inline struct usb_gadget *dev_to_ + } + + /* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */ +-#define gadget_for_each_ep(tmp,gadget) \ ++#define gadget_for_each_ep(tmp, gadget) \ + list_for_each_entry(tmp, &(gadget)->ep_list, ep_list) + + +--- a/include/linux/usb/gadgetfs.h ++++ b/include/linux/usb/gadgetfs.h +@@ -19,7 +19,7 @@ + #define __LINUX_USB_GADGETFS_H + + #include <linux/types.h> +-#include <asm/ioctl.h> ++#include <linux/ioctl.h> + + #include <linux/usb/ch9.h> + +--- a/include/linux/usb/hcd.h ++++ b/include/linux/usb/hcd.h +@@ -126,7 +126,7 @@ struct usb_hcd { + + + #define HCD_BUFFER_POOLS 4 +- struct dma_pool *pool [HCD_BUFFER_POOLS]; ++ struct dma_pool *pool[HCD_BUFFER_POOLS]; + + int state; + # define __ACTIVE 0x01 +@@ -219,12 +219,12 @@ struct hc_driver { + struct urb *urb, int status); + + /* hw synch, freeing endpoint resources that urb_dequeue can't */ +- void (*endpoint_disable)(struct usb_hcd *hcd, ++ void (*endpoint_disable)(struct usb_hcd *hcd, + struct usb_host_endpoint *ep); + + /* (optional) reset any endpoint state such as sequence number + and current window */ +- void (*endpoint_reset)(struct usb_hcd *hcd, ++ void (*endpoint_reset)(struct usb_hcd *hcd, + struct usb_host_endpoint *ep); + + /* root hub support */ +@@ -265,16 +265,18 @@ struct hc_driver { + /* Note that add_endpoint() can only be called once per endpoint before + * check_bandwidth() or reset_bandwidth() must be called. + * drop_endpoint() can only be called once per endpoint also. +- * A call to xhci_drop_endpoint() followed by a call to xhci_add_endpoint() will +- * add the endpoint to the schedule with possibly new parameters denoted by a +- * different endpoint descriptor in usb_host_endpoint. +- * A call to xhci_add_endpoint() followed by a call to xhci_drop_endpoint() is +- * not allowed. ++ * A call to xhci_drop_endpoint() followed by a call to ++ * xhci_add_endpoint() will add the endpoint to the schedule with ++ * possibly new parameters denoted by a different endpoint descriptor ++ * in usb_host_endpoint. A call to xhci_add_endpoint() followed by a ++ * call to xhci_drop_endpoint() is not allowed. + */ + /* Allocate endpoint resources and add them to a new schedule */ +- int (*add_endpoint)(struct usb_hcd *, struct usb_device *, struct usb_host_endpoint *); ++ int (*add_endpoint)(struct usb_hcd *, struct usb_device *, ++ struct usb_host_endpoint *); + /* Drop an endpoint from a new schedule */ +- int (*drop_endpoint)(struct usb_hcd *, struct usb_device *, struct usb_host_endpoint *); ++ int (*drop_endpoint)(struct usb_hcd *, struct usb_device *, ++ struct usb_host_endpoint *); + /* Check that a new hardware configuration, set using + * endpoint_enable and endpoint_disable, does not exceed bus + * bandwidth. This must be called before any set configuration +@@ -484,8 +486,8 @@ extern void usb_ep0_reinit(struct usb_de + #define HS_NSECS_ISO(bytes) (((38 * 8 * 2083) \ + + (2083UL * (3 + BitTime(bytes))))/1000 \ + + USB2_HOST_DELAY) +-#define HS_USECS(bytes) NS_TO_US (HS_NSECS(bytes)) +-#define HS_USECS_ISO(bytes) NS_TO_US (HS_NSECS_ISO(bytes)) ++#define HS_USECS(bytes) NS_TO_US(HS_NSECS(bytes)) ++#define HS_USECS_ISO(bytes) NS_TO_US(HS_NSECS_ISO(bytes)) + + extern long usb_calc_bus_time(int speed, int is_input, + int isoc, int bytecount); +@@ -596,7 +598,7 @@ static inline void usbmon_urb_complete(s + + /* hub.h ... DeviceRemovable in 2.4.2-ac11, gone in 2.4.10 */ + /* bleech -- resurfaced in 2.4.11 or 2.4.12 */ +-#define bitmap DeviceRemovable ++#define bitmap DeviceRemovable + + + /*-------------------------------------------------------------------------*/ +--- a/include/linux/usb/langwell_udc.h ++++ b/include/linux/usb/langwell_udc.h +@@ -181,7 +181,7 @@ struct langwell_op_regs { + #define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */ + #define PORTS_PO BIT(13) /* port owner */ + #define PORTS_PP BIT(12) /* port power */ +-#define PORTS_LS (BIT(11) | BIT(10)) /* line status */ ++#define PORTS_LS (BIT(11) | BIT(10)) /* line status */ + #define PORTS_SLP BIT(9) /* suspend using L1 */ + #define PORTS_PR BIT(8) /* port reset */ + #define PORTS_SUSP BIT(7) /* suspend */ +--- a/include/linux/usb/musb.h ++++ b/include/linux/usb/musb.h +@@ -86,8 +86,8 @@ struct musb_hdrc_config { + + struct musb_hdrc_eps_bits *eps_bits __deprecated; + #ifdef CONFIG_BLACKFIN +- /* A GPIO controlling VRSEL in Blackfin */ +- unsigned int gpio_vrsel; ++ /* A GPIO controlling VRSEL in Blackfin */ ++ unsigned int gpio_vrsel; + unsigned int gpio_vrsel_active; + #endif + +--- a/include/linux/usb/net2280.h ++++ b/include/linux/usb/net2280.h +@@ -353,7 +353,7 @@ struct net2280_dma_regs { /* [11.7] */ + #define DMA_TRANSACTION_DONE_INTERRUPT 24 + #define DMA_ABORT 1 + #define DMA_START 0 +- u32 _unused0 [2]; ++ u32 _unused0[2]; + /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */ + u32 dmacount; + #define VALID_BIT 31 +@@ -374,7 +374,7 @@ struct net2280_dep_regs { /* [11.8] */ + u32 dep_cfg; + /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */ + u32 dep_rsp; +- u32 _unused [2]; ++ u32 _unused[2]; + } __attribute__ ((packed)); + + /* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs +@@ -437,7 +437,7 @@ struct net2280_ep_regs { /* [11.9] */ + /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */ + u32 ep_avail; + u32 ep_data; +- u32 _unused0 [2]; ++ u32 _unused0[2]; + } __attribute__ ((packed)); + + #endif /* __LINUX_USB_NET2280_H */ +--- a/include/linux/usb/rndis_host.h ++++ b/include/linux/usb/rndis_host.h +@@ -34,10 +34,10 @@ + struct rndis_msg_hdr { + __le32 msg_type; /* RNDIS_MSG_* */ + __le32 msg_len; +- // followed by data that varies between messages ++ /* followed by data that varies between messages */ + __le32 request_id; + __le32 status; +- // ... and more ++ /* ... and more */ + } __attribute__ ((packed)); + + /* MS-Windows uses this strange size, but RNDIS spec says 1024 minimum */ +@@ -92,67 +92,67 @@ struct rndis_msg_hdr { + + struct rndis_data_hdr { + __le32 msg_type; /* RNDIS_MSG_PACKET */ +- __le32 msg_len; // rndis_data_hdr + data_len + pad +- __le32 data_offset; // 36 -- right after header +- __le32 data_len; // ... real packet size +- +- __le32 oob_data_offset; // zero +- __le32 oob_data_len; // zero +- __le32 num_oob; // zero +- __le32 packet_data_offset; // zero +- +- __le32 packet_data_len; // zero +- __le32 vc_handle; // zero +- __le32 reserved; // zero ++ __le32 msg_len; /* rndis_data_hdr + data_len + pad */ ++ __le32 data_offset; /* 36 -- right after header */ ++ __le32 data_len; /* ... real packet size */ ++ ++ __le32 oob_data_offset; /* zero */ ++ __le32 oob_data_len; /* zero */ ++ __le32 num_oob; /* zero */ ++ __le32 packet_data_offset; /* zero */ ++ ++ __le32 packet_data_len; /* zero */ ++ __le32 vc_handle; /* zero */ ++ __le32 reserved; /* zero */ + } __attribute__ ((packed)); + + struct rndis_init { /* OUT */ +- // header and: ++ /* header and: */ + __le32 msg_type; /* RNDIS_MSG_INIT */ +- __le32 msg_len; // 24 ++ __le32 msg_len; /* 24 */ + __le32 request_id; +- __le32 major_version; // of rndis (1.0) ++ __le32 major_version; /* of rndis (1.0) */ + __le32 minor_version; + __le32 max_transfer_size; + } __attribute__ ((packed)); + + struct rndis_init_c { /* IN */ +- // header and: ++ /* header and: */ + __le32 msg_type; /* RNDIS_MSG_INIT_C */ + __le32 msg_len; + __le32 request_id; + __le32 status; +- __le32 major_version; // of rndis (1.0) ++ __le32 major_version; /* of rndis (1.0) */ + __le32 minor_version; + __le32 device_flags; +- __le32 medium; // zero == 802.3 ++ __le32 medium; /* zero == 802.3 */ + __le32 max_packets_per_message; + __le32 max_transfer_size; +- __le32 packet_alignment; // max 7; (1<<n) bytes +- __le32 af_list_offset; // zero +- __le32 af_list_size; // zero ++ __le32 packet_alignment; /* max 7; (1<<n) bytes */ ++ __le32 af_list_offset; /* zero */ ++ __le32 af_list_size; /* zero */ + } __attribute__ ((packed)); + + struct rndis_halt { /* OUT (no reply) */ +- // header and: ++ /* header and: */ + __le32 msg_type; /* RNDIS_MSG_HALT */ + __le32 msg_len; + __le32 request_id; + } __attribute__ ((packed)); + + struct rndis_query { /* OUT */ +- // header and: ++ /* header and: */ + __le32 msg_type; /* RNDIS_MSG_QUERY */ + __le32 msg_len; + __le32 request_id; + __le32 oid; + __le32 len; + __le32 offset; +-/*?*/ __le32 handle; // zero ++/*?*/ __le32 handle; /* zero */ + } __attribute__ ((packed)); + + struct rndis_query_c { /* IN */ +- // header and: ++ /* header and: */ + __le32 msg_type; /* RNDIS_MSG_QUERY_C */ + __le32 msg_len; + __le32 request_id; +@@ -162,18 +162,18 @@ struct rndis_query_c { /* IN */ + } __attribute__ ((packed)); + + struct rndis_set { /* OUT */ +- // header and: ++ /* header and: */ + __le32 msg_type; /* RNDIS_MSG_SET */ + __le32 msg_len; + __le32 request_id; + __le32 oid; + __le32 len; + __le32 offset; +-/*?*/ __le32 handle; // zero ++/*?*/ __le32 handle; /* zero */ + } __attribute__ ((packed)); + + struct rndis_set_c { /* IN */ +- // header and: ++ /* header and: */ + __le32 msg_type; /* RNDIS_MSG_SET_C */ + __le32 msg_len; + __le32 request_id; +@@ -181,14 +181,14 @@ struct rndis_set_c { /* IN */ + } __attribute__ ((packed)); + + struct rndis_reset { /* IN */ +- // header and: ++ /* header and: */ + __le32 msg_type; /* RNDIS_MSG_RESET */ + __le32 msg_len; + __le32 reserved; + } __attribute__ ((packed)); + + struct rndis_reset_c { /* OUT */ +- // header and: ++ /* header and: */ + __le32 msg_type; /* RNDIS_MSG_RESET_C */ + __le32 msg_len; + __le32 status; +@@ -196,7 +196,7 @@ struct rndis_reset_c { /* OUT */ + } __attribute__ ((packed)); + + struct rndis_indicate { /* IN (unrequested) */ +- // header and: ++ /* header and: */ + __le32 msg_type; /* RNDIS_MSG_INDICATE */ + __le32 msg_len; + __le32 status; +@@ -208,14 +208,14 @@ struct rndis_indicate { /* IN (unreques + } __attribute__ ((packed)); + + struct rndis_keepalive { /* OUT (optionally IN) */ +- // header and: ++ /* header and: */ + __le32 msg_type; /* RNDIS_MSG_KEEPALIVE */ + __le32 msg_len; + __le32 request_id; + } __attribute__ ((packed)); + + struct rndis_keepalive_c { /* IN (optionally OUT) */ +- // header and: ++ /* header and: */ + __le32 msg_type; /* RNDIS_MSG_KEEPALIVE_C */ + __le32 msg_len; + __le32 request_id; +--- a/include/linux/usb/serial.h ++++ b/include/linux/usb/serial.h +@@ -52,7 +52,7 @@ enum port_dev_state { + * @interrupt_out_size: the size of the interrupt_out_buffer, in bytes. + * @interrupt_out_urb: pointer to the interrupt out struct urb for this port. + * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe +- * for this port. ++ * for this port. + * @bulk_in_buffer: pointer to the bulk in buffer for this port. + * @bulk_in_size: the size of the bulk_in_buffer, in bytes. + * @read_urb: pointer to the bulk in struct urb for this port. +--- a/include/linux/usb/usbnet.h ++++ b/include/linux/usb/usbnet.h +@@ -43,7 +43,7 @@ struct usbnet { + /* protocol/interface state */ + struct net_device *net; + int msg_enable; +- unsigned long data [5]; ++ unsigned long data[5]; + u32 xid; + u32 hard_mtu; /* count any extra framing */ + size_t rx_urb_size; /* size for rx urbs */ +@@ -148,8 +148,8 @@ struct driver_info { + * much everything except custom framing and chip-specific stuff. + */ + extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *); +-extern int usbnet_suspend (struct usb_interface *, pm_message_t ); +-extern int usbnet_resume (struct usb_interface *); ++extern int usbnet_suspend(struct usb_interface *, pm_message_t); ++extern int usbnet_resume(struct usb_interface *); + extern void usbnet_disconnect(struct usb_interface *); + + +@@ -165,8 +165,8 @@ struct cdc_state { + struct usb_interface *data; + }; + +-extern int usbnet_generic_cdc_bind (struct usbnet *, struct usb_interface *); +-extern void usbnet_cdc_unbind (struct usbnet *, struct usb_interface *); ++extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *); ++extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *); + + /* CDC and RNDIS support the same host-chosen packet filters for IN transfers */ + #define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ +@@ -189,29 +189,31 @@ struct skb_data { /* skb->cb is one of t + size_t length; + }; + +-extern int usbnet_open (struct net_device *net); +-extern int usbnet_stop (struct net_device *net); +-extern netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, +- struct net_device *net); +-extern void usbnet_tx_timeout (struct net_device *net); +-extern int usbnet_change_mtu (struct net_device *net, int new_mtu); ++extern int usbnet_open(struct net_device *net); ++extern int usbnet_stop(struct net_device *net); ++extern netdev_tx_t usbnet_start_xmit(struct sk_buff *skb, ++ struct net_device *net); ++extern void usbnet_tx_timeout(struct net_device *net); ++extern int usbnet_change_mtu(struct net_device *net, int new_mtu); + + extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *); + extern int usbnet_get_ethernet_addr(struct usbnet *, int); +-extern void usbnet_defer_kevent (struct usbnet *, int); +-extern void usbnet_skb_return (struct usbnet *, struct sk_buff *); ++extern void usbnet_defer_kevent(struct usbnet *, int); ++extern void usbnet_skb_return(struct usbnet *, struct sk_buff *); + extern void usbnet_unlink_rx_urbs(struct usbnet *); + + extern void usbnet_pause_rx(struct usbnet *); + extern void usbnet_resume_rx(struct usbnet *); + extern void usbnet_purge_paused_rxq(struct usbnet *); + +-extern int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd); +-extern int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd); +-extern u32 usbnet_get_link (struct net_device *net); +-extern u32 usbnet_get_msglevel (struct net_device *); +-extern void usbnet_set_msglevel (struct net_device *, u32); +-extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *); ++extern int usbnet_get_settings(struct net_device *net, ++ struct ethtool_cmd *cmd); ++extern int usbnet_set_settings(struct net_device *net, ++ struct ethtool_cmd *cmd); ++extern u32 usbnet_get_link(struct net_device *net); ++extern u32 usbnet_get_msglevel(struct net_device *); ++extern void usbnet_set_msglevel(struct net_device *, u32); ++extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *); + extern int usbnet_nway_reset(struct net_device *net); + + #endif /* __LINUX_USB_USBNET_H */ +--- a/include/linux/usb/wusb-wa.h ++++ b/include/linux/usb/wusb-wa.h +@@ -87,7 +87,7 @@ enum rpipe_crs { + * FIXME: explain rpipes + */ + struct usb_rpipe_descriptor { +- u8 bLength; ++ u8 bLength; + u8 bDescriptorType; + __le16 wRPipeIndex; + __le16 wRequests; diff --git a/usb/usb-io_edgeport-checkpatch-cleanups.patch b/usb/usb-io_edgeport-checkpatch-cleanups.patch new file mode 100644 index 00000000000000..2fdc0562d194b1 --- /dev/null +++ b/usb/usb-io_edgeport-checkpatch-cleanups.patch @@ -0,0 +1,650 @@ +From foo@baz Mon May 17 10:33:41 PDT 2010 +Date: Mon, 17 May 2010 10:33:41 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: USB: io_edgeport: checkpatch cleanups + +Minor whitespace cleanups to make checkpatch happy. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/usb/serial/io_edgeport.h | 16 +++--- + drivers/usb/serial/io_ionsp.h | 97 +++++++++++++++++++-------------------- + drivers/usb/serial/io_ti.h | 92 +++++++++++++++++++----------------- + drivers/usb/serial/io_usbvend.h | 87 +++++++++++++++------------------- + 4 files changed, 144 insertions(+), 148 deletions(-) + +--- a/drivers/usb/serial/io_edgeport.h ++++ b/drivers/usb/serial/io_edgeport.h +@@ -34,15 +34,15 @@ + + + +-/* The following table is used to map the USBx port number to ++/* The following table is used to map the USBx port number to + * the device serial number (or physical USB path), */ + #define MAX_EDGEPORTS 64 + + struct comMapper { + char SerialNumber[MAX_SERIALNUMBER_LEN+1]; /* Serial number/usb path */ +- int numPorts; /* Number of ports */ +- int Original[MAX_RS232_PORTS]; /* Port numbers set by IOCTL */ +- int Port[MAX_RS232_PORTS]; /* Actual used port numbers */ ++ int numPorts; /* Number of ports */ ++ int Original[MAX_RS232_PORTS]; /* Port numbers set by IOCTL */ ++ int Port[MAX_RS232_PORTS]; /* Actual used port numbers */ + }; + + +@@ -51,7 +51,7 @@ struct comMapper { + /* /proc/edgeport Interface + * This interface uses read/write/lseek interface to talk to the edgeport driver + * the following read functions are supported: */ +-#define PROC_GET_MAPPING_TO_PATH 1 ++#define PROC_GET_MAPPING_TO_PATH 1 + #define PROC_GET_COM_ENTRY 2 + #define PROC_GET_EDGE_MANUF_DESCRIPTOR 3 + #define PROC_GET_BOOT_DESCRIPTOR 4 +@@ -64,7 +64,7 @@ struct comMapper { + + + /* the following write functions are supported: */ +-#define PROC_SET_COM_MAPPING 1 ++#define PROC_SET_COM_MAPPING 1 + #define PROC_SET_COM_ENTRY 2 + + +@@ -97,8 +97,8 @@ struct edgeport_product_info { + __u8 BoardRev; /* PCB revision level (chg only if s/w visible) */ + + __u8 BootMajorVersion; /* Boot Firmware version: xx. */ +- __u8 BootMinorVersion; /* yy. */ +- __le16 BootBuildNumber; /* zzzz (LE format) */ ++ __u8 BootMinorVersion; /* yy. */ ++ __le16 BootBuildNumber; /* zzzz (LE format) */ + + __u8 FirmwareMajorVersion; /* Operational Firmware version:xx. */ + __u8 FirmwareMinorVersion; /* yy. */ +--- a/drivers/usb/serial/io_ionsp.h ++++ b/drivers/usb/serial/io_ionsp.h +@@ -89,10 +89,10 @@ All 16-bit fields are sent in little-end + // + + struct int_status_pkt { +- __u16 RxBytesAvail; // Additional bytes available to +- // be read from Bulk IN pipe +- __u16 TxCredits[ MAX_RS232_PORTS ]; // Additional space available in +- // given port's TxBuffer ++ __u16 RxBytesAvail; // Additional bytes available to ++ // be read from Bulk IN pipe ++ __u16 TxCredits[MAX_RS232_PORTS]; // Additional space available in ++ // given port's TxBuffer + }; + + +@@ -115,24 +115,24 @@ struct int_status_pkt { + #define IOSP_CMD_STAT_BIT 0x80 // If set, this is command/status header + + #define IS_CMD_STAT_HDR(Byte1) ((Byte1) & IOSP_CMD_STAT_BIT) +-#define IS_DATA_HDR(Byte1) (! IS_CMD_STAT_HDR(Byte1)) ++#define IS_DATA_HDR(Byte1) (!IS_CMD_STAT_HDR(Byte1)) + + #define IOSP_GET_HDR_PORT(Byte1) ((__u8) ((Byte1) & IOSP_PORT_MASK)) +-#define IOSP_GET_HDR_DATA_LEN(Byte1, Byte2) ((__u16) ( ((__u16)((Byte1) & 0x78)) << 5) | (Byte2)) ++#define IOSP_GET_HDR_DATA_LEN(Byte1, Byte2) ((__u16) (((__u16)((Byte1) & 0x78)) << 5) | (Byte2)) + #define IOSP_GET_STATUS_CODE(Byte1) ((__u8) (((Byte1) & 0x78) >> 3)) + + + // + // These macros build the 1st and 2nd bytes for a data header + // +-#define IOSP_BUILD_DATA_HDR1(Port, Len) ((__u8) (((Port) | ((__u8) (((__u16) (Len)) >> 5) & 0x78 )))) ++#define IOSP_BUILD_DATA_HDR1(Port, Len) ((__u8) (((Port) | ((__u8) (((__u16) (Len)) >> 5) & 0x78)))) + #define IOSP_BUILD_DATA_HDR2(Port, Len) ((__u8) (Len)) + + + // + // These macros build the 1st and 2nd bytes for a command header + // +-#define IOSP_BUILD_CMD_HDR1(Port, Cmd) ((__u8) ( IOSP_CMD_STAT_BIT | (Port) | ((__u8) ((Cmd) << 3)) )) ++#define IOSP_BUILD_CMD_HDR1(Port, Cmd) ((__u8) (IOSP_CMD_STAT_BIT | (Port) | ((__u8) ((Cmd) << 3)))) + + + //-------------------------------------------------------------- +@@ -194,24 +194,25 @@ struct int_status_pkt { + // Define macros to simplify building of IOSP cmds + // + +-#define MAKE_CMD_WRITE_REG(ppBuf, pLen, Port, Reg, Val) \ +- do { \ +- (*(ppBuf))[0] = IOSP_BUILD_CMD_HDR1( (Port), IOSP_WRITE_UART_REG(Reg) ); \ +- (*(ppBuf))[1] = (Val); \ +- \ +- *ppBuf += 2; \ +- *pLen += 2; \ +- } while (0) +- +-#define MAKE_CMD_EXT_CMD(ppBuf, pLen, Port, ExtCmd, Param) \ +- do { \ +- (*(ppBuf))[0] = IOSP_BUILD_CMD_HDR1( (Port), IOSP_EXT_CMD ); \ +- (*(ppBuf))[1] = (ExtCmd); \ +- (*(ppBuf))[2] = (Param); \ +- \ +- *ppBuf += 3; \ +- *pLen += 3; \ +- } while (0) ++#define MAKE_CMD_WRITE_REG(ppBuf, pLen, Port, Reg, Val) \ ++do { \ ++ (*(ppBuf))[0] = IOSP_BUILD_CMD_HDR1((Port), \ ++ IOSP_WRITE_UART_REG(Reg)); \ ++ (*(ppBuf))[1] = (Val); \ ++ \ ++ *ppBuf += 2; \ ++ *pLen += 2; \ ++} while (0) ++ ++#define MAKE_CMD_EXT_CMD(ppBuf, pLen, Port, ExtCmd, Param) \ ++do { \ ++ (*(ppBuf))[0] = IOSP_BUILD_CMD_HDR1((Port), IOSP_EXT_CMD); \ ++ (*(ppBuf))[1] = (ExtCmd); \ ++ (*(ppBuf))[2] = (Param); \ ++ \ ++ *ppBuf += 3; \ ++ *pLen += 3; \ ++} while (0) + + + +@@ -310,16 +311,16 @@ struct int_status_pkt { + // + // IOSP_CMD_RX_CHECK_REQ + // +-// This command is used to assist in the implementation of the +-// IOCTL_SERIAL_PURGE Windows IOCTL. +-// This IOSP command tries to place a marker at the end of the RX +-// queue in the Edgeport. If the Edgeport RX queue is full then +-// the Check will be discarded. +-// It is up to the device driver to timeout waiting for the +-// RX_CHECK_RSP. If a RX_CHECK_RSP is received, the driver is +-// sure that all data has been received from the edgeport and ++// This command is used to assist in the implementation of the ++// IOCTL_SERIAL_PURGE Windows IOCTL. ++// This IOSP command tries to place a marker at the end of the RX ++// queue in the Edgeport. If the Edgeport RX queue is full then ++// the Check will be discarded. ++// It is up to the device driver to timeout waiting for the ++// RX_CHECK_RSP. If a RX_CHECK_RSP is received, the driver is ++// sure that all data has been received from the edgeport and + // may now purge any internal RX buffers. +-// Note tat the sequence numbers may be used to detect lost ++// Note tat the sequence numbers may be used to detect lost + // CHECK_REQs. + + // Example for Port 0 +@@ -341,7 +342,7 @@ struct int_status_pkt { + // + // 1ssssPPP P1P1P1P1 [ P2P2P2P2P2 ]... + // +-// ssss: 00-07 2-byte status. ssss identifies which UART register ++// ssss: 00-07 2-byte status. ssss identifies which UART register + // has changed value, and the new value is in P1. + // Note that the ssss values do not correspond to the + // 16554 register numbers given in 16554.H. Instead, +@@ -383,14 +384,14 @@ struct int_status_pkt { + // returns this in order to report + // changes in modem status lines + // (CTS, DSR, RI, CD) +-// ++// + + // 0x02 // Available for future expansion +-// 0x03 // +-// 0x04 // +-// 0x05 // +-// 0x06 // +-// 0x07 // ++// 0x03 // ++// 0x04 // ++// 0x05 // ++// 0x06 // ++// 0x07 // + + + /**************************************************** +@@ -400,7 +401,7 @@ struct int_status_pkt { + #define IOSP_STATUS_LSR_DATA 0x08 // P1 is new value of LSR register (same as STATUS_LSR) + + // P2 is errored character read from +-// RxFIFO after LSR reported an error. ++// RxFIFO after LSR reported an error. + + #define IOSP_EXT_STATUS 0x09 // P1 is status/response code, param in P2. + +@@ -408,7 +409,7 @@ struct int_status_pkt { + // Response Codes (P1 values) for 3-byte status messages + + #define IOSP_EXT_STATUS_CHASE_RSP 0 // Reply to CHASE_PORT cmd. P2 is outcome: +-#define IOSP_EXT_STATUS_CHASE_PASS 0 // P2 = 0: All Tx data drained successfully ++#define IOSP_EXT_STATUS_CHASE_PASS 0 // P2 = 0: All Tx data drained successfully + #define IOSP_EXT_STATUS_CHASE_FAIL 1 // P2 = 1: Timed out (stuck due to flow + + // control from remote device). +@@ -446,9 +447,9 @@ struct int_status_pkt { + // Macros to parse status messages + // + +-#define IOSP_GET_STATUS_LEN(code) ( (code) < 8 ? 2 : ((code) < 0x0A ? 3 : 4) ) ++#define IOSP_GET_STATUS_LEN(code) ((code) < 8 ? 2 : ((code) < 0x0A ? 3 : 4)) + +-#define IOSP_STATUS_IS_2BYTE(code) ( (code) < 0x08 ) +-#define IOSP_STATUS_IS_3BYTE(code) ( ((code) >= 0x08) && ((code) <= 0x0B) ) +-#define IOSP_STATUS_IS_4BYTE(code) ( ((code) >= 0x0C) && ((code) <= 0x0D) ) ++#define IOSP_STATUS_IS_2BYTE(code) ((code) < 0x08) ++#define IOSP_STATUS_IS_3BYTE(code) (((code) >= 0x08) && ((code) <= 0x0B)) ++#define IOSP_STATUS_IS_4BYTE(code) (((code) >= 0x0C) && ((code) <= 0x0D)) + +--- a/drivers/usb/serial/io_ti.h ++++ b/drivers/usb/serial/io_ti.h +@@ -1,4 +1,4 @@ +-/***************************************************************************** ++/***************************************************************************** + * + * Copyright (C) 1997-2002 Inside Out Networks, Inc. + * +@@ -22,10 +22,10 @@ + #define DTK_ADDR_SPACE_I2C_TYPE_II 0x82 /* Addr is placed in I2C area */ + #define DTK_ADDR_SPACE_I2C_TYPE_III 0x83 /* Addr is placed in I2C area */ + +-// UART Defines +-#define UMPMEM_BASE_UART1 0xFFA0 /* UMP UART1 base address */ +-#define UMPMEM_BASE_UART2 0xFFB0 /* UMP UART2 base address */ +-#define UMPMEM_OFFS_UART_LSR 0x05 /* UMP UART LSR register offset */ ++/* UART Defines */ ++#define UMPMEM_BASE_UART1 0xFFA0 /* UMP UART1 base address */ ++#define UMPMEM_BASE_UART2 0xFFB0 /* UMP UART2 base address */ ++#define UMPMEM_OFFS_UART_LSR 0x05 /* UMP UART LSR register offset */ + + /* Bits per character */ + #define UMP_UART_CHAR5BITS 0x00 +@@ -54,7 +54,7 @@ + #define UMP_UART_LSR_RX_MASK 0x10 + #define UMP_UART_LSR_TX_MASK 0x20 + +-#define UMP_UART_LSR_DATA_MASK ( LSR_PAR_ERR | LSR_FRM_ERR | LSR_BREAK ) ++#define UMP_UART_LSR_DATA_MASK (LSR_PAR_ERR | LSR_FRM_ERR | LSR_BREAK) + + /* Port Settings Constants) */ + #define UMP_MASK_UART_FLAGS_RTS_FLOW 0x0001 +@@ -79,50 +79,57 @@ + #define UMP_PORT_DIR_OUT 0x01 + #define UMP_PORT_DIR_IN 0x02 + +-// Address of Port 0 +-#define UMPM_UART1_PORT 0x03 ++/* Address of Port 0 */ ++#define UMPM_UART1_PORT 0x03 + +-// Commands +-#define UMPC_SET_CONFIG 0x05 +-#define UMPC_OPEN_PORT 0x06 +-#define UMPC_CLOSE_PORT 0x07 +-#define UMPC_START_PORT 0x08 +-#define UMPC_STOP_PORT 0x09 +-#define UMPC_TEST_PORT 0x0A +-#define UMPC_PURGE_PORT 0x0B +- +-#define UMPC_COMPLETE_READ 0x80 // Force the Firmware to complete the current Read +-#define UMPC_HARDWARE_RESET 0x81 // Force UMP back into BOOT Mode +-#define UMPC_COPY_DNLD_TO_I2C 0x82 // Copy current download image to type 0xf2 record in 16k I2C +- // firmware will change 0xff record to type 2 record when complete +- +- // Special function register commands +- // wIndex is register address +- // wValue is MSB/LSB mask/data +-#define UMPC_WRITE_SFR 0x83 // Write SFR Register ++/* Commands */ ++#define UMPC_SET_CONFIG 0x05 ++#define UMPC_OPEN_PORT 0x06 ++#define UMPC_CLOSE_PORT 0x07 ++#define UMPC_START_PORT 0x08 ++#define UMPC_STOP_PORT 0x09 ++#define UMPC_TEST_PORT 0x0A ++#define UMPC_PURGE_PORT 0x0B ++ ++/* Force the Firmware to complete the current Read */ ++#define UMPC_COMPLETE_READ 0x80 ++/* Force UMP back into BOOT Mode */ ++#define UMPC_HARDWARE_RESET 0x81 ++/* ++ * Copy current download image to type 0xf2 record in 16k I2C ++ * firmware will change 0xff record to type 2 record when complete ++ */ ++#define UMPC_COPY_DNLD_TO_I2C 0x82 ++ ++/* ++ * Special function register commands ++ * wIndex is register address ++ * wValue is MSB/LSB mask/data ++ */ ++#define UMPC_WRITE_SFR 0x83 /* Write SFR Register */ + +- // wIndex is register address +-#define UMPC_READ_SFR 0x84 // Read SRF Register ++/* wIndex is register address */ ++#define UMPC_READ_SFR 0x84 /* Read SRF Register */ + +- // Set or Clear DTR (wValue bit 0 Set/Clear) wIndex ModuleID (port) ++/* Set or Clear DTR (wValue bit 0 Set/Clear) wIndex ModuleID (port) */ + #define UMPC_SET_CLR_DTR 0x85 + +- // Set or Clear RTS (wValue bit 0 Set/Clear) wIndex ModuleID (port) ++/* Set or Clear RTS (wValue bit 0 Set/Clear) wIndex ModuleID (port) */ + #define UMPC_SET_CLR_RTS 0x86 + +- // Set or Clear LOOPBACK (wValue bit 0 Set/Clear) wIndex ModuleID (port) ++/* Set or Clear LOOPBACK (wValue bit 0 Set/Clear) wIndex ModuleID (port) */ + #define UMPC_SET_CLR_LOOPBACK 0x87 + +- // Set or Clear BREAK (wValue bit 0 Set/Clear) wIndex ModuleID (port) ++/* Set or Clear BREAK (wValue bit 0 Set/Clear) wIndex ModuleID (port) */ + #define UMPC_SET_CLR_BREAK 0x88 + +- // Read MSR wIndex ModuleID (port) ++/* Read MSR wIndex ModuleID (port) */ + #define UMPC_READ_MSR 0x89 + +- /* Toolkit commands */ +- /* Read-write group */ +-#define UMPC_MEMORY_READ 0x92 +-#define UMPC_MEMORY_WRITE 0x93 ++/* Toolkit commands */ ++/* Read-write group */ ++#define UMPC_MEMORY_READ 0x92 ++#define UMPC_MEMORY_WRITE 0x93 + + /* + * UMP DMA Definitions +@@ -130,8 +137,7 @@ + #define UMPD_OEDB1_ADDRESS 0xFF08 + #define UMPD_OEDB2_ADDRESS 0xFF10 + +-struct out_endpoint_desc_block +-{ ++struct out_endpoint_desc_block { + __u8 Configuration; + __u8 XBufAddr; + __u8 XByteCount; +@@ -147,8 +153,8 @@ struct out_endpoint_desc_block + * TYPE DEFINITIONS + * Structures for Firmware commands + */ +-struct ump_uart_config /* UART settings */ +-{ ++/* UART settings */ ++struct ump_uart_config { + __u16 wBaudRate; /* Baud rate */ + __u16 wFlags; /* Bitmap mask of flags */ + __u8 bDataBits; /* 5..8 - data bits per character */ +@@ -165,8 +171,8 @@ struct ump_uart_config /* UART settings + * TYPE DEFINITIONS + * Structures for USB interrupts + */ +-struct ump_interrupt /* Interrupt packet structure */ +-{ ++/* Interrupt packet structure */ ++struct ump_interrupt { + __u8 bICode; /* Interrupt code (interrupt num) */ + __u8 bIInfo; /* Interrupt information */ + } __attribute__((packed)); +--- a/drivers/usb/serial/io_usbvend.h ++++ b/drivers/usb/serial/io_usbvend.h +@@ -26,7 +26,7 @@ + + // + // Definitions of USB product IDs +-// ++// + + #define USB_VENDOR_ID_ION 0x1608 // Our VID + #define USB_VENDOR_ID_TI 0x0451 // TI VID +@@ -54,7 +54,7 @@ + // Product IDs - assigned to match middle digit of serial number (No longer true) + + #define ION_DEVICE_ID_80251_NETCHIP 0x020 // This bit is set in the PID if this edgeport hardware$ +- // is based on the 80251+Netchip. ++ // is based on the 80251+Netchip. + + #define ION_DEVICE_ID_GENERATION_1 0x00 // Value for 930 based edgeports + #define ION_DEVICE_ID_GENERATION_2 0x01 // Value for 80251+Netchip. +@@ -134,7 +134,7 @@ + #define ION_DEVICE_ID_TI_EDGEPORT_416 0x0212 // Edgeport/416 + #define ION_DEVICE_ID_TI_EDGEPORT_1 0x0215 // Edgeport/1 RS232 + #define ION_DEVICE_ID_TI_EDGEPORT_42 0x0217 // Edgeport/42 4 hub 2 RS232 +-#define ION_DEVICE_ID_TI_EDGEPORT_22I 0x021A // Edgeport/22I is an Edgeport/4 with ports 1&2 RS422 and ports 3&4 RS232 ++#define ION_DEVICE_ID_TI_EDGEPORT_22I 0x021A // Edgeport/22I is an Edgeport/4 with ports 1&2 RS422 and ports 3&4 RS232 + #define ION_DEVICE_ID_TI_EDGEPORT_2C 0x021B // Edgeport/2c RS232 + #define ION_DEVICE_ID_TI_EDGEPORT_221C 0x021C // Edgeport/221c is a TI based Edgeport/2 with lucent chip and + // 2 external hub ports - Large I2C +@@ -142,7 +142,7 @@ + // 2 external hub ports - Large I2C + #define ION_DEVICE_ID_TI_EDGEPORT_21C 0x021E // Edgeport/21c is a TI based Edgeport/2 with lucent chip + +-// Generation 3 devices -- 3410 based edgport/1 (256 byte I2C) ++// Generation 3 devices -- 3410 based edgport/1 (256 byte I2C) + #define ION_DEVICE_ID_TI_TI3410_EDGEPORT_1 0x0240 // Edgeport/1 RS232 + #define ION_DEVICE_ID_TI_TI3410_EDGEPORT_1I 0x0241 // Edgeport/1i- RS422 model + +@@ -176,7 +176,7 @@ + // Default to /P function + + #define ION_DEVICE_ID_PLUS_PWR_HP4CD 0x30C // 5052 Plus Power HubPort/4CD+ (for Dell) +-#define ION_DEVICE_ID_PLUS_PWR_HP4C 0x30D // 5052 Plus Power HubPort/4C+ ++#define ION_DEVICE_ID_PLUS_PWR_HP4C 0x30D // 5052 Plus Power HubPort/4C+ + #define ION_DEVICE_ID_PLUS_PWR_PCI 0x30E // 3410 Plus Power PCI Host Controller 4 port + + +@@ -217,17 +217,17 @@ + #define ION_DEVICE_ID_MT4X56USB 0x1403 // OEM device + + +-#define GENERATION_ID_FROM_USB_PRODUCT_ID( ProductId ) \ +- ( (__u16) ((ProductId >> 8) & (ION_GENERATION_MASK)) ) ++#define GENERATION_ID_FROM_USB_PRODUCT_ID(ProductId) \ ++ ((__u16) ((ProductId >> 8) & (ION_GENERATION_MASK))) + +-#define MAKE_USB_PRODUCT_ID( OemId, DeviceId ) \ +- ( (__u16) (((OemId) << 10) || (DeviceId)) ) ++#define MAKE_USB_PRODUCT_ID(OemId, DeviceId) \ ++ ((__u16) (((OemId) << 10) || (DeviceId))) + +-#define DEVICE_ID_FROM_USB_PRODUCT_ID( ProductId ) \ +- ( (__u16) ((ProductId) & (EDGEPORT_DEVICE_ID_MASK)) ) ++#define DEVICE_ID_FROM_USB_PRODUCT_ID(ProductId) \ ++ ((__u16) ((ProductId) & (EDGEPORT_DEVICE_ID_MASK))) + +-#define OEM_ID_FROM_USB_PRODUCT_ID( ProductId ) \ +- ( (__u16) (((ProductId) >> 10) & 0x3F) ) ++#define OEM_ID_FROM_USB_PRODUCT_ID(ProductId) \ ++ ((__u16) (((ProductId) >> 10) & 0x3F)) + + // + // Definitions of parameters for download code. Note that these are +@@ -237,7 +237,7 @@ + + // TxCredits value below which driver won't bother sending (to prevent too many small writes). + // Send only if above 25% +-#define EDGE_FW_GET_TX_CREDITS_SEND_THRESHOLD(InitialCredit, MaxPacketSize) (max( ((InitialCredit) / 4), (MaxPacketSize) )) ++#define EDGE_FW_GET_TX_CREDITS_SEND_THRESHOLD(InitialCredit, MaxPacketSize) (max(((InitialCredit) / 4), (MaxPacketSize))) + + #define EDGE_FW_BULK_MAX_PACKET_SIZE 64 // Max Packet Size for Bulk In Endpoint (EP1) + #define EDGE_FW_BULK_READ_BUFFER_SIZE 1024 // Size to use for Bulk reads +@@ -263,7 +263,7 @@ + // wValue = 16-bit address + // wIndex = unused (though we could put segment 00: or FF: here) + // wLength = # bytes to read/write (max 64) +-// ++// + + #define USB_REQUEST_ION_RESET_DEVICE 0 // Warm reboot Edgeport, retaining USB address + #define USB_REQUEST_ION_GET_EPIC_DESC 1 // Get Edgeport Compatibility Descriptor +@@ -278,7 +278,7 @@ + #define USB_REQUEST_ION_ENABLE_SUSPEND 9 // Enable/Disable suspend feature + // (wValue != 0: Enable; wValue = 0: Disable) + +-#define USB_REQUEST_ION_SEND_IOSP 10 // Send an IOSP command to the edgeport over the control pipe ++#define USB_REQUEST_ION_SEND_IOSP 10 // Send an IOSP command to the edgeport over the control pipe + #define USB_REQUEST_ION_RECV_IOSP 11 // Receive an IOSP command from the edgeport over the control pipe + + +@@ -301,8 +301,7 @@ + // this is a "real" Edgeport. + // + +-struct edge_compatibility_bits +-{ ++struct edge_compatibility_bits { + // This __u32 defines which Vendor-specific commands/functionality + // the device supports on the default EP0 pipe. + +@@ -334,24 +333,22 @@ struct edge_compatibility_bits + __u32 TrueEdgeport : 1; // 0001 Set if device is a 'real' Edgeport + // (Used only by driver, NEVER set by an EPiC device) + __u32 GenUnused : 31; // Available for future expansion, must be 0 +- + }; + + #define EDGE_COMPATIBILITY_MASK0 0x0001 + #define EDGE_COMPATIBILITY_MASK1 0x3FFF + #define EDGE_COMPATIBILITY_MASK2 0x0001 + +-struct edge_compatibility_descriptor +-{ ++struct edge_compatibility_descriptor { + __u8 Length; // Descriptor Length (per USB spec) + __u8 DescType; // Descriptor Type (per USB spec, =DEVICE type) + __u8 EpicVer; // Version of EPiC spec supported +- // (Currently must be 1) ++ // (Currently must be 1) + __u8 NumPorts; // Number of serial ports supported + __u8 iDownloadFile; // Index of string containing download code filename +- // 0=no download, FF=download compiled into driver. +- __u8 Unused[ 3 ]; // Available for future expansion, must be 0 +- // (Currently must be 0). ++ // 0=no download, FF=download compiled into driver. ++ __u8 Unused[3]; // Available for future expansion, must be 0 ++ // (Currently must be 0). + __u8 MajorVersion; // Firmware version: xx. + __u8 MinorVersion; // yy. + __le16 BuildNumber; // zzzz (LE format) +@@ -359,9 +356,7 @@ struct edge_compatibility_descriptor + // The following structure contains __u32s, with each bit + // specifying whether the EPiC device supports the given + // command or functionality. +- + struct edge_compatibility_bits Supports; +- + }; + + // Values for iDownloadFile +@@ -391,8 +386,8 @@ struct edge_compatibility_descriptor + + // Define the max block size that may be read or written + // in a read/write RAM/ROM command. +-#define MAX_SIZE_REQ_ION_READ_MEM ( (__u16) 64 ) +-#define MAX_SIZE_REQ_ION_WRITE_MEM ( (__u16) 64 ) ++#define MAX_SIZE_REQ_ION_READ_MEM ((__u16)64) ++#define MAX_SIZE_REQ_ION_WRITE_MEM ((__u16)64) + + + // +@@ -545,7 +540,7 @@ struct edge_boot_descriptor { + __u8 MajorVersion; // C6 Firmware version: xx. + __u8 MinorVersion; // C7 yy. + __le16 BuildNumber; // C8 zzzz (LE format) +- ++ + __u16 EnumRootDescTable; // CA Root of ROM-based descriptor table + __u8 NumDescTypes; // CC Number of supported descriptor types + +@@ -597,41 +592,36 @@ struct edge_boot_descriptor { + #define I2C_DESC_TYPE_ION 0 // Not defined by TI + + +-struct ti_i2c_desc +-{ ++struct ti_i2c_desc { + __u8 Type; // Type of descriptor + __u16 Size; // Size of data only not including header + __u8 CheckSum; // Checksum (8 bit sum of data only) + __u8 Data[0]; // Data starts here +-}__attribute__((packed)); ++} __attribute__((packed)); + + // for 5152 devices only (type 2 record) + // for 3410 the version is stored in the WATCHPORT_FIRMWARE_VERSION descriptor +-struct ti_i2c_firmware_rec +-{ ++struct ti_i2c_firmware_rec { + __u8 Ver_Major; // Firmware Major version number + __u8 Ver_Minor; // Firmware Minor version number + __u8 Data[0]; // Download starts here +-}__attribute__((packed)); ++} __attribute__((packed)); + + +-struct watchport_firmware_version +-{ ++struct watchport_firmware_version { + // Added 2 bytes for version number + __u8 Version_Major; // Download Version (for Watchport) + __u8 Version_Minor; +-}__attribute__((packed)); ++} __attribute__((packed)); + + + // Structure of header of download image in fw_down.h +-struct ti_i2c_image_header +-{ ++struct ti_i2c_image_header { + __le16 Length; + __u8 CheckSum; +-}__attribute__((packed)); ++} __attribute__((packed)); + +-struct ti_basic_descriptor +-{ ++struct ti_basic_descriptor { + __u8 Power; // Self powered + // bit 7: 1 - power switching supported + // 0 - power switching not supported +@@ -663,9 +653,9 @@ struct ti_basic_descriptor + #define TI_I2C_SIZE_MASK 0x1f // 5 bits + #define TI_GET_I2C_SIZE(x) ((((x) & TI_I2C_SIZE_MASK)+1)*256) + +-#define TI_MAX_I2C_SIZE ( 16 * 1024 ) ++#define TI_MAX_I2C_SIZE (16 * 1024) + +-#define TI_MANUF_VERSION_0 0 ++#define TI_MANUF_VERSION_0 0 + + // IonConig2 flags + #define TI_CONFIG2_RS232 0x01 +@@ -676,8 +666,7 @@ struct ti_basic_descriptor + #define TI_CONFIG2_WATCHPORT 0x10 + + +-struct edge_ti_manuf_descriptor +-{ ++struct edge_ti_manuf_descriptor { + __u8 IonConfig; // Config byte for ION manufacturing use + __u8 IonConfig2; // Expansion + __u8 Version; // Version +@@ -688,7 +677,7 @@ struct edge_ti_manuf_descriptor + __u8 HubConfig2; // Used to configure the Hub + __u8 TotalPorts; // Total Number of Com Ports for the entire device (All UMPs) + __u8 Reserved; // Reserved +-}__attribute__((packed)); ++} __attribute__((packed)); + + + #endif // if !defined(_USBVEND_H) diff --git a/usb/usb-ipaq-reimplement-using-generic-framework.patch b/usb/usb-ipaq-reimplement-using-generic-framework.patch new file mode 100644 index 00000000000000..85a20629b3c548 --- /dev/null +++ b/usb/usb-ipaq-reimplement-using-generic-framework.patch @@ -0,0 +1,498 @@ +From jhovold@gmail.com Mon May 17 11:07:49 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sat, 15 May 2010 17:53:46 +0200 +Subject: USB: ipaq: reimplement using generic framework +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com> +Message-ID: <1273938833-11366-5-git-send-email-jhovold@gmail.com> + + +Kill custom fifo, read and write implementations (single-urb and fifo, +but still maintained list of 256*256b urb buffers per port). + +Compile-only tested. + +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/ipaq.c | 333 +--------------------------------------------- + drivers/usb/serial/ipaq.h | 54 ------- + 2 files changed, 10 insertions(+), 377 deletions(-) + +--- a/drivers/usb/serial/ipaq.c ++++ b/drivers/usb/serial/ipaq.c +@@ -56,7 +56,6 @@ + #include <linux/uaccess.h> + #include <linux/usb.h> + #include <linux/usb/serial.h> +-#include "ipaq.h" + + #define KP_RETRIES 100 + +@@ -64,7 +63,7 @@ + * Version Information + */ + +-#define DRIVER_VERSION "v0.5" ++#define DRIVER_VERSION "v1.0" + #define DRIVER_AUTHOR "Ganesh Varadarajan <ganesh@veritas.com>" + #define DRIVER_DESC "USB PocketPC PDA driver" + +@@ -76,20 +75,8 @@ static int initial_wait; + /* Function prototypes for an ipaq */ + static int ipaq_open(struct tty_struct *tty, + struct usb_serial_port *port); +-static void ipaq_close(struct usb_serial_port *port); + static int ipaq_calc_num_ports(struct usb_serial *serial); + static int ipaq_startup(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 void ipaq_write_gather(struct usb_serial_port *port); +-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); +-static void ipaq_destroy_lists(struct usb_serial_port *port); +- + + static struct usb_device_id ipaq_id_table [] = { + /* The first entry is a placeholder for the insmod-specified device */ +@@ -558,7 +545,7 @@ static struct usb_driver ipaq_driver = { + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = ipaq_id_table, +- .no_dynamic_id = 1, ++ .no_dynamic_id = 1, + }; + + +@@ -569,67 +556,24 @@ static struct usb_serial_driver ipaq_dev + .name = "ipaq", + }, + .description = "PocketPC PDA", +- .usb_driver = &ipaq_driver, ++ .usb_driver = &ipaq_driver, + .id_table = ipaq_id_table, +- .bulk_in_size = URBDATA_SIZE, +- .bulk_out_size = URBDATA_SIZE, ++ .bulk_in_size = 256, ++ .bulk_out_size = 256, + .open = ipaq_open, +- .close = ipaq_close, + .attach = ipaq_startup, + .calc_num_ports = ipaq_calc_num_ports, +- .write = ipaq_write, +- .write_room = ipaq_write_room, +- .chars_in_buffer = ipaq_chars_in_buffer, +- .read_bulk_callback = ipaq_read_bulk_callback, +- .write_bulk_callback = ipaq_write_bulk_callback, + }; + +-static spinlock_t write_list_lock; +-static int bytes_in; +-static int bytes_out; +- + static int ipaq_open(struct tty_struct *tty, + struct usb_serial_port *port) + { + struct usb_serial *serial = port->serial; +- struct ipaq_private *priv; +- struct ipaq_packet *pkt; +- int i, result = 0; ++ int result = 0; + int retries = connect_retries; + + dbg("%s - port %d", __func__, port->number); + +- bytes_in = 0; +- bytes_out = 0; +- priv = kmalloc(sizeof(struct ipaq_private), GFP_KERNEL); +- if (priv == NULL) { +- dev_err(&port->dev, "%s - Out of memory\n", __func__); +- return -ENOMEM; +- } +- usb_set_serial_port_data(port, priv); +- priv->active = 0; +- priv->queue_len = 0; +- priv->free_len = 0; +- INIT_LIST_HEAD(&priv->queue); +- INIT_LIST_HEAD(&priv->freelist); +- +- for (i = 0; i < URBDATA_QUEUE_MAX / PACKET_SIZE; i++) { +- pkt = kmalloc(sizeof(struct ipaq_packet), GFP_KERNEL); +- if (pkt == NULL) +- goto enomem; +- +- pkt->data = kmalloc(PACKET_SIZE, GFP_KERNEL); +- if (pkt->data == NULL) { +- kfree(pkt); +- goto enomem; +- } +- pkt->len = 0; +- pkt->written = 0; +- INIT_LIST_HEAD(&pkt->list); +- list_add(&pkt->list, &priv->freelist); +- priv->free_len += PACKET_SIZE; +- } +- + msleep(1000*initial_wait); + + /* +@@ -639,7 +583,6 @@ static int ipaq_open(struct tty_struct * + * through. Since this has a reasonably high failure rate, we retry + * several times. + */ +- + while (retries--) { + result = usb_control_msg(serial->dev, + usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, +@@ -649,269 +592,15 @@ static int ipaq_open(struct tty_struct * + + msleep(1000); + } +- + if (!retries && result) { +- dev_err(&port->dev, "%s - failed doing control urb, error %d\n", __func__, result); +- goto error; +- } +- +- /* Start reading from the device */ +- usb_fill_bulk_urb(port->read_urb, serial->dev, +- usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), +- port->read_urb->transfer_buffer, +- port->read_urb->transfer_buffer_length, +- ipaq_read_bulk_callback, port); +- +- result = usb_submit_urb(port->read_urb, GFP_KERNEL); +- if (result) { +- dev_err(&port->dev, +- "%s - failed submitting read urb, error %d\n", +- __func__, result); +- goto error; +- } +- +- return 0; +- +-enomem: +- result = -ENOMEM; +- dev_err(&port->dev, "%s - Out of memory\n", __func__); +-error: +- ipaq_destroy_lists(port); +- kfree(priv); +- return result; +-} +- +- +-static void ipaq_close(struct usb_serial_port *port) +-{ +- struct ipaq_private *priv = usb_get_serial_port_data(port); +- +- dbg("%s - port %d", __func__, port->number); +- +- /* +- * shut down bulk read and write +- */ +- usb_kill_urb(port->write_urb); +- usb_kill_urb(port->read_urb); +- ipaq_destroy_lists(port); +- kfree(priv); +- usb_set_serial_port_data(port, NULL); +- +- /* Uncomment the following line if you want to see some statistics +- * in your syslog */ +- /* info ("Bytes In = %d Bytes Out = %d", bytes_in, bytes_out); */ +-} +- +-static void ipaq_read_bulk_callback(struct urb *urb) +-{ +- struct usb_serial_port *port = urb->context; +- struct tty_struct *tty; +- unsigned char *data = urb->transfer_buffer; +- int result; +- int status = urb->status; +- +- dbg("%s - port %d", __func__, port->number); +- +- if (status) { +- dbg("%s - nonzero read bulk status received: %d", +- __func__, status); +- return; +- } +- +- usb_serial_debug_data(debug, &port->dev, __func__, +- urb->actual_length, data); +- +- tty = tty_port_tty_get(&port->port); +- if (tty && urb->actual_length) { +- tty_insert_flip_string(tty, data, urb->actual_length); +- tty_flip_buffer_push(tty); +- bytes_in += urb->actual_length; +- } +- tty_kref_put(tty); +- +- /* Continue trying to always read */ +- usb_fill_bulk_urb(port->read_urb, port->serial->dev, +- usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress), +- port->read_urb->transfer_buffer, +- port->read_urb->transfer_buffer_length, +- ipaq_read_bulk_callback, port); +- result = usb_submit_urb(port->read_urb, GFP_ATOMIC); +- if (result) +- dev_err(&port->dev, +- "%s - failed resubmitting read urb, error %d\n", +- __func__, result); +- return; +-} +- +-static int ipaq_write(struct tty_struct *tty, struct usb_serial_port *port, +- const unsigned char *buf, int count) +-{ +- const unsigned char *current_position = buf; +- int bytes_sent = 0; +- int transfer_size; +- +- dbg("%s - port %d", __func__, port->number); +- +- while (count > 0) { +- transfer_size = min(count, PACKET_SIZE); +- if (ipaq_write_bulk(port, current_position, transfer_size)) +- break; +- current_position += transfer_size; +- bytes_sent += transfer_size; +- count -= transfer_size; +- bytes_out += transfer_size; +- } +- +- return bytes_sent; +-} +- +-static int ipaq_write_bulk(struct usb_serial_port *port, +- const unsigned char *buf, int count) +-{ +- struct ipaq_private *priv = usb_get_serial_port_data(port); +- struct ipaq_packet *pkt = NULL; +- int result = 0; +- unsigned long flags; +- +- if (priv->free_len <= 0) { +- dbg("%s - we're stuffed", __func__); +- return -EAGAIN; +- } +- +- spin_lock_irqsave(&write_list_lock, flags); +- if (!list_empty(&priv->freelist)) { +- pkt = list_entry(priv->freelist.next, struct ipaq_packet, list); +- list_del(&pkt->list); +- priv->free_len -= PACKET_SIZE; +- } +- spin_unlock_irqrestore(&write_list_lock, flags); +- if (pkt == NULL) { +- dbg("%s - we're stuffed", __func__); +- return -EAGAIN; +- } +- +- memcpy(pkt->data, buf, count); +- usb_serial_debug_data(debug, &port->dev, __func__, count, pkt->data); +- +- pkt->len = count; +- pkt->written = 0; +- spin_lock_irqsave(&write_list_lock, flags); +- list_add_tail(&pkt->list, &priv->queue); +- priv->queue_len += count; +- if (priv->active == 0) { +- priv->active = 1; +- ipaq_write_gather(port); +- spin_unlock_irqrestore(&write_list_lock, flags); +- result = usb_submit_urb(port->write_urb, GFP_ATOMIC); +- if (result) +- dev_err(&port->dev, +- "%s - failed submitting write urb, error %d\n", +- __func__, result); +- } else { +- spin_unlock_irqrestore(&write_list_lock, flags); +- } +- return result; +-} +- +-static void ipaq_write_gather(struct usb_serial_port *port) +-{ +- struct ipaq_private *priv = usb_get_serial_port_data(port); +- struct usb_serial *serial = port->serial; +- int count, room; +- struct ipaq_packet *pkt, *tmp; +- struct urb *urb = port->write_urb; +- +- room = URBDATA_SIZE; +- list_for_each_entry_safe(pkt, tmp, &priv->queue, list) { +- count = min(room, (int)(pkt->len - pkt->written)); +- memcpy(urb->transfer_buffer + (URBDATA_SIZE - room), +- pkt->data + pkt->written, count); +- room -= count; +- pkt->written += count; +- priv->queue_len -= count; +- if (pkt->written == pkt->len) { +- list_move(&pkt->list, &priv->freelist); +- priv->free_len += PACKET_SIZE; +- } +- if (room == 0) +- break; ++ dev_err(&port->dev, "%s - failed doing control urb, error %d\n", ++ __func__, result); ++ return result; + } + +- count = URBDATA_SIZE - room; +- usb_fill_bulk_urb(port->write_urb, serial->dev, +- usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress), +- port->write_urb->transfer_buffer, count, +- ipaq_write_bulk_callback, port); +- return; ++ return usb_serial_generic_open(tty, port); + } + +-static void ipaq_write_bulk_callback(struct urb *urb) +-{ +- struct usb_serial_port *port = urb->context; +- struct ipaq_private *priv = usb_get_serial_port_data(port); +- unsigned long flags; +- int result; +- int status = urb->status; +- +- dbg("%s - port %d", __func__, port->number); +- +- if (status) { +- dbg("%s - nonzero write bulk status received: %d", +- __func__, status); +- return; +- } +- +- spin_lock_irqsave(&write_list_lock, flags); +- if (!list_empty(&priv->queue)) { +- ipaq_write_gather(port); +- spin_unlock_irqrestore(&write_list_lock, flags); +- result = usb_submit_urb(port->write_urb, GFP_ATOMIC); +- if (result) +- dev_err(&port->dev, +- "%s - failed submitting write urb, error %d\n", +- __func__, result); +- } else { +- priv->active = 0; +- spin_unlock_irqrestore(&write_list_lock, flags); +- } +- +- usb_serial_port_softint(port); +-} +- +-static int ipaq_write_room(struct tty_struct *tty) +-{ +- struct usb_serial_port *port = tty->driver_data; +- struct ipaq_private *priv = usb_get_serial_port_data(port); +- +- dbg("%s - freelen %d", __func__, priv->free_len); +- return priv->free_len; +-} +- +-static int ipaq_chars_in_buffer(struct tty_struct *tty) +-{ +- struct usb_serial_port *port = tty->driver_data; +- struct ipaq_private *priv = usb_get_serial_port_data(port); +- +- dbg("%s - queuelen %d", __func__, priv->queue_len); +- return priv->queue_len; +-} +- +-static void ipaq_destroy_lists(struct usb_serial_port *port) +-{ +- struct ipaq_private *priv = usb_get_serial_port_data(port); +- struct ipaq_packet *pkt, *tmp; +- +- list_for_each_entry_safe(pkt, tmp, &priv->queue, list) { +- kfree(pkt->data); +- kfree(pkt); +- } +- list_for_each_entry_safe(pkt, tmp, &priv->freelist, list) { +- kfree(pkt->data); +- kfree(pkt); +- } +-} +- +- + static int ipaq_calc_num_ports(struct usb_serial *serial) + { + /* +@@ -970,7 +659,6 @@ static int ipaq_startup(struct usb_seria + static int __init ipaq_init(void) + { + int retval; +- spin_lock_init(&write_list_lock); + retval = usb_serial_register(&ipaq_device); + if (retval) + goto failed_usb_serial_register; +@@ -991,7 +679,6 @@ failed_usb_serial_register: + return retval; + } + +- + static void __exit ipaq_exit(void) + { + usb_deregister(&ipaq_driver); +--- a/drivers/usb/serial/ipaq.h ++++ /dev/null +@@ -1,54 +0,0 @@ +-/* +- * USB Compaq iPAQ driver +- * +- * Copyright (C) 2001 - 2002 +- * Ganesh Varadarajan <ganesh@veritas.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. +- * +- */ +- +-#ifndef __LINUX_USB_SERIAL_IPAQ_H +-#define __LINUX_USB_SERIAL_IPAQ_H +- +-/* +- * Since we can't queue our bulk write urbs (don't know why - it just +- * doesn't work), we can send down only one write urb at a time. The simplistic +- * approach taken by the generic usbserial driver will work, but it's not good +- * for performance. Therefore, we buffer upto URBDATA_QUEUE_MAX bytes of write +- * requests coming from the line discipline. This is done by chaining them +- * in lists of struct ipaq_packet, each packet holding a maximum of +- * PACKET_SIZE bytes. +- * +- * ipaq_write() can be called from bottom half context; hence we can't +- * allocate memory for packets there. So we initialize a pool of packets at +- * the first open and maintain a freelist. +- * +- * The value of PACKET_SIZE was empirically determined by +- * checking the maximum write sizes sent down by the ppp ldisc. +- * URBDATA_QUEUE_MAX is set to 64K, which is the maximum TCP window size. +- */ +- +-struct ipaq_packet { +- char *data; +- size_t len; +- size_t written; +- struct list_head list; +-}; +- +-struct ipaq_private { +- int active; +- int queue_len; +- int free_len; +- struct list_head queue; +- struct list_head freelist; +-}; +- +-#define URBDATA_SIZE 4096 +-#define URBDATA_QUEUE_MAX (64 * 1024) +-#define PACKET_SIZE 256 +- +-#endif diff --git a/usb/usb-kl5kusb105.h-checkpatch-cleanups.patch b/usb/usb-kl5kusb105.h-checkpatch-cleanups.patch new file mode 100644 index 00000000000000..196c3e138e5623 --- /dev/null +++ b/usb/usb-kl5kusb105.h-checkpatch-cleanups.patch @@ -0,0 +1,73 @@ +From foo@baz Mon May 17 10:33:41 PDT 2010 +Date: Mon, 17 May 2010 10:33:41 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: USB: kl5kusb105.h: checkpatch cleanups + +Minor whitespace cleanups to make checkpatch happy. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/usb/serial/kl5kusb105.h | 47 +++++++++++++++++++--------------------- + 1 file changed, 23 insertions(+), 24 deletions(-) + +--- a/drivers/usb/serial/kl5kusb105.h ++++ b/drivers/usb/serial/kl5kusb105.h +@@ -17,16 +17,16 @@ + /* baud rates */ + + enum { +- kl5kusb105a_sio_b115200 = 0, +- kl5kusb105a_sio_b57600 = 1, +- kl5kusb105a_sio_b38400 = 2, +- kl5kusb105a_sio_b19200 = 4, +- kl5kusb105a_sio_b14400 = 5, +- kl5kusb105a_sio_b9600 = 6, +- kl5kusb105a_sio_b4800 = 8, /* unchecked */ +- kl5kusb105a_sio_b2400 = 9, /* unchecked */ +- kl5kusb105a_sio_b1200 = 0xa, /* unchecked */ +- kl5kusb105a_sio_b600 = 0xb /* unchecked */ ++ kl5kusb105a_sio_b115200 = 0, ++ kl5kusb105a_sio_b57600 = 1, ++ kl5kusb105a_sio_b38400 = 2, ++ kl5kusb105a_sio_b19200 = 4, ++ kl5kusb105a_sio_b14400 = 5, ++ kl5kusb105a_sio_b9600 = 6, ++ kl5kusb105a_sio_b4800 = 8, /* unchecked */ ++ kl5kusb105a_sio_b2400 = 9, /* unchecked */ ++ kl5kusb105a_sio_b1200 = 0xa, /* unchecked */ ++ kl5kusb105a_sio_b600 = 0xb /* unchecked */ + }; + + /* data bits */ +@@ -53,17 +53,16 @@ enum { + #define KL5KUSB105A_CTS ((1<<5) | (1<<4)) + + #define KL5KUSB105A_WANTS_TO_SEND 0x30 +-//#define KL5KUSB105A_DTR /* Data Terminal Ready */ +-//#define KL5KUSB105A_CTS /* Clear To Send */ +-//#define KL5KUSB105A_CD /* Carrier Detect */ +-//#define KL5KUSB105A_DSR /* Data Set Ready */ +-//#define KL5KUSB105A_RxD /* Receive pin */ +- +-//#define KL5KUSB105A_LE +-//#define KL5KUSB105A_RTS +-//#define KL5KUSB105A_ST +-//#define KL5KUSB105A_SR +-//#define KL5KUSB105A_RI /* Ring Indicator */ +- +-/* vim: set ts=8 sts=8: */ +- ++#if 0 ++#define KL5KUSB105A_DTR /* Data Terminal Ready */ ++#define KL5KUSB105A_CTS /* Clear To Send */ ++#define KL5KUSB105A_CD /* Carrier Detect */ ++#define KL5KUSB105A_DSR /* Data Set Ready */ ++#define KL5KUSB105A_RxD /* Receive pin */ ++ ++#define KL5KUSB105A_LE ++#define KL5KUSB105A_RTS ++#define KL5KUSB105A_ST ++#define KL5KUSB105A_SR ++#define KL5KUSB105A_RI /* Ring Indicator */ ++#endif diff --git a/usb/usb-kobil-fix-memory-leak.patch b/usb/usb-kobil-fix-memory-leak.patch new file mode 100644 index 00000000000000..3b354c51caebd1 --- /dev/null +++ b/usb/usb-kobil-fix-memory-leak.patch @@ -0,0 +1,33 @@ +From jhovold@gmail.com Mon May 17 11:07:09 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sat, 15 May 2010 17:53:43 +0200 +Subject: USB: kobil: fix memory leak +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com>, stable <stable@kernel.org> +Message-ID: <1273938833-11366-2-git-send-email-jhovold@gmail.com> + + +An urb transfer buffer is allocated at every open but was never freed. + +This driver is a bit of a mess... + +Cc: stable <stable@kernel.org> +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/kobil_sct.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/usb/serial/kobil_sct.c ++++ b/drivers/usb/serial/kobil_sct.c +@@ -345,7 +345,8 @@ static void kobil_close(struct usb_seria + + /* FIXME: Add rts/dtr methods */ + if (port->write_urb) { +- usb_kill_urb(port->write_urb); ++ usb_poison_urb(port->write_urb); ++ kfree(port->write_urb->transfer_buffer); + usb_free_urb(port->write_urb); + port->write_urb = NULL; + } diff --git a/usb/usb-kobil_sct.h-checkpatch-cleanups.patch b/usb/usb-kobil_sct.h-checkpatch-cleanups.patch new file mode 100644 index 00000000000000..c07de9e66e4cb9 --- /dev/null +++ b/usb/usb-kobil_sct.h-checkpatch-cleanups.patch @@ -0,0 +1,100 @@ +From foo@baz Mon May 17 10:33:41 PDT 2010 +Date: Mon, 17 May 2010 10:33:41 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: USB: kobil_sct.h: checkpatch cleanups + +Minor whitespace cleanups to make checkpatch happy. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/usb/serial/kobil_sct.h | 75 +++++++++++++++++++++++++---------------- + 1 file changed, 46 insertions(+), 29 deletions(-) + +--- a/drivers/usb/serial/kobil_sct.h ++++ b/drivers/usb/serial/kobil_sct.h +@@ -23,38 +23,55 @@ + #define SUSBCR_SSL_SETDTR 0x0004 + #define SUSBCR_SSL_CLRDTR 0x0010 + +-#define SUSBCR_SSL_PURGE_TXABORT 0x0100 // Kill the pending/current writes to the comm port. +-#define SUSBCR_SSL_PURGE_RXABORT 0x0200 // Kill the pending/current reads to the comm port. +-#define SUSBCR_SSL_PURGE_TXCLEAR 0x0400 // Kill the transmit queue if there. +-#define SUSBCR_SSL_PURGE_RXCLEAR 0x0800 // Kill the typeahead buffer if there. ++/* Kill the pending/current writes to the comm port. */ ++#define SUSBCR_SSL_PURGE_TXABORT 0x0100 ++/* Kill the pending/current reads to the comm port. */ ++#define SUSBCR_SSL_PURGE_RXABORT 0x0200 ++/* Kill the transmit queue if there. */ ++#define SUSBCR_SSL_PURGE_TXCLEAR 0x0400 ++/* Kill the typeahead buffer if there. */ ++#define SUSBCR_SSL_PURGE_RXCLEAR 0x0800 + + #define SUSBCRequest_GetStatusLineState 4 +-#define SUSBCR_GSL_RXCHAR 0x0001 // Any Character received +-#define SUSBCR_GSL_TXEMPTY 0x0004 // Transmitt Queue Empty +-#define SUSBCR_GSL_CTS 0x0008 // CTS changed state +-#define SUSBCR_GSL_DSR 0x0010 // DSR changed state +-#define SUSBCR_GSL_RLSD 0x0020 // RLSD changed state +-#define SUSBCR_GSL_BREAK 0x0040 // BREAK received +-#define SUSBCR_GSL_ERR 0x0080 // Line status error occurred +-#define SUSBCR_GSL_RING 0x0100 // Ring signal detected ++/* Any Character received */ ++#define SUSBCR_GSL_RXCHAR 0x0001 ++/* Transmitt Queue Empty */ ++#define SUSBCR_GSL_TXEMPTY 0x0004 ++/* CTS changed state */ ++#define SUSBCR_GSL_CTS 0x0008 ++/* DSR changed state */ ++#define SUSBCR_GSL_DSR 0x0010 ++/* RLSD changed state */ ++#define SUSBCR_GSL_RLSD 0x0020 ++/* BREAK received */ ++#define SUSBCR_GSL_BREAK 0x0040 ++/* Line status error occurred */ ++#define SUSBCR_GSL_ERR 0x0080 ++/* Ring signal detected */ ++#define SUSBCR_GSL_RING 0x0100 + + #define SUSBCRequest_Misc 8 +-#define SUSBCR_MSC_ResetReader 0x0001 // use a predefined reset sequence +-#define SUSBCR_MSC_ResetAllQueues 0x0002 // use a predefined sequence to reset the internal queues ++/* use a predefined reset sequence */ ++#define SUSBCR_MSC_ResetReader 0x0001 ++/* use a predefined sequence to reset the internal queues */ ++#define SUSBCR_MSC_ResetAllQueues 0x0002 + + #define SUSBCRequest_GetMisc 0x10 +-#define SUSBCR_MSC_GetFWVersion 0x0001 /* get the firmware version from device, +- coded like this 0xHHLLBBPP +- with HH = Firmware Version High Byte +- LL = Firmware Version Low Byte +- BB = Build Number +- PP = Further Attributes +- */ +- +-#define SUSBCR_MSC_GetHWVersion 0x0002 /* get the hardware version from device +- coded like this 0xHHLLPPRR +- with HH = Software Version High Byte +- LL = Software Version Low Byte +- PP = Further Attributes +- RR = Reserved for the hardware ID +- */ ++ ++/* ++ * get the firmware version from device, coded like this 0xHHLLBBPP with ++ * HH = Firmware Version High Byte ++ * LL = Firmware Version Low Byte ++ * BB = Build Number ++ * PP = Further Attributes ++ */ ++#define SUSBCR_MSC_GetFWVersion 0x0001 ++ ++/* ++ * get the hardware version from device coded like this 0xHHLLPPRR with ++ * HH = Software Version High Byte ++ * LL = Software Version Low Byte ++ * PP = Further Attributes ++ * RR = Reserved for the hardware ID ++ */ ++#define SUSBCR_MSC_GetHWVersion 0x0002 diff --git a/usb/usb-mct_u232.h-checkpatch-cleanups.patch b/usb/usb-mct_u232.h-checkpatch-cleanups.patch new file mode 100644 index 00000000000000..45b0cab388dc35 --- /dev/null +++ b/usb/usb-mct_u232.h-checkpatch-cleanups.patch @@ -0,0 +1,396 @@ +From foo@baz Mon May 17 10:33:41 PDT 2010 +Date: Mon, 17 May 2010 10:33:41 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: USB: mct_u232.h: checkpatch cleanups + +Minor whitespace cleanups to make checkpatch happy. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/usb/serial/mct_u232.h | 264 +++++++++++++++++++++--------------------- + 1 file changed, 138 insertions(+), 126 deletions(-) + +--- a/drivers/usb/serial/mct_u232.h ++++ b/drivers/usb/serial/mct_u232.h +@@ -42,36 +42,44 @@ + #define MCT_U232_SET_REQUEST_TYPE 0x40 + #define MCT_U232_GET_REQUEST_TYPE 0xc0 + +-#define MCT_U232_GET_MODEM_STAT_REQUEST 2 /* Get Modem Status Register (MSR) */ +-#define MCT_U232_GET_MODEM_STAT_SIZE 1 ++/* Get Modem Status Register (MSR) */ ++#define MCT_U232_GET_MODEM_STAT_REQUEST 2 ++#define MCT_U232_GET_MODEM_STAT_SIZE 1 ++ ++/* Get Line Control Register (LCR) */ ++/* ... not used by this driver */ ++#define MCT_U232_GET_LINE_CTRL_REQUEST 6 ++#define MCT_U232_GET_LINE_CTRL_SIZE 1 ++ ++/* Set Baud Rate Divisor */ ++#define MCT_U232_SET_BAUD_RATE_REQUEST 5 ++#define MCT_U232_SET_BAUD_RATE_SIZE 4 ++ ++/* Set Line Control Register (LCR) */ ++#define MCT_U232_SET_LINE_CTRL_REQUEST 7 ++#define MCT_U232_SET_LINE_CTRL_SIZE 1 ++ ++/* Set Modem Control Register (MCR) */ ++#define MCT_U232_SET_MODEM_CTRL_REQUEST 10 ++#define MCT_U232_SET_MODEM_CTRL_SIZE 1 + +-#define MCT_U232_GET_LINE_CTRL_REQUEST 6 /* Get Line Control Register (LCR) */ +-#define MCT_U232_GET_LINE_CTRL_SIZE 1 /* ... not used by this driver */ +- +-#define MCT_U232_SET_BAUD_RATE_REQUEST 5 /* Set Baud Rate Divisor */ +-#define MCT_U232_SET_BAUD_RATE_SIZE 4 ++/* ++ * This USB device request code is not well understood. It is transmitted by ++ * the MCT-supplied Windows driver whenever the baud rate changes. ++ */ ++#define MCT_U232_SET_UNKNOWN1_REQUEST 11 /* Unknown functionality */ ++#define MCT_U232_SET_UNKNOWN1_SIZE 1 + +-#define MCT_U232_SET_LINE_CTRL_REQUEST 7 /* Set Line Control Register (LCR) */ +-#define MCT_U232_SET_LINE_CTRL_SIZE 1 +- +-#define MCT_U232_SET_MODEM_CTRL_REQUEST 10 /* Set Modem Control Register (MCR) */ +-#define MCT_U232_SET_MODEM_CTRL_SIZE 1 +- +-/* This USB device request code is not well understood. It is transmitted by +- the MCT-supplied Windows driver whenever the baud rate changes. +-*/ +-#define MCT_U232_SET_UNKNOWN1_REQUEST 11 /* Unknown functionality */ +-#define MCT_U232_SET_UNKNOWN1_SIZE 1 +- +-/* This USB device request code appears to control whether CTS is required +- during transmission. +- +- Sending a zero byte allows data transmission to a device which is not +- asserting CTS. Sending a '1' byte will cause transmission to be deferred +- until the device asserts CTS. +-*/ +-#define MCT_U232_SET_CTS_REQUEST 12 +-#define MCT_U232_SET_CTS_SIZE 1 ++/* ++ * This USB device request code appears to control whether CTS is required ++ * during transmission. ++ * ++ * Sending a zero byte allows data transmission to a device which is not ++ * asserting CTS. Sending a '1' byte will cause transmission to be deferred ++ * until the device asserts CTS. ++ */ ++#define MCT_U232_SET_CTS_REQUEST 12 ++#define MCT_U232_SET_CTS_SIZE 1 + + #define MCT_U232_MAX_SIZE 4 /* of MCT_XXX_SIZE */ + +@@ -81,7 +89,8 @@ + * and "Intel solution". They are the regular MCT and "Sitecom" for us. + * This is pointless to document in the header, see the code for the bits. + */ +-static int mct_u232_calculate_baud_rate(struct usb_serial *serial, speed_t value, speed_t *result); ++static int mct_u232_calculate_baud_rate(struct usb_serial *serial, ++ speed_t value, speed_t *result); + + /* + * Line Control Register (LCR) +@@ -125,16 +134,16 @@ static int mct_u232_calculate_baud_rate( + /* + * Line Status Register (LSR) + */ +-#define MCT_U232_LSR_INDEX 1 /* data[index] */ +-#define MCT_U232_LSR_ERR 0x80 /* OE | PE | FE | BI */ +-#define MCT_U232_LSR_TEMT 0x40 /* transmit register empty */ +-#define MCT_U232_LSR_THRE 0x20 /* transmit holding register empty */ +-#define MCT_U232_LSR_BI 0x10 /* break indicator */ +-#define MCT_U232_LSR_FE 0x08 /* framing error */ +-#define MCT_U232_LSR_OE 0x02 /* overrun error */ +-#define MCT_U232_LSR_PE 0x04 /* parity error */ +-#define MCT_U232_LSR_OE 0x02 /* overrun error */ +-#define MCT_U232_LSR_DR 0x01 /* receive data ready */ ++#define MCT_U232_LSR_INDEX 1 /* data[index] */ ++#define MCT_U232_LSR_ERR 0x80 /* OE | PE | FE | BI */ ++#define MCT_U232_LSR_TEMT 0x40 /* transmit register empty */ ++#define MCT_U232_LSR_THRE 0x20 /* transmit holding register empty */ ++#define MCT_U232_LSR_BI 0x10 /* break indicator */ ++#define MCT_U232_LSR_FE 0x08 /* framing error */ ++#define MCT_U232_LSR_OE 0x02 /* overrun error */ ++#define MCT_U232_LSR_PE 0x04 /* parity error */ ++#define MCT_U232_LSR_OE 0x02 /* overrun error */ ++#define MCT_U232_LSR_DR 0x01 /* receive data ready */ + + + /* ----------------------------------------------------------------------------- +@@ -143,10 +152,10 @@ static int mct_u232_calculate_baud_rate( + * + * The technical details of the device have been acquired be using "SniffUSB" + * and the vendor-supplied device driver (version 2.3A) under Windows98. To +- * identify the USB vendor-specific requests and to assign them to terminal ++ * identify the USB vendor-specific requests and to assign them to terminal + * settings (flow control, baud rate, etc.) the program "SerialSettings" from + * William G. Greathouse has been proven to be very useful. I also used the +- * Win98 "HyperTerminal" and "usb-robot" on Linux for testing. The results and ++ * Win98 "HyperTerminal" and "usb-robot" on Linux for testing. The results and + * observations are summarized below: + * + * The USB requests seem to be directly mapped to the registers of a 8250, +@@ -186,33 +195,33 @@ static int mct_u232_calculate_baud_rate( + * Data: LCR (see below) + * + * Bit 7: Divisor Latch Access Bit (DLAB). When set, access to the data +- * transmit/receive register (THR/RBR) and the Interrupt Enable Register +- * (IER) is disabled. Any access to these ports is now redirected to the +- * Divisor Latch Registers. Setting this bit, loading the Divisor +- * Registers, and clearing DLAB should be done with interrupts disabled. ++ * transmit/receive register (THR/RBR) and the Interrupt Enable Register ++ * (IER) is disabled. Any access to these ports is now redirected to the ++ * Divisor Latch Registers. Setting this bit, loading the Divisor ++ * Registers, and clearing DLAB should be done with interrupts disabled. + * Bit 6: Set Break. When set to "1", the transmitter begins to transmit +- * continuous Spacing until this bit is set to "0". This overrides any +- * bits of characters that are being transmitted. ++ * continuous Spacing until this bit is set to "0". This overrides any ++ * bits of characters that are being transmitted. + * Bit 5: Stick Parity. When parity is enabled, setting this bit causes parity +- * to always be "1" or "0", based on the value of Bit 4. ++ * to always be "1" or "0", based on the value of Bit 4. + * Bit 4: Even Parity Select (EPS). When parity is enabled and Bit 5 is "0", +- * setting this bit causes even parity to be transmitted and expected. +- * Otherwise, odd parity is used. ++ * setting this bit causes even parity to be transmitted and expected. ++ * Otherwise, odd parity is used. + * Bit 3: Parity Enable (PEN). When set to "1", a parity bit is inserted +- * between the last bit of the data and the Stop Bit. The UART will also +- * expect parity to be present in the received data. ++ * between the last bit of the data and the Stop Bit. The UART will also ++ * expect parity to be present in the received data. + * Bit 2: Number of Stop Bits (STB). If set to "1" and using 5-bit data words, +- * 1.5 Stop Bits are transmitted and expected in each data word. For +- * 6, 7 and 8-bit data words, 2 Stop Bits are transmitted and expected. +- * When this bit is set to "0", one Stop Bit is used on each data word. ++ * 1.5 Stop Bits are transmitted and expected in each data word. For ++ * 6, 7 and 8-bit data words, 2 Stop Bits are transmitted and expected. ++ * When this bit is set to "0", one Stop Bit is used on each data word. + * Bit 1: Word Length Select Bit #1 (WLSB1) + * Bit 0: Word Length Select Bit #0 (WLSB0) +- * Together these bits specify the number of bits in each data word. +- * 1 0 Word Length +- * 0 0 5 Data Bits +- * 0 1 6 Data Bits +- * 1 0 7 Data Bits +- * 1 1 8 Data Bits ++ * Together these bits specify the number of bits in each data word. ++ * 1 0 Word Length ++ * 0 0 5 Data Bits ++ * 0 1 6 Data Bits ++ * 1 0 7 Data Bits ++ * 1 1 8 Data Bits + * + * SniffUSB observations: Bit 7 seems not to be used. There seem to be two bugs + * in the Win98 driver: the break does not work (bit 6 is not asserted) and the +@@ -234,20 +243,20 @@ static int mct_u232_calculate_baud_rate( + * Bit 6: Reserved, always 0. + * Bit 5: Reserved, always 0. + * Bit 4: Loop-Back Enable. When set to "1", the UART transmitter and receiver +- * are internally connected together to allow diagnostic operations. In +- * addition, the UART modem control outputs are connected to the UART +- * modem control inputs. CTS is connected to RTS, DTR is connected to +- * DSR, OUT1 is connected to RI, and OUT 2 is connected to DCD. ++ * are internally connected together to allow diagnostic operations. In ++ * addition, the UART modem control outputs are connected to the UART ++ * modem control inputs. CTS is connected to RTS, DTR is connected to ++ * DSR, OUT1 is connected to RI, and OUT 2 is connected to DCD. + * Bit 3: OUT 2. An auxiliary output that the host processor may set high or +- * low. In the IBM PC serial adapter (and most clones), OUT 2 is used +- * to tri-state (disable) the interrupt signal from the +- * 8250/16450/16550 UART. ++ * low. In the IBM PC serial adapter (and most clones), OUT 2 is used ++ * to tri-state (disable) the interrupt signal from the ++ * 8250/16450/16550 UART. + * Bit 2: OUT 1. An auxiliary output that the host processor may set high or +- * low. This output is not used on the IBM PC serial adapter. ++ * low. This output is not used on the IBM PC serial adapter. + * Bit 1: Request to Send (RTS). When set to "1", the output of the UART -RTS +- * line is Low (Active). ++ * line is Low (Active). + * Bit 0: Data Terminal Ready (DTR). When set to "1", the output of the UART +- * -DTR line is Low (Active). ++ * -DTR line is Low (Active). + * + * SniffUSB observations: Bit 2 and 4 seem not to be used but bit 3 has been + * seen _always_ set. +@@ -264,22 +273,22 @@ static int mct_u232_calculate_baud_rate( + * Data: MSR (see below) + * + * Bit 7: Data Carrier Detect (CD). Reflects the state of the DCD line on the +- * UART. ++ * UART. + * Bit 6: Ring Indicator (RI). Reflects the state of the RI line on the UART. + * Bit 5: Data Set Ready (DSR). Reflects the state of the DSR line on the UART. + * Bit 4: Clear To Send (CTS). Reflects the state of the CTS line on the UART. + * Bit 3: Delta Data Carrier Detect (DDCD). Set to "1" if the -DCD line has +- * changed state one more more times since the last time the MSR was +- * read by the host. ++ * changed state one more more times since the last time the MSR was ++ * read by the host. + * Bit 2: Trailing Edge Ring Indicator (TERI). Set to "1" if the -RI line has +- * had a low to high transition since the last time the MSR was read by +- * the host. ++ * had a low to high transition since the last time the MSR was read by ++ * the host. + * Bit 1: Delta Data Set Ready (DDSR). Set to "1" if the -DSR line has changed +- * state one more more times since the last time the MSR was read by the +- * host. ++ * state one more more times since the last time the MSR was read by the ++ * host. + * Bit 0: Delta Clear To Send (DCTS). Set to "1" if the -CTS line has changed +- * state one more times since the last time the MSR was read by the +- * host. ++ * state one more times since the last time the MSR was read by the ++ * host. + * + * SniffUSB observations: the MSR is also returned as first byte on the + * interrupt-in endpoint 0x83 to signal changes of modem status lines. The USB +@@ -290,31 +299,34 @@ static int mct_u232_calculate_baud_rate( + * -------------------------- + * + * Bit 7 Error in Receiver FIFO. On the 8250/16450 UART, this bit is zero. +- * This bit is set to "1" when any of the bytes in the FIFO have one or +- * more of the following error conditions: PE, FE, or BI. ++ * This bit is set to "1" when any of the bytes in the FIFO have one ++ * or more of the following error conditions: PE, FE, or BI. + * Bit 6 Transmitter Empty (TEMT). When set to "1", there are no words +- * remaining in the transmit FIFO or the transmit shift register. The +- * transmitter is completely idle. +- * Bit 5 Transmitter Holding Register Empty (THRE). When set to "1", the FIFO +- * (or holding register) now has room for at least one additional word +- * to transmit. The transmitter may still be transmitting when this bit +- * is set to "1". ++ * remaining in the transmit FIFO or the transmit shift register. The ++ * transmitter is completely idle. ++ * Bit 5 Transmitter Holding Register Empty (THRE). When set to "1", the ++ * FIFO (or holding register) now has room for at least one additional ++ * word to transmit. The transmitter may still be transmitting when ++ * this bit is set to "1". + * Bit 4 Break Interrupt (BI). The receiver has detected a Break signal. +- * Bit 3 Framing Error (FE). A Start Bit was detected but the Stop Bit did not +- * appear at the expected time. The received word is probably garbled. +- * Bit 2 Parity Error (PE). The parity bit was incorrect for the word received. +- * Bit 1 Overrun Error (OE). A new word was received and there was no room in +- * the receive buffer. The newly-arrived word in the shift register is +- * discarded. On 8250/16450 UARTs, the word in the holding register is +- * discarded and the newly- arrived word is put in the holding register. ++ * Bit 3 Framing Error (FE). A Start Bit was detected but the Stop Bit did ++ * not appear at the expected time. The received word is probably ++ * garbled. ++ * Bit 2 Parity Error (PE). The parity bit was incorrect for the word ++ * received. ++ * Bit 1 Overrun Error (OE). A new word was received and there was no room ++ * in the receive buffer. The newly-arrived word in the shift register ++ * is discarded. On 8250/16450 UARTs, the word in the holding register ++ * is discarded and the newly- arrived word is put in the holding ++ * register. + * Bit 0 Data Ready (DR). One or more words are in the receive FIFO that the +- * host may read. A word must be completely received and moved from the +- * shift register into the FIFO (or holding register for 8250/16450 +- * designs) before this bit is set. +- * +- * SniffUSB observations: the LSR is returned as second byte on the interrupt-in +- * endpoint 0x83 to signal error conditions. Such errors have been seen with +- * minicom/zmodem transfers (CRC errors). ++ * host may read. A word must be completely received and moved from ++ * the shift register into the FIFO (or holding register for ++ * 8250/16450 designs) before this bit is set. ++ * ++ * SniffUSB observations: the LSR is returned as second byte on the ++ * interrupt-in endpoint 0x83 to signal error conditions. Such errors have ++ * been seen with minicom/zmodem transfers (CRC errors). + * + * + * Unknown #1 +@@ -364,16 +376,16 @@ static int mct_u232_calculate_baud_rate( + * -------------- + * + * SniffUSB observations: the bulk-out endpoint 0x1 and interrupt-in endpoint +- * 0x81 is used to transmit and receive characters. The second interrupt-in +- * endpoint 0x83 signals exceptional conditions like modem line changes and ++ * 0x81 is used to transmit and receive characters. The second interrupt-in ++ * endpoint 0x83 signals exceptional conditions like modem line changes and + * errors. The first byte returned is the MSR and the second byte the LSR. + * + * + * Other observations + * ------------------ + * +- * Queued bulk transfers like used in visor.c did not work. +- * ++ * Queued bulk transfers like used in visor.c did not work. ++ * + * + * Properties of the USB device used (as found in /var/log/messages) + * ----------------------------------------------------------------- +@@ -411,26 +423,26 @@ static int mct_u232_calculate_baud_rate( + * bInterface Class:SubClass:Protocol = 00:00:00 + * iInterface = 00 + * Endpoint: +- * bLength = 7 +- * bDescriptorType = 05 +- * bEndpointAddress = 81 (in) +- * bmAttributes = 03 (Interrupt) +- * wMaxPacketSize = 0040 +- * bInterval = 02 ++ * bLength = 7 ++ * bDescriptorType = 05 ++ * bEndpointAddress = 81 (in) ++ * bmAttributes = 03 (Interrupt) ++ * wMaxPacketSize = 0040 ++ * bInterval = 02 + * Endpoint: +- * bLength = 7 +- * bDescriptorType = 05 +- * bEndpointAddress = 01 (out) +- * bmAttributes = 02 (Bulk) +- * wMaxPacketSize = 0040 +- * bInterval = 00 ++ * bLength = 7 ++ * bDescriptorType = 05 ++ * bEndpointAddress = 01 (out) ++ * bmAttributes = 02 (Bulk) ++ * wMaxPacketSize = 0040 ++ * bInterval = 00 + * Endpoint: +- * bLength = 7 +- * bDescriptorType = 05 +- * bEndpointAddress = 83 (in) +- * bmAttributes = 03 (Interrupt) +- * wMaxPacketSize = 0002 +- * bInterval = 02 ++ * bLength = 7 ++ * bDescriptorType = 05 ++ * bEndpointAddress = 83 (in) ++ * bmAttributes = 03 (Interrupt) ++ * wMaxPacketSize = 0002 ++ * bInterval = 02 + * + * + * Hardware details (added by Martin Hamilton, 2001/12/06) +@@ -440,7 +452,7 @@ static int mct_u232_calculate_baud_rate( + * adaptor, which turns out to simply be a re-badged U232-P9. We + * know this because there is a sticky label on the circuit board + * which says "U232-P9" ;-) +- * ++ * + * The circuit board inside the adaptor contains a Philips PDIUSBD12 + * USB endpoint chip and a Philips P87C52UBAA microcontroller with + * embedded UART. Exhaustive documentation for these is available at: +@@ -449,7 +461,7 @@ static int mct_u232_calculate_baud_rate( + * http://www.semiconductors.philips.com/pip/pdiusbd12 + * + * Thanks to Julian Highfield for the pointer to the Philips database. +- * ++ * + */ + + #endif /* __LINUX_USB_SERIAL_MCT_U232_H */ diff --git a/usb/usb-option.c-olivetti-olicard100-support.patch b/usb/usb-option.c-olivetti-olicard100-support.patch new file mode 100644 index 00000000000000..1b4f351b0bae1d --- /dev/null +++ b/usb/usb-option.c-olivetti-olicard100-support.patch @@ -0,0 +1,50 @@ +From lkml@Think-Future.de Mon May 17 11:05:43 2010 +From: Nils Radtke <lkml@Think-Future.de> +Date: Mon, 17 May 2010 14:14:11 +0200 +Subject: [2.6.34 PATCH] USB: option.c: OLIVETTI OLICARD100 support +To: Matthias Urlichs <smurf@smurf.noris.de> +Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Greg Kroah-Hartman <gregkh@suse.de>, stable@kernel.org +Message-ID: <20100517121411.GA21483@localhost> +Content-Disposition: inline + + +From: Nils Radtke <lkml@Think-Future.de> + +This patch adds support for an olivetti olicard100 HÐ…DPA usb-stick. + +This device is a zeroCD one with ID 0b3c:c700 that needs switching via +eject or usb-modeswitch with +MessageContent="5553424312345678000000000000061b000000030000000000000000000000". +After switching it has ID 0b3c:c000 and provides 5 serial ports ttyUSB[0-4]. +Port 0 (modem) and 4 are interrupt ports. + +Signed-off-by: Nils Radtke <lkml@Think-Future.de> +Cc: stable <stable@kernel.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/option.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -359,6 +359,10 @@ static void option_instat_callback(struc + + #define CINTERION_VENDOR_ID 0x0681 + ++/* Olivetti products */ ++#define OLIVETTI_VENDOR_ID 0x0b3c ++#define OLIVETTI_PRODUCT_OLICARD100 0xc000 ++ + /* some devices interfaces need special handling due to a number of reasons */ + enum option_blacklist_reason { + OPTION_BLACKLIST_NONE = 0, +@@ -879,6 +883,8 @@ static const struct usb_device_id option + { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)}, + + { USB_DEVICE(CINTERION_VENDOR_ID, 0x0047) }, ++ ++ { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, + { } /* Terminating entry */ + }; + MODULE_DEVICE_TABLE(usb, option_ids); diff --git a/usb/usb-oti6858-use-kfifo-to-implement-write-buffering.patch b/usb/usb-oti6858-use-kfifo-to-implement-write-buffering.patch new file mode 100644 index 00000000000000..dc1a5aee2b98c0 --- /dev/null +++ b/usb/usb-oti6858-use-kfifo-to-implement-write-buffering.patch @@ -0,0 +1,358 @@ +From jhovold@gmail.com Mon May 17 11:14:39 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sun, 16 May 2010 20:33:51 +0200 +Subject: USB: oti6858: use kfifo to implement write buffering +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com> +Message-ID: <1274034832-27301-5-git-send-email-jhovold@gmail.com> + + +Kill custom fifo implementation. + +Use private write fifo to minimise changes to lock handling. + +Compile-only tested. + +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/oti6858.c | 218 +++---------------------------------------- + 1 file changed, 17 insertions(+), 201 deletions(-) + +--- a/drivers/usb/serial/oti6858.c ++++ b/drivers/usb/serial/oti6858.c +@@ -51,12 +51,13 @@ + #include <linux/usb.h> + #include <linux/usb/serial.h> + #include <linux/uaccess.h> ++#include <linux/kfifo.h> + #include "oti6858.h" + + #define OTI6858_DESCRIPTION \ + "Ours Technology Inc. OTi-6858 USB to serial adapter driver" + #define OTI6858_AUTHOR "Tomasz Michal Lukaszewski <FIXME@FIXME>" +-#define OTI6858_VERSION "0.1" ++#define OTI6858_VERSION "0.2" + + static const struct usb_device_id id_table[] = { + { USB_DEVICE(OTI6858_VENDOR_ID, OTI6858_PRODUCT_ID) }, +@@ -75,17 +76,7 @@ static struct usb_driver oti6858_driver + + static int debug; + +- +-/* buffering code, copied from pl2303 driver */ +-#define PL2303_BUF_SIZE 1024 +-#define PL2303_TMP_BUF_SIZE 1024 +- +-struct oti6858_buf { +- unsigned int buf_size; +- char *buf_buf; +- char *buf_get; +- char *buf_put; +-}; ++#define OTI6858_FIFO_SIZE 1024 + + /* requests */ + #define OTI6858_REQ_GET_STATUS (USB_DIR_IN | USB_TYPE_VENDOR | 0x00) +@@ -161,18 +152,6 @@ static int oti6858_tiocmset(struct tty_s + static int oti6858_startup(struct usb_serial *serial); + static void oti6858_release(struct usb_serial *serial); + +-/* functions operating on buffers */ +-static struct oti6858_buf *oti6858_buf_alloc(unsigned int size); +-static void oti6858_buf_free(struct oti6858_buf *pb); +-static void oti6858_buf_clear(struct oti6858_buf *pb); +-static unsigned int oti6858_buf_data_avail(struct oti6858_buf *pb); +-static unsigned int oti6858_buf_space_avail(struct oti6858_buf *pb); +-static unsigned int oti6858_buf_put(struct oti6858_buf *pb, const char *buf, +- unsigned int count); +-static unsigned int oti6858_buf_get(struct oti6858_buf *pb, char *buf, +- unsigned int count); +- +- + /* device info */ + static struct usb_serial_driver oti6858_device = { + .driver = { +@@ -201,7 +180,7 @@ static struct usb_serial_driver oti6858_ + struct oti6858_private { + spinlock_t lock; + +- struct oti6858_buf *buf; ++ struct kfifo write_fifo; + struct oti6858_control_pkt status; + + struct { +@@ -315,7 +294,7 @@ static void send_data(struct work_struct + } + priv->flags.write_urb_in_use = 1; + +- count = oti6858_buf_data_avail(priv->buf); ++ count = kfifo_len(&priv->write_fifo); + spin_unlock_irqrestore(&priv->lock, flags); + if (count > port->bulk_out_size) + count = port->bulk_out_size; +@@ -350,10 +329,9 @@ static void send_data(struct work_struct + return; + } + +- spin_lock_irqsave(&priv->lock, flags); +- oti6858_buf_get(priv->buf, port->write_urb->transfer_buffer, count); +- spin_unlock_irqrestore(&priv->lock, flags); +- ++ count = kfifo_out_locked(&priv->write_fifo, ++ port->write_urb->transfer_buffer, ++ count, &priv->lock); + port->write_urb->transfer_buffer_length = count; + port->write_urb->dev = port->serial->dev; + result = usb_submit_urb(port->write_urb, GFP_NOIO); +@@ -376,8 +354,8 @@ static int oti6858_startup(struct usb_se + priv = kzalloc(sizeof(struct oti6858_private), GFP_KERNEL); + if (!priv) + break; +- priv->buf = oti6858_buf_alloc(PL2303_BUF_SIZE); +- if (priv->buf == NULL) { ++ if (kfifo_alloc(&priv->write_fifo, OTI6858_FIFO_SIZE, ++ GFP_KERNEL)) { + kfree(priv); + break; + } +@@ -397,7 +375,7 @@ static int oti6858_startup(struct usb_se + + for (--i; i >= 0; --i) { + priv = usb_get_serial_port_data(serial->port[i]); +- oti6858_buf_free(priv->buf); ++ kfifo_free(&priv->write_fifo); + kfree(priv); + usb_set_serial_port_data(serial->port[i], NULL); + } +@@ -408,16 +386,13 @@ static int oti6858_write(struct tty_stru + const unsigned char *buf, int count) + { + struct oti6858_private *priv = usb_get_serial_port_data(port); +- unsigned long flags; + + dbg("%s(port = %d, count = %d)", __func__, port->number, count); + + if (!count) + return count; + +- spin_lock_irqsave(&priv->lock, flags); +- count = oti6858_buf_put(priv->buf, buf, count); +- spin_unlock_irqrestore(&priv->lock, flags); ++ count = kfifo_in_locked(&priv->write_fifo, buf, count, &priv->lock); + + return count; + } +@@ -432,7 +407,7 @@ static int oti6858_write_room(struct tty + dbg("%s(port = %d)", __func__, port->number); + + spin_lock_irqsave(&priv->lock, flags); +- room = oti6858_buf_space_avail(priv->buf); ++ room = kfifo_avail(&priv->write_fifo); + spin_unlock_irqrestore(&priv->lock, flags); + + return room; +@@ -448,7 +423,7 @@ static int oti6858_chars_in_buffer(struc + dbg("%s(port = %d)", __func__, port->number); + + spin_lock_irqsave(&priv->lock, flags); +- chars = oti6858_buf_data_avail(priv->buf); ++ chars = kfifo_len(&priv->write_fifo); + spin_unlock_irqrestore(&priv->lock, flags); + + return chars; +@@ -642,7 +617,7 @@ static void oti6858_close(struct usb_ser + + spin_lock_irqsave(&priv->lock, flags); + /* clear out any remaining data in the buffer */ +- oti6858_buf_clear(priv->buf); ++ kfifo_reset_out(&priv->write_fifo); + spin_unlock_irqrestore(&priv->lock, flags); + + dbg("%s(): after buf_clear()", __func__); +@@ -793,7 +768,7 @@ static void oti6858_release(struct usb_s + for (i = 0; i < serial->num_ports; ++i) { + priv = usb_get_serial_port_data(serial->port[i]); + if (priv) { +- oti6858_buf_free(priv->buf); ++ kfifo_free(&priv->write_fifo); + kfree(priv); + } + } +@@ -892,7 +867,7 @@ static void oti6858_read_int_callback(st + + spin_lock_irqsave(&priv->lock, flags); + if (priv->flags.write_urb_in_use == 0 +- && oti6858_buf_data_avail(priv->buf) != 0) { ++ && kfifo_len(&priv->write_fifo) != 0) { + schedule_delayed_work(&priv->delayed_write_work, 0); + resubmit = 0; + } +@@ -1014,165 +989,6 @@ static void oti6858_write_bulk_callback( + } + } + +- +-/* +- * oti6858_buf_alloc +- * +- * Allocate a circular buffer and all associated memory. +- */ +-static struct oti6858_buf *oti6858_buf_alloc(unsigned int size) +-{ +- struct oti6858_buf *pb; +- +- if (size == 0) +- return NULL; +- +- pb = kmalloc(sizeof(struct oti6858_buf), GFP_KERNEL); +- if (pb == NULL) +- return NULL; +- +- pb->buf_buf = kmalloc(size, GFP_KERNEL); +- if (pb->buf_buf == NULL) { +- kfree(pb); +- return NULL; +- } +- +- pb->buf_size = size; +- pb->buf_get = pb->buf_put = pb->buf_buf; +- +- return pb; +-} +- +-/* +- * oti6858_buf_free +- * +- * Free the buffer and all associated memory. +- */ +-static void oti6858_buf_free(struct oti6858_buf *pb) +-{ +- if (pb) { +- kfree(pb->buf_buf); +- kfree(pb); +- } +-} +- +-/* +- * oti6858_buf_clear +- * +- * Clear out all data in the circular buffer. +- */ +-static void oti6858_buf_clear(struct oti6858_buf *pb) +-{ +- if (pb != NULL) { +- /* equivalent to a get of all data available */ +- pb->buf_get = pb->buf_put; +- } +-} +- +-/* +- * oti6858_buf_data_avail +- * +- * Return the number of bytes of data available in the circular +- * buffer. +- */ +-static unsigned int oti6858_buf_data_avail(struct oti6858_buf *pb) +-{ +- if (pb == NULL) +- return 0; +- return (pb->buf_size + pb->buf_put - pb->buf_get) % pb->buf_size; +-} +- +-/* +- * oti6858_buf_space_avail +- * +- * Return the number of bytes of space available in the circular +- * buffer. +- */ +-static unsigned int oti6858_buf_space_avail(struct oti6858_buf *pb) +-{ +- if (pb == NULL) +- return 0; +- return (pb->buf_size + pb->buf_get - pb->buf_put - 1) % pb->buf_size; +-} +- +-/* +- * oti6858_buf_put +- * +- * Copy data data from a user buffer and put it into the circular buffer. +- * Restrict to the amount of space available. +- * +- * Return the number of bytes copied. +- */ +-static unsigned int oti6858_buf_put(struct oti6858_buf *pb, const char *buf, +- unsigned int count) +-{ +- unsigned int len; +- +- if (pb == NULL) +- return 0; +- +- len = oti6858_buf_space_avail(pb); +- if (count > len) +- count = len; +- +- if (count == 0) +- return 0; +- +- len = pb->buf_buf + pb->buf_size - pb->buf_put; +- if (count > len) { +- memcpy(pb->buf_put, buf, len); +- memcpy(pb->buf_buf, buf+len, count - len); +- pb->buf_put = pb->buf_buf + count - len; +- } else { +- memcpy(pb->buf_put, buf, count); +- if (count < len) +- pb->buf_put += count; +- else /* count == len */ +- pb->buf_put = pb->buf_buf; +- } +- +- return count; +-} +- +-/* +- * oti6858_buf_get +- * +- * Get data from the circular buffer and copy to the given buffer. +- * Restrict to the amount of data available. +- * +- * Return the number of bytes copied. +- */ +-static unsigned int oti6858_buf_get(struct oti6858_buf *pb, char *buf, +- unsigned int count) +-{ +- unsigned int len; +- +- if (pb == NULL) +- return 0; +- +- len = oti6858_buf_data_avail(pb); +- if (count > len) +- count = len; +- +- if (count == 0) +- return 0; +- +- len = pb->buf_buf + pb->buf_size - pb->buf_get; +- if (count > len) { +- memcpy(buf, pb->buf_get, len); +- memcpy(buf+len, pb->buf_buf, count - len); +- pb->buf_get = pb->buf_buf + count - len; +- } else { +- memcpy(buf, pb->buf_get, count); +- if (count < len) +- pb->buf_get += count; +- else /* count == len */ +- pb->buf_get = pb->buf_buf; +- } +- +- return count; +-} +- + /* module description and (de)initialization */ + + static int __init oti6858_init(void) diff --git a/usb/usb-oti6858-use-port-write-fifo.patch b/usb/usb-oti6858-use-port-write-fifo.patch new file mode 100644 index 00000000000000..8b4171d3244873 --- /dev/null +++ b/usb/usb-oti6858-use-port-write-fifo.patch @@ -0,0 +1,193 @@ +From jhovold@gmail.com Mon May 17 11:14:49 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sun, 16 May 2010 20:33:52 +0200 +Subject: USB: oti6858: use port write fifo +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com> +Message-ID: <1274034832-27301-6-git-send-email-jhovold@gmail.com> + + +Kill private write fifo and use port fifo instead (protected under +port lock). + +Compile-only tested. + +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/oti6858.c | 62 +++++++++++++++++-------------------------- + 1 file changed, 25 insertions(+), 37 deletions(-) + +--- a/drivers/usb/serial/oti6858.c ++++ b/drivers/usb/serial/oti6858.c +@@ -76,8 +76,6 @@ static struct usb_driver oti6858_driver + + static int debug; + +-#define OTI6858_FIFO_SIZE 1024 +- + /* requests */ + #define OTI6858_REQ_GET_STATUS (USB_DIR_IN | USB_TYPE_VENDOR | 0x00) + #define OTI6858_REQ_T_GET_STATUS 0x01 +@@ -180,7 +178,6 @@ static struct usb_serial_driver oti6858_ + struct oti6858_private { + spinlock_t lock; + +- struct kfifo write_fifo; + struct oti6858_control_pkt status; + + struct { +@@ -293,9 +290,12 @@ static void send_data(struct work_struct + return; + } + priv->flags.write_urb_in_use = 1; +- +- count = kfifo_len(&priv->write_fifo); + spin_unlock_irqrestore(&priv->lock, flags); ++ ++ spin_lock_irqsave(&port->lock, flags); ++ count = kfifo_len(&port->write_fifo); ++ spin_unlock_irqrestore(&port->lock, flags); ++ + if (count > port->bulk_out_size) + count = port->bulk_out_size; + +@@ -329,9 +329,9 @@ static void send_data(struct work_struct + return; + } + +- count = kfifo_out_locked(&priv->write_fifo, ++ count = kfifo_out_locked(&port->write_fifo, + port->write_urb->transfer_buffer, +- count, &priv->lock); ++ count, &port->lock); + port->write_urb->transfer_buffer_length = count; + port->write_urb->dev = port->serial->dev; + result = usb_submit_urb(port->write_urb, GFP_NOIO); +@@ -354,11 +354,6 @@ static int oti6858_startup(struct usb_se + priv = kzalloc(sizeof(struct oti6858_private), GFP_KERNEL); + if (!priv) + break; +- if (kfifo_alloc(&priv->write_fifo, OTI6858_FIFO_SIZE, +- GFP_KERNEL)) { +- kfree(priv); +- break; +- } + + spin_lock_init(&priv->lock); + init_waitqueue_head(&priv->intr_wait); +@@ -375,7 +370,6 @@ static int oti6858_startup(struct usb_se + + for (--i; i >= 0; --i) { + priv = usb_get_serial_port_data(serial->port[i]); +- kfifo_free(&priv->write_fifo); + kfree(priv); + usb_set_serial_port_data(serial->port[i], NULL); + } +@@ -385,14 +379,12 @@ static int oti6858_startup(struct usb_se + static int oti6858_write(struct tty_struct *tty, struct usb_serial_port *port, + const unsigned char *buf, int count) + { +- struct oti6858_private *priv = usb_get_serial_port_data(port); +- + dbg("%s(port = %d, count = %d)", __func__, port->number, count); + + if (!count) + return count; + +- count = kfifo_in_locked(&priv->write_fifo, buf, count, &priv->lock); ++ count = kfifo_in_locked(&port->write_fifo, buf, count, &port->lock); + + return count; + } +@@ -400,15 +392,14 @@ static int oti6858_write(struct tty_stru + static int oti6858_write_room(struct tty_struct *tty) + { + struct usb_serial_port *port = tty->driver_data; +- struct oti6858_private *priv = usb_get_serial_port_data(port); + int room = 0; + unsigned long flags; + + dbg("%s(port = %d)", __func__, port->number); + +- spin_lock_irqsave(&priv->lock, flags); +- room = kfifo_avail(&priv->write_fifo); +- spin_unlock_irqrestore(&priv->lock, flags); ++ spin_lock_irqsave(&port->lock, flags); ++ room = kfifo_avail(&port->write_fifo); ++ spin_unlock_irqrestore(&port->lock, flags); + + return room; + } +@@ -416,15 +407,14 @@ static int oti6858_write_room(struct tty + static int oti6858_chars_in_buffer(struct tty_struct *tty) + { + struct usb_serial_port *port = tty->driver_data; +- struct oti6858_private *priv = usb_get_serial_port_data(port); + int chars = 0; + unsigned long flags; + + dbg("%s(port = %d)", __func__, port->number); + +- spin_lock_irqsave(&priv->lock, flags); +- chars = kfifo_len(&priv->write_fifo); +- spin_unlock_irqrestore(&priv->lock, flags); ++ spin_lock_irqsave(&port->lock, flags); ++ chars = kfifo_len(&port->write_fifo); ++ spin_unlock_irqrestore(&port->lock, flags); + + return chars; + } +@@ -615,10 +605,10 @@ static void oti6858_close(struct usb_ser + + dbg("%s(port = %d)", __func__, port->number); + +- spin_lock_irqsave(&priv->lock, flags); ++ spin_lock_irqsave(&port->lock, flags); + /* clear out any remaining data in the buffer */ +- kfifo_reset_out(&priv->write_fifo); +- spin_unlock_irqrestore(&priv->lock, flags); ++ kfifo_reset_out(&port->write_fifo); ++ spin_unlock_irqrestore(&port->lock, flags); + + dbg("%s(): after buf_clear()", __func__); + +@@ -760,18 +750,12 @@ static int oti6858_ioctl(struct tty_stru + + static void oti6858_release(struct usb_serial *serial) + { +- struct oti6858_private *priv; + int i; + + dbg("%s()", __func__); + +- for (i = 0; i < serial->num_ports; ++i) { +- priv = usb_get_serial_port_data(serial->port[i]); +- if (priv) { +- kfifo_free(&priv->write_fifo); +- kfree(priv); +- } +- } ++ for (i = 0; i < serial->num_ports; ++i) ++ kfree(usb_get_serial_port_data(serial->port[i])); + } + + static void oti6858_read_int_callback(struct urb *urb) +@@ -864,10 +848,14 @@ static void oti6858_read_int_callback(st + } + } else if (!transient) { + unsigned long flags; ++ int count; ++ ++ spin_lock_irqsave(&port->lock, flags); ++ count = kfifo_len(&port->write_fifo); ++ spin_unlock_irqrestore(&port->lock, flags); + + spin_lock_irqsave(&priv->lock, flags); +- if (priv->flags.write_urb_in_use == 0 +- && kfifo_len(&priv->write_fifo) != 0) { ++ if (priv->flags.write_urb_in_use == 0 && count != 0) { + schedule_delayed_work(&priv->delayed_write_work, 0); + resubmit = 0; + } diff --git a/usb/usb-pl2303.h-checkpatch-cleanups.patch b/usb/usb-pl2303.h-checkpatch-cleanups.patch new file mode 100644 index 00000000000000..128463e7d0545d --- /dev/null +++ b/usb/usb-pl2303.h-checkpatch-cleanups.patch @@ -0,0 +1,32 @@ +From foo@baz Mon May 17 10:33:41 PDT 2010 +Date: Mon, 17 May 2010 10:33:41 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: USB: pl2303.h: checkpatch cleanups + +Minor whitespace cleanups to make checkpatch happy. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/usb/serial/pl2303.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/usb/serial/pl2303.h ++++ b/drivers/usb/serial/pl2303.h +@@ -5,7 +5,7 @@ + * 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. +- * ++ * + */ + + #define BENQ_VENDOR_ID 0x04a5 +@@ -137,5 +137,5 @@ + #define SANWA_PRODUCT_ID 0x0001 + + /* ADLINK ND-6530 RS232,RS485 and RS422 adapter */ +-#define ADLINK_VENDOR_ID 0x0b63 +-#define ADLINK_ND6530_PRODUCT_ID 0x6530 ++#define ADLINK_VENDOR_ID 0x0b63 ++#define ADLINK_ND6530_PRODUCT_ID 0x6530 diff --git a/usb/usb-remove-match_device.patch b/usb/usb-remove-match_device.patch new file mode 100644 index 00000000000000..7a5bef6d411e06 --- /dev/null +++ b/usb/usb-remove-match_device.patch @@ -0,0 +1,68 @@ +From tom.leiming@gmail.com Mon May 17 10:59:41 2010 +From: tom.leiming@gmail.com +Date: Mon, 17 May 2010 22:20:50 +0800 +Subject: USB: remove match_device +To: greg@kroah.com, stern@rowland.harvard.edu +Cc: linux-usb@vger.kernel.org, sfr@canb.auug.org.au, Ming Lei <tom.leiming@gmail.com> +Message-ID: <1274106050-4660-1-git-send-email-tom.leiming@gmail.com> + + +From: Ming Lei <tom.leiming@gmail.com> + +usb_find_device was the only one user of match_device, now +it is removed, so remove match_device to fix the compile warning +below reported by Stephen Rothwell: + + drivers/usb/core/usb.c:596: warning: 'match_device' + defined but not used + +Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> +Signed-off-by: Ming Lei <tom.leiming@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/core/usb.c | 33 --------------------------------- + 1 file changed, 33 deletions(-) + +--- a/drivers/usb/core/usb.c ++++ b/drivers/usb/core/usb.c +@@ -593,39 +593,6 @@ int usb_lock_device_for_reset(struct usb + } + EXPORT_SYMBOL_GPL(usb_lock_device_for_reset); + +-static struct usb_device *match_device(struct usb_device *dev, +- u16 vendor_id, u16 product_id) +-{ +- struct usb_device *ret_dev = NULL; +- int child; +- +- dev_dbg(&dev->dev, "check for vendor %04x, product %04x ...\n", +- le16_to_cpu(dev->descriptor.idVendor), +- le16_to_cpu(dev->descriptor.idProduct)); +- +- /* see if this device matches */ +- if ((vendor_id == le16_to_cpu(dev->descriptor.idVendor)) && +- (product_id == le16_to_cpu(dev->descriptor.idProduct))) { +- dev_dbg(&dev->dev, "matched this device!\n"); +- ret_dev = usb_get_dev(dev); +- goto exit; +- } +- +- /* look through all of the children of this device */ +- for (child = 0; child < dev->maxchild; ++child) { +- if (dev->children[child]) { +- usb_lock_device(dev->children[child]); +- ret_dev = match_device(dev->children[child], +- vendor_id, product_id); +- usb_unlock_device(dev->children[child]); +- if (ret_dev) +- goto exit; +- } +- } +-exit: +- return ret_dev; +-} +- + /** + * usb_get_current_frame_number - return current bus frame number + * @dev: the device whose bus is being queried diff --git a/usb/usb-serial-add-special-case-for-processing-of-empty-read-urbs.patch b/usb/usb-serial-add-special-case-for-processing-of-empty-read-urbs.patch new file mode 100644 index 00000000000000..2d5f4f6d5befa7 --- /dev/null +++ b/usb/usb-serial-add-special-case-for-processing-of-empty-read-urbs.patch @@ -0,0 +1,30 @@ +From jhovold@gmail.com Mon May 17 11:07:21 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sat, 15 May 2010 17:53:44 +0200 +Subject: USB: serial: add special case for processing of empty read urbs +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com> +Message-ID: <1273938833-11366-3-git-send-email-jhovold@gmail.com> + + +Return immediately from generic process_read_urb if urb is empty. + +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/generic.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/usb/serial/generic.c ++++ b/drivers/usb/serial/generic.c +@@ -324,6 +324,9 @@ void usb_serial_generic_process_read_urb + char *ch = (char *)urb->transfer_buffer; + int i; + ++ if (!urb->actual_length) ++ return; ++ + tty = tty_port_tty_get(&port->port); + if (!tty) + return; diff --git a/usb/usb-spcp8x5-reimplement-using-generic-framework.patch b/usb/usb-spcp8x5-reimplement-using-generic-framework.patch new file mode 100644 index 00000000000000..b2d2a5bc6aec31 --- /dev/null +++ b/usb/usb-spcp8x5-reimplement-using-generic-framework.patch @@ -0,0 +1,558 @@ +From jhovold@gmail.com Mon May 17 11:08:00 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sat, 15 May 2010 17:53:47 +0200 +Subject: USB: spcp8x5: reimplement using generic framework +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com> +Message-ID: <1273938833-11366-6-git-send-email-jhovold@gmail.com> + + +Kill custom fifo, read, and single-urb write implementations. + +Compile-only tested. + +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/spcp8x5.c | 407 +++---------------------------------------- + 1 file changed, 29 insertions(+), 378 deletions(-) + +--- a/drivers/usb/serial/spcp8x5.c ++++ b/drivers/usb/serial/spcp8x5.c +@@ -1,6 +1,7 @@ + /* + * spcp8x5 USB to serial adaptor driver + * ++ * Copyright (C) 2010 Johan Hovold (jhovold@gmail.com) + * Copyright (C) 2006 Linxb (xubin.lin@worldplus.com.cn) + * Copyright (C) 2006 S1 Corp. + * +@@ -29,7 +30,7 @@ + + + /* Version Information */ +-#define DRIVER_VERSION "v0.04" ++#define DRIVER_VERSION "v0.10" + #define DRIVER_DESC "SPCP8x5 USB to serial adaptor driver" + + static int debug; +@@ -64,11 +65,6 @@ struct spcp8x5_usb_ctrl_arg { + u16 length; + }; + +-/* wait 30s before close */ +-#define SPCP8x5_CLOSING_WAIT (30*HZ) +- +-#define SPCP8x5_BUF_SIZE 1024 +- + + /* spcp8x5 spec register define */ + #define MCR_CONTROL_LINE_RTS 0x02 +@@ -155,133 +151,6 @@ enum spcp8x5_type { + SPCP835_TYPE, + }; + +-/* 1st in 1st out buffer 4 driver */ +-struct ringbuf { +- unsigned int buf_size; +- char *buf_buf; +- char *buf_get; +- char *buf_put; +-}; +- +-/* alloc the ring buf and alloc the buffer itself */ +-static inline struct ringbuf *alloc_ringbuf(unsigned int size) +-{ +- struct ringbuf *pb; +- +- if (size == 0) +- return NULL; +- +- pb = kmalloc(sizeof(*pb), GFP_KERNEL); +- if (pb == NULL) +- return NULL; +- +- pb->buf_buf = kmalloc(size, GFP_KERNEL); +- if (pb->buf_buf == NULL) { +- kfree(pb); +- return NULL; +- } +- +- pb->buf_size = size; +- pb->buf_get = pb->buf_put = pb->buf_buf; +- +- return pb; +-} +- +-/* free the ring buf and the buffer itself */ +-static inline void free_ringbuf(struct ringbuf *pb) +-{ +- if (pb != NULL) { +- kfree(pb->buf_buf); +- kfree(pb); +- } +-} +- +-/* clear pipo , juest repoint the pointer here */ +-static inline void clear_ringbuf(struct ringbuf *pb) +-{ +- if (pb != NULL) +- pb->buf_get = pb->buf_put; +-} +- +-/* get the number of data in the pipo */ +-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; +-} +- +-/* get the number of space in the pipo */ +-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; +-} +- +-/* put count data into pipo */ +-static unsigned int put_ringbuf(struct ringbuf *pb, const char *buf, +- unsigned int count) +-{ +- unsigned int len; +- +- if (pb == NULL) +- return 0; +- +- len = ringbuf_avail_space(pb); +- if (count > len) +- count = len; +- +- if (count == 0) +- return 0; +- +- len = pb->buf_buf + pb->buf_size - pb->buf_put; +- if (count > len) { +- memcpy(pb->buf_put, buf, len); +- memcpy(pb->buf_buf, buf+len, count - len); +- pb->buf_put = pb->buf_buf + count - len; +- } else { +- memcpy(pb->buf_put, buf, count); +- if (count < len) +- pb->buf_put += count; +- else /* count == len */ +- pb->buf_put = pb->buf_buf; +- } +- return count; +-} +- +-/* get count data from pipo */ +-static unsigned int get_ringbuf(struct ringbuf *pb, char *buf, +- unsigned int count) +-{ +- unsigned int len; +- +- if (pb == NULL || buf == NULL) +- return 0; +- +- len = ringbuf_avail_data(pb); +- if (count > len) +- count = len; +- +- if (count == 0) +- return 0; +- +- len = pb->buf_buf + pb->buf_size - pb->buf_get; +- if (count > len) { +- memcpy(buf, pb->buf_get, len); +- memcpy(buf+len, pb->buf_buf, count - len); +- pb->buf_get = pb->buf_buf + count - len; +- } else { +- memcpy(buf, pb->buf_get, count); +- if (count < len) +- pb->buf_get += count; +- else /* count == len */ +- pb->buf_get = pb->buf_buf; +- } +- +- return count; +-} +- + static struct usb_driver spcp8x5_driver = { + .name = "spcp8x5", + .probe = usb_serial_probe, +@@ -293,8 +162,6 @@ static struct usb_driver spcp8x5_driver + + struct spcp8x5_private { + spinlock_t lock; +- struct ringbuf *buf; +- int write_urb_in_use; + enum spcp8x5_type type; + wait_queue_head_t delta_msr_wait; + u8 line_control; +@@ -330,24 +197,15 @@ static int spcp8x5_startup(struct usb_se + goto cleanup; + + spin_lock_init(&priv->lock); +- priv->buf = alloc_ringbuf(SPCP8x5_BUF_SIZE); +- if (priv->buf == NULL) +- goto cleanup2; +- + init_waitqueue_head(&priv->delta_msr_wait); + priv->type = type; + usb_set_serial_port_data(serial->port[i] , priv); +- + } + + return 0; +- +-cleanup2: +- kfree(priv); + cleanup: + for (--i; i >= 0; --i) { + priv = usb_get_serial_port_data(serial->port[i]); +- free_ringbuf(priv->buf); + kfree(priv); + usb_set_serial_port_data(serial->port[i] , NULL); + } +@@ -358,15 +216,9 @@ cleanup: + static void spcp8x5_release(struct usb_serial *serial) + { + int i; +- struct spcp8x5_private *priv; + +- for (i = 0; i < serial->num_ports; i++) { +- priv = usb_get_serial_port_data(serial->port[i]); +- if (priv) { +- free_ringbuf(priv->buf); +- kfree(priv); +- } +- } ++ for (i = 0; i < serial->num_ports; i++) ++ kfree(usb_get_serial_port_data(serial->port[i])); + } + + /* set the modem control line of the device. +@@ -470,33 +322,6 @@ static void spcp8x5_dtr_rts(struct usb_s + spcp8x5_set_ctrlLine(port->serial->dev, control , priv->type); + } + +-/* close the serial port. We should wait for data sending to device 1st and +- * then kill all urb. */ +-static void spcp8x5_close(struct usb_serial_port *port) +-{ +- struct spcp8x5_private *priv = usb_get_serial_port_data(port); +- unsigned long flags; +- int result; +- +- dbg("%s - port %d", __func__, port->number); +- +- spin_lock_irqsave(&priv->lock, flags); +- /* clear out any remaining data in the buffer */ +- clear_ringbuf(priv->buf); +- spin_unlock_irqrestore(&priv->lock, flags); +- +- /* kill urb */ +- if (port->write_urb != NULL) { +- result = usb_unlink_urb(port->write_urb); +- if (result) +- dev_dbg(&port->dev, +- "usb_unlink_urb(write_urb) = %d\n", result); +- } +- result = usb_unlink_urb(port->read_urb); +- if (result) +- dev_dbg(&port->dev, "usb_unlink_urb(read_urb) = %d\n", result); +-} +- + static void spcp8x5_init_termios(struct tty_struct *tty) + { + /* for the 1st time call this function */ +@@ -620,7 +445,7 @@ static void spcp8x5_set_termios(struct t + } + + /* open the serial port. do some usb system call. set termios and get the line +- * status of the device. then submit the read urb */ ++ * status of the device. */ + static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port) + { + struct ktermios tmp_termios; +@@ -655,52 +480,21 @@ static int spcp8x5_open(struct tty_struc + priv->line_status = status & 0xf0 ; + spin_unlock_irqrestore(&priv->lock, flags); + +- dbg("%s - submitting read urb", __func__); +- port->read_urb->dev = serial->dev; +- ret = usb_submit_urb(port->read_urb, GFP_KERNEL); +- if (ret) { +- spcp8x5_close(port); +- return -EPROTO; +- } + port->port.drain_delay = 256; +- return 0; ++ ++ return usb_serial_generic_open(tty, port); + } + +-/* bulk read call back function. check the status of the urb. if transfer +- * failed return. then update the status and the tty send data to tty subsys. +- * submit urb again. +- */ +-static void spcp8x5_read_bulk_callback(struct urb *urb) ++static void spcp8x5_process_read_urb(struct urb *urb) + { + struct usb_serial_port *port = urb->context; + struct spcp8x5_private *priv = usb_get_serial_port_data(port); + struct tty_struct *tty; + unsigned char *data = urb->transfer_buffer; + unsigned long flags; +- int result = urb->status; + u8 status; + char tty_flag; + +- dev_dbg(&port->dev, "start, result = %d, urb->actual_length = %d\n,", +- result, urb->actual_length); +- +- /* check the urb status */ +- if (result) { +- if (result == -EPROTO) { +- /* spcp8x5 mysteriously fails with -EPROTO */ +- /* reschedule the read */ +- urb->dev = port->serial->dev; +- result = usb_submit_urb(urb , GFP_ATOMIC); +- if (result) +- dev_dbg(&port->dev, +- "failed submitting read urb %d\n", +- result); +- return; +- } +- dev_dbg(&port->dev, "unable to handle the error, exiting.\n"); +- return; +- } +- + /* get tty_flag from status */ + tty_flag = TTY_NORMAL; + +@@ -711,141 +505,33 @@ static void spcp8x5_read_bulk_callback(s + /* wake up the wait for termios */ + wake_up_interruptible(&priv->delta_msr_wait); + +- /* break takes precedence over parity, which takes precedence over +- * framing errors */ +- if (status & UART_BREAK_ERROR) +- tty_flag = TTY_BREAK; +- else if (status & UART_PARITY_ERROR) +- tty_flag = TTY_PARITY; +- else if (status & UART_FRAME_ERROR) +- tty_flag = TTY_FRAME; +- dev_dbg(&port->dev, "tty_flag = %d\n", tty_flag); +- +- tty = tty_port_tty_get(&port->port); +- if (tty && urb->actual_length) { +- /* overrun is special, not associated with a char */ +- if (status & UART_OVERRUN_ERROR) +- tty_insert_flip_char(tty, 0, TTY_OVERRUN); +- tty_insert_flip_string_fixed_flag(tty, data, tty_flag, +- urb->actual_length); +- tty_flip_buffer_push(tty); +- } +- tty_kref_put(tty); +- +- /* Schedule the next read */ +- urb->dev = port->serial->dev; +- result = usb_submit_urb(urb , GFP_ATOMIC); +- if (result) +- dev_dbg(&port->dev, "failed submitting read urb %d\n", result); +-} +- +-/* get data from ring buffer and then write to usb bus */ +-static void spcp8x5_send(struct usb_serial_port *port) +-{ +- int count, result; +- struct spcp8x5_private *priv = usb_get_serial_port_data(port); +- unsigned long flags; +- +- spin_lock_irqsave(&priv->lock, flags); +- +- if (priv->write_urb_in_use) { +- dev_dbg(&port->dev, "write urb still used\n"); +- spin_unlock_irqrestore(&priv->lock, flags); ++ if (!urb->actual_length) + return; +- } +- +- /* send the 1st urb for writting */ +- memset(port->write_urb->transfer_buffer , 0x00 , port->bulk_out_size); +- count = get_ringbuf(priv->buf, port->write_urb->transfer_buffer, +- port->bulk_out_size); + +- if (count == 0) { +- spin_unlock_irqrestore(&priv->lock, flags); ++ tty = tty_port_tty_get(&port->port); ++ if (!tty) + return; +- } +- +- /* update the urb status */ +- priv->write_urb_in_use = 1; +- +- spin_unlock_irqrestore(&priv->lock, flags); +- +- port->write_urb->transfer_buffer_length = count; +- port->write_urb->dev = port->serial->dev; +- +- result = usb_submit_urb(port->write_urb, GFP_ATOMIC); +- if (result) { +- dev_dbg(&port->dev, "failed submitting write urb, error %d\n", +- result); +- priv->write_urb_in_use = 0; +- /* TODO: reschedule spcp8x5_send */ +- } +- +- +- schedule_work(&port->work); +-} + +-/* this is the call back function for write urb. NOTE we should not sleep in +- * this routine. check the urb return code and then submit the write urb again +- * to hold the write loop */ +-static void spcp8x5_write_bulk_callback(struct urb *urb) +-{ +- struct usb_serial_port *port = urb->context; +- struct spcp8x5_private *priv = usb_get_serial_port_data(port); +- int result; +- int status = urb->status; ++ if (status & UART_STATE_TRANSIENT_MASK) { ++ /* break takes precedence over parity, which takes precedence ++ * over framing errors */ ++ if (status & UART_BREAK_ERROR) ++ tty_flag = TTY_BREAK; ++ else if (status & UART_PARITY_ERROR) ++ tty_flag = TTY_PARITY; ++ else if (status & UART_FRAME_ERROR) ++ tty_flag = TTY_FRAME; ++ dev_dbg(&port->dev, "tty_flag = %d\n", tty_flag); + +- switch (status) { +- case 0: +- /* success */ +- break; +- case -ECONNRESET: +- case -ENOENT: +- case -ESHUTDOWN: +- /* this urb is terminated, clean up */ +- dev_dbg(&port->dev, "urb shutting down with status: %d\n", +- status); +- priv->write_urb_in_use = 0; +- return; +- default: +- /* error in the urb, so we have to resubmit it */ +- dbg("%s - Overflow in write", __func__); +- dbg("%s - nonzero write bulk status received: %d", +- __func__, status); +- port->write_urb->transfer_buffer_length = 1; +- port->write_urb->dev = port->serial->dev; +- result = usb_submit_urb(port->write_urb, GFP_ATOMIC); +- if (result) +- dev_dbg(&port->dev, +- "failed resubmitting write urb %d\n", result); +- else +- return; ++ /* overrun is special, not associated with a char */ ++ if (status & UART_OVERRUN_ERROR) ++ tty_insert_flip_char(tty, 0, TTY_OVERRUN); + } + +- priv->write_urb_in_use = 0; +- +- /* send any buffered data */ +- spcp8x5_send(port); +-} +- +-/* write data to ring buffer. and then start the write transfer */ +-static int spcp8x5_write(struct tty_struct *tty, struct usb_serial_port *port, +- const unsigned char *buf, int count) +-{ +- struct spcp8x5_private *priv = usb_get_serial_port_data(port); +- unsigned long flags; +- +- dev_dbg(&port->dev, "%d bytes\n", count); +- +- if (!count) +- return count; +- +- spin_lock_irqsave(&priv->lock, flags); +- count = put_ringbuf(priv->buf, buf, count); +- spin_unlock_irqrestore(&priv->lock, flags); +- +- spcp8x5_send(port); +- +- return count; ++ tty_insert_flip_string_fixed_flag(tty, data, tty_flag, ++ urb->actual_length); ++ tty_flip_buffer_push(tty); ++ tty_kref_put(tty); + } + + static int spcp8x5_wait_modem_info(struct usb_serial_port *port, +@@ -953,36 +639,6 @@ static int spcp8x5_tiocmget(struct tty_s + return result; + } + +-/* get the avail space room in ring buffer */ +-static int spcp8x5_write_room(struct tty_struct *tty) +-{ +- struct usb_serial_port *port = tty->driver_data; +- struct spcp8x5_private *priv = usb_get_serial_port_data(port); +- int room = 0; +- unsigned long flags; +- +- spin_lock_irqsave(&priv->lock, flags); +- room = ringbuf_avail_space(priv->buf); +- spin_unlock_irqrestore(&priv->lock, flags); +- +- return room; +-} +- +-/* get the number of avail data in write ring buffer */ +-static int spcp8x5_chars_in_buffer(struct tty_struct *tty) +-{ +- struct usb_serial_port *port = tty->driver_data; +- struct spcp8x5_private *priv = usb_get_serial_port_data(port); +- int chars = 0; +- unsigned long flags; +- +- spin_lock_irqsave(&priv->lock, flags); +- chars = ringbuf_avail_data(priv->buf); +- spin_unlock_irqrestore(&priv->lock, flags); +- +- return chars; +-} +- + /* All of the device info needed for the spcp8x5 SIO serial converter */ + static struct usb_serial_driver spcp8x5_device = { + .driver = { +@@ -992,21 +648,16 @@ static struct usb_serial_driver spcp8x5_ + .id_table = id_table, + .num_ports = 1, + .open = spcp8x5_open, +- .close = spcp8x5_close, + .dtr_rts = spcp8x5_dtr_rts, + .carrier_raised = spcp8x5_carrier_raised, +- .write = spcp8x5_write, + .set_termios = spcp8x5_set_termios, + .init_termios = spcp8x5_init_termios, + .ioctl = spcp8x5_ioctl, + .tiocmget = spcp8x5_tiocmget, + .tiocmset = spcp8x5_tiocmset, +- .write_room = spcp8x5_write_room, +- .read_bulk_callback = spcp8x5_read_bulk_callback, +- .write_bulk_callback = spcp8x5_write_bulk_callback, +- .chars_in_buffer = spcp8x5_chars_in_buffer, + .attach = spcp8x5_startup, + .release = spcp8x5_release, ++ .process_read_urb = spcp8x5_process_read_urb, + }; + + static int __init spcp8x5_init(void) diff --git a/usb/usb-storage-always-print-quirks.patch b/usb/usb-storage-always-print-quirks.patch new file mode 100644 index 00000000000000..de3b2b11d025cf --- /dev/null +++ b/usb/usb-storage-always-print-quirks.patch @@ -0,0 +1,50 @@ +From felipe.contreras@gmail.com Mon May 17 11:16:31 2010 +From: Felipe Contreras <felipe.contreras@gmail.com> +Date: Sun, 16 May 2010 23:31:07 +0300 +Subject: [PATCH t2 2/2] usb-storage: always print quirks +To: usb-storage@lists.one-eyed-alien.net +Cc: linux-usb@vger.kernel.org, Greg Kroah-Hartman <gregkh@suse.de>, Felipe Contreras <felipe.contreras@gmail.com> +Message-ID: <1274041867-15032-3-git-send-email-felipe.contreras@gmail.com> + + +Right now quirks are printed only when the are manually overriden with +the module parameters. It's not so useful to remind the user that his +parameters are correctly applied; what is useful is to print out the +quirks the user is not aware are being applied. + +So let's do the smart thing and print the quirks when they are present. + +Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> +Cc: Alan Stern <stern@rowland.harvard.edu> +Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/storage/usb.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/drivers/usb/storage/usb.c ++++ b/drivers/usb/storage/usb.c +@@ -498,9 +498,6 @@ static void adjust_quirks(struct us_data + } + } + us->fflags = (us->fflags & ~mask) | f; +- dev_info(&us->pusb_intf->dev, "Quirks match for " +- "vid %04x pid %04x: %x\n", +- vid, pid, f); + } + + /* Get the unusual_devs entries and the string descriptors */ +@@ -535,6 +532,12 @@ static int get_device_info(struct us_dat + if (dev->speed != USB_SPEED_HIGH) + us->fflags &= ~US_FL_GO_SLOW; + ++ if (us->fflags) ++ dev_info(pdev, "Quirks match for vid %04x pid %04x: %lx\n", ++ le16_to_cpu(dev->descriptor.idVendor), ++ le16_to_cpu(dev->descriptor.idProduct), ++ us->fflags); ++ + /* Log a message if a non-generic unusual_dev entry contains an + * unnecessary subclass or protocol override. This may stimulate + * reports from users that will help us remove unneeded entries diff --git a/usb/usb-usb-storage-trivial-debug-improvements.patch b/usb/usb-usb-storage-trivial-debug-improvements.patch new file mode 100644 index 00000000000000..96f654b6714bb1 --- /dev/null +++ b/usb/usb-usb-storage-trivial-debug-improvements.patch @@ -0,0 +1,170 @@ +From felipe.contreras@gmail.com Mon May 17 11:15:58 2010 +From: Felipe Contreras <felipe.contreras@gmail.com> +Date: Sun, 16 May 2010 23:31:06 +0300 +Subject: USB: usb-storage: trivial debug improvements +To: usb-storage@lists.one-eyed-alien.net +Cc: linux-usb@vger.kernel.org, Greg Kroah-Hartman <gregkh@suse.de>, Felipe Contreras <felipe.contreras@gmail.com> +Message-ID: <1274041867-15032-2-git-send-email-felipe.contreras@gmail.com> + + +Use pr_foo and dev_foo instead of printk. Maybe US_DEBUG* should be +replaced too. + +Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> +Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net> +Cc: Alan Stern <stern@rowland.harvard.edu> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/storage/usb.c | 61 ++++++++++++++++++++++++---------------------- + 1 file changed, 32 insertions(+), 29 deletions(-) + +--- a/drivers/usb/storage/usb.c ++++ b/drivers/usb/storage/usb.c +@@ -510,6 +510,7 @@ static int get_device_info(struct us_dat + struct usb_device *dev = us->pusb_dev; + struct usb_interface_descriptor *idesc = + &us->pusb_intf->cur_altsetting->desc; ++ struct device *pdev = &us->pusb_intf->dev; + + /* Store the entries */ + us->unusual_dev = unusual_dev; +@@ -523,7 +524,7 @@ static int get_device_info(struct us_dat + adjust_quirks(us); + + if (us->fflags & US_FL_IGNORE_DEVICE) { +- printk(KERN_INFO USB_STORAGE "device ignored\n"); ++ dev_info(pdev, "device ignored\n"); + return -ENODEV; + } + +@@ -554,20 +555,20 @@ static int get_device_info(struct us_dat + us->protocol == idesc->bInterfaceProtocol) + msg += 2; + if (msg >= 0 && !(us->fflags & US_FL_NEED_OVERRIDE)) +- printk(KERN_NOTICE USB_STORAGE "This device " +- "(%04x,%04x,%04x S %02x P %02x)" +- " has %s in unusual_devs.h (kernel" +- " %s)\n" +- " Please send a copy of this message to " +- "<linux-usb@vger.kernel.org> and " +- "<usb-storage@lists.one-eyed-alien.net>\n", +- le16_to_cpu(ddesc->idVendor), +- le16_to_cpu(ddesc->idProduct), +- le16_to_cpu(ddesc->bcdDevice), +- idesc->bInterfaceSubClass, +- idesc->bInterfaceProtocol, +- msgs[msg], +- utsname()->release); ++ dev_notice(pdev, "This device " ++ "(%04x,%04x,%04x S %02x P %02x)" ++ " has %s in unusual_devs.h (kernel" ++ " %s)\n" ++ " Please send a copy of this message to " ++ "<linux-usb@vger.kernel.org> and " ++ "<usb-storage@lists.one-eyed-alien.net>\n", ++ le16_to_cpu(ddesc->idVendor), ++ le16_to_cpu(ddesc->idProduct), ++ le16_to_cpu(ddesc->bcdDevice), ++ idesc->bInterfaceSubClass, ++ idesc->bInterfaceProtocol, ++ msgs[msg], ++ utsname()->release); + } + + return 0; +@@ -717,8 +718,8 @@ static int usb_stor_acquire_resources(st + /* Start up our control thread */ + th = kthread_run(usb_stor_control_thread, us, "usb-storage"); + if (IS_ERR(th)) { +- printk(KERN_WARNING USB_STORAGE +- "Unable to start control thread\n"); ++ dev_warn(&us->pusb_intf->dev, ++ "Unable to start control thread\n"); + return PTR_ERR(th); + } + us->ctl_thread = th; +@@ -811,13 +812,14 @@ static void release_everything(struct us + static int usb_stor_scan_thread(void * __us) + { + struct us_data *us = (struct us_data *)__us; ++ struct device *dev = &us->pusb_intf->dev; + +- dev_dbg(&us->pusb_intf->dev, "device found\n"); ++ dev_dbg(dev, "device found\n"); + + set_freezable(); + /* Wait for the timeout to expire or for a disconnect */ + if (delay_use > 0) { +- dev_dbg(&us->pusb_intf->dev, "waiting for device to settle " ++ dev_dbg(dev, "waiting for device to settle " + "before scanning\n"); + wait_event_freezable_timeout(us->delay_wait, + test_bit(US_FLIDX_DONT_SCAN, &us->dflags), +@@ -835,7 +837,7 @@ static int usb_stor_scan_thread(void * _ + mutex_unlock(&us->dev_mutex); + } + scsi_scan_host(us_to_host(us)); +- dev_dbg(&us->pusb_intf->dev, "scan complete\n"); ++ dev_dbg(dev, "scan complete\n"); + + /* Should we unbind if no devices were detected? */ + } +@@ -871,8 +873,8 @@ int usb_stor_probe1(struct us_data **pus + */ + host = scsi_host_alloc(&usb_stor_host_template, sizeof(*us)); + if (!host) { +- printk(KERN_WARNING USB_STORAGE +- "Unable to allocate the scsi host\n"); ++ dev_warn(&intf->dev, ++ "Unable to allocate the scsi host\n"); + return -ENOMEM; + } + +@@ -920,6 +922,7 @@ int usb_stor_probe2(struct us_data *us) + { + struct task_struct *th; + int result; ++ struct device *dev = &us->pusb_intf->dev; + + /* Make sure the transport and protocol have both been set */ + if (!us->transport || !us->proto_handler) { +@@ -944,18 +947,18 @@ int usb_stor_probe2(struct us_data *us) + goto BadDevice; + snprintf(us->scsi_name, sizeof(us->scsi_name), "usb-storage %s", + dev_name(&us->pusb_intf->dev)); +- result = scsi_add_host(us_to_host(us), &us->pusb_intf->dev); ++ result = scsi_add_host(us_to_host(us), dev); + if (result) { +- printk(KERN_WARNING USB_STORAGE +- "Unable to add the scsi host\n"); ++ dev_warn(dev, ++ "Unable to add the scsi host\n"); + goto BadDevice; + } + + /* Start up the thread for delayed SCSI-device scanning */ + th = kthread_create(usb_stor_scan_thread, us, "usb-stor-scan"); + if (IS_ERR(th)) { +- printk(KERN_WARNING USB_STORAGE +- "Unable to start the device-scanning thread\n"); ++ dev_warn(dev, ++ "Unable to start the device-scanning thread\n"); + complete(&us->scanning_done); + quiesce_and_remove_host(us); + result = PTR_ERR(th); +@@ -1041,12 +1044,12 @@ static int __init usb_stor_init(void) + { + int retval; + +- printk(KERN_INFO "Initializing USB Mass Storage driver...\n"); ++ pr_info("Initializing USB Mass Storage driver...\n"); + + /* register the driver, return usb_register return code if error */ + retval = usb_register(&usb_storage_driver); + if (retval == 0) { +- printk(KERN_INFO "USB Mass Storage support registered.\n"); ++ pr_info("USB Mass Storage support registered.\n"); + usb_usual_set_present(USB_US_TYPE_STOR); + } + return retval; diff --git a/usb/usb-usb.h-checkpatch-cleanups.patch b/usb/usb-usb.h-checkpatch-cleanups.patch new file mode 100644 index 00000000000000..c9b8419992275c --- /dev/null +++ b/usb/usb-usb.h-checkpatch-cleanups.patch @@ -0,0 +1,110 @@ +From foo@baz Mon May 17 10:40:55 PDT 2010 +Date: Mon, 17 May 2010 10:40:55 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: USB: usb.h: checkpatch cleanups + +Minor formatting changes to clean up the file. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + include/linux/usb.h | 32 ++++++++++++++++---------------- + 1 file changed, 16 insertions(+), 16 deletions(-) + +--- a/include/linux/usb.h ++++ b/include/linux/usb.h +@@ -65,7 +65,7 @@ struct usb_host_endpoint { + struct usb_ss_ep_comp_descriptor ss_ep_comp; + struct list_head urb_list; + void *hcpriv; +- struct ep_device *ep_dev; /* For sysfs info */ ++ struct ep_device *ep_dev; /* For sysfs info */ + + unsigned char *extra; /* Extra descriptors */ + int extralen; +@@ -96,8 +96,8 @@ enum usb_interface_condition { + /** + * struct usb_interface - what usb device drivers talk to + * @altsetting: array of interface structures, one for each alternate +- * setting that may be selected. Each one includes a set of +- * endpoint configurations. They will be in no particular order. ++ * setting that may be selected. Each one includes a set of ++ * endpoint configurations. They will be in no particular order. + * @cur_altsetting: the current altsetting. + * @num_altsetting: number of altsettings defined. + * @intf_assoc: interface association descriptor +@@ -200,7 +200,7 @@ void usb_put_intf(struct usb_interface * + + /* this maximum is arbitrary */ + #define USB_MAXINTERFACES 32 +-#define USB_MAXIADS USB_MAXINTERFACES/2 ++#define USB_MAXIADS (USB_MAXINTERFACES/2) + + /** + * struct usb_interface_cache - long-term representation of a device interface +@@ -420,7 +420,7 @@ struct usb_tt; + */ + struct usb_device { + int devnum; +- char devpath [16]; ++ char devpath[16]; + u32 route; + enum usb_device_state state; + enum usb_device_speed speed; +@@ -453,7 +453,7 @@ struct usb_device { + unsigned persist_enabled:1; + unsigned have_langid:1; + unsigned authorized:1; +- unsigned authenticated:1; ++ unsigned authenticated:1; + unsigned wusb:1; + int string_langid; + +@@ -664,7 +664,7 @@ static inline int usb_make_path(struct u + * This macro is used to create a struct usb_device_id that matches a + * specific device. + */ +-#define USB_DEVICE(vend,prod) \ ++#define USB_DEVICE(vend, prod) \ + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \ + .idVendor = (vend), \ + .idProduct = (prod) +@@ -1186,7 +1186,7 @@ struct urb { + * current owner */ + struct list_head anchor_list; /* the URB may be anchored */ + struct usb_anchor *anchor; +- struct usb_device *dev; /* (in) pointer to associated device */ ++ struct usb_device *dev; /* (in) pointer to associated device */ + struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */ + unsigned int pipe; /* (in) pipe information */ + unsigned int stream_id; /* (in) stream ID */ +@@ -1535,21 +1535,21 @@ static inline unsigned int __create_pipe + } + + /* Create various pipes... */ +-#define usb_sndctrlpipe(dev,endpoint) \ ++#define usb_sndctrlpipe(dev, endpoint) \ + ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint)) +-#define usb_rcvctrlpipe(dev,endpoint) \ ++#define usb_rcvctrlpipe(dev, endpoint) \ + ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) +-#define usb_sndisocpipe(dev,endpoint) \ ++#define usb_sndisocpipe(dev, endpoint) \ + ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint)) +-#define usb_rcvisocpipe(dev,endpoint) \ ++#define usb_rcvisocpipe(dev, endpoint) \ + ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) +-#define usb_sndbulkpipe(dev,endpoint) \ ++#define usb_sndbulkpipe(dev, endpoint) \ + ((PIPE_BULK << 30) | __create_pipe(dev, endpoint)) +-#define usb_rcvbulkpipe(dev,endpoint) \ ++#define usb_rcvbulkpipe(dev, endpoint) \ + ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) +-#define usb_sndintpipe(dev,endpoint) \ ++#define usb_sndintpipe(dev, endpoint) \ + ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint)) +-#define usb_rcvintpipe(dev,endpoint) \ ++#define usb_rcvintpipe(dev, endpoint) \ + ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) + + static inline struct usb_host_endpoint * diff --git a/usb/usb-usb_debug-set-bulk-out-size-at-probe.patch b/usb/usb-usb_debug-set-bulk-out-size-at-probe.patch new file mode 100644 index 00000000000000..1a2048e63efa9b --- /dev/null +++ b/usb/usb-usb_debug-set-bulk-out-size-at-probe.patch @@ -0,0 +1,42 @@ +From jhovold@gmail.com Mon May 17 11:14:05 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sun, 16 May 2010 20:33:48 +0200 +Subject: USB: usb_debug: set bulk out size at probe +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com> +Message-ID: <1274034832-27301-2-git-send-email-jhovold@gmail.com> + + +Use bulk_out_size in usb_serial_driver to set urb buffer size. + +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/usb_debug.c | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +--- a/drivers/usb/serial/usb_debug.c ++++ b/drivers/usb/serial/usb_debug.c +@@ -43,12 +43,6 @@ static struct usb_driver debug_driver = + .no_dynamic_id = 1, + }; + +-static int usb_debug_open(struct tty_struct *tty, struct usb_serial_port *port) +-{ +- port->bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE; +- return usb_serial_generic_open(tty, port); +-} +- + /* This HW really does not support a serial break, so one will be + * emulated when ever the break state is set to true. + */ +@@ -82,7 +76,7 @@ static struct usb_serial_driver debug_de + }, + .id_table = id_table, + .num_ports = 1, +- .open = usb_debug_open, ++ .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE, + .break_ctl = usb_debug_break_ctl, + .read_bulk_callback = usb_debug_read_bulk_callback, + }; diff --git a/usb/usb-visor-fix-memory-leak.patch b/usb/usb-visor-fix-memory-leak.patch new file mode 100644 index 00000000000000..921e1cba64a57b --- /dev/null +++ b/usb/usb-visor-fix-memory-leak.patch @@ -0,0 +1,30 @@ +From jhovold@gmail.com Mon May 17 11:08:12 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sat, 15 May 2010 17:53:48 +0200 +Subject: USB: visor: fix memory leak +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com>, stable <stable@kernel.org> +Message-ID: <1273938833-11366-7-git-send-email-jhovold@gmail.com> + + +Fix memory leak for some devices (Sony Clie 3.5) due to port private +data not being freed on release. + +Cc: stable <stable@kernel.org> +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/visor.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/usb/serial/visor.c ++++ b/drivers/usb/serial/visor.c +@@ -249,6 +249,7 @@ static struct usb_serial_driver clie_3_5 + .throttle = visor_throttle, + .unthrottle = visor_unthrottle, + .attach = clie_3_5_startup, ++ .release = visor_release, + .write = visor_write, + .write_room = visor_write_room, + .write_bulk_callback = visor_write_bulk_callback, diff --git a/usb/usb-visor-increase-bulk-out-buffer-size.patch b/usb/usb-visor-increase-bulk-out-buffer-size.patch new file mode 100644 index 00000000000000..e0c1da0f49f1cb --- /dev/null +++ b/usb/usb-visor-increase-bulk-out-buffer-size.patch @@ -0,0 +1,50 @@ +From jhovold@gmail.com Mon May 17 11:09:56 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sun, 16 May 2010 15:06:55 +0200 +Subject: USB: visor: increase bulk-out buffer size +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com> +Message-ID: <1274015215-26575-1-git-send-email-jhovold@gmail.com> + + +Increase the bulk-out buffer size to avoid any regression in throughput +after replacing the old writing scheme which used dynamic buffers (e.g. +up to 2k). + +256b has been determined to be a good choice for several drivers +including ftdi_sio which used to have a more or less identical write +implementation. + +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/visor.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/usb/serial/visor.c ++++ b/drivers/usb/serial/visor.c +@@ -186,6 +186,7 @@ static struct usb_serial_driver handspri + .usb_driver = &visor_driver, + .id_table = id_table, + .num_ports = 2, ++ .bulk_out_size = 256, + .open = visor_open, + .close = visor_close, + .throttle = usb_serial_generic_throttle, +@@ -206,6 +207,7 @@ static struct usb_serial_driver clie_5_d + .usb_driver = &visor_driver, + .id_table = clie_id_5_table, + .num_ports = 2, ++ .bulk_out_size = 256, + .open = visor_open, + .close = visor_close, + .throttle = usb_serial_generic_throttle, +@@ -226,6 +228,7 @@ static struct usb_serial_driver clie_3_5 + .usb_driver = &visor_driver, + .id_table = clie_id_3_5_table, + .num_ports = 1, ++ .bulk_out_size = 256, + .open = visor_open, + .close = visor_close, + .throttle = usb_serial_generic_throttle, diff --git a/usb/usb-visor-reimplement-using-generic-framework.patch b/usb/usb-visor-reimplement-using-generic-framework.patch new file mode 100644 index 00000000000000..bb5aa2737cc53b --- /dev/null +++ b/usb/usb-visor-reimplement-using-generic-framework.patch @@ -0,0 +1,493 @@ +From jhovold@gmail.com Mon May 17 11:08:24 2010 +From: Johan Hovold <jhovold@gmail.com> +Date: Sat, 15 May 2010 17:53:49 +0200 +Subject: USB: visor: reimplement using generic framework +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org, Johan Hovold <jhovold@gmail.com> +Message-ID: <1273938833-11366-8-git-send-email-jhovold@gmail.com> + + +Kill custom read and write implementations (dynamically allocated write +urbs). + +Note that I chose to remove the stat module parameter which was supposed +to keep count of the amount of data sent and received, but which has +been broken for three years (since b308e74d9c708ee2a9af14fbe235e0a41216f4ed +"USB: visor driver adapted to new tty buffering" -- bytes_in was +incorrectly updated and was thus always reported as 0). + +Compile-only tested. + +Signed-off-by: Johan Hovold <jhovold@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/visor.c | 342 +-------------------------------------------- + 1 file changed, 13 insertions(+), 329 deletions(-) + +--- a/drivers/usb/serial/visor.c ++++ b/drivers/usb/serial/visor.c +@@ -38,17 +38,9 @@ + /* function prototypes for a handspring visor */ + static int visor_open(struct tty_struct *tty, struct usb_serial_port *port); + static void visor_close(struct usb_serial_port *port); +-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_calc_num_ports(struct usb_serial *serial); +-static void visor_release(struct usb_serial *serial); +-static void visor_write_bulk_callback(struct urb *urb); +-static void visor_read_bulk_callback(struct urb *urb); + static void visor_read_int_callback(struct urb *urb); + static int clie_3_5_startup(struct usb_serial *serial); + static int treo_attach(struct usb_serial *serial); +@@ -196,16 +188,11 @@ static struct usb_serial_driver handspri + .num_ports = 2, + .open = visor_open, + .close = visor_close, +- .throttle = visor_throttle, +- .unthrottle = visor_unthrottle, ++ .throttle = usb_serial_generic_throttle, ++ .unthrottle = usb_serial_generic_unthrottle, + .attach = treo_attach, + .probe = visor_probe, + .calc_num_ports = visor_calc_num_ports, +- .release = visor_release, +- .write = visor_write, +- .write_room = visor_write_room, +- .write_bulk_callback = visor_write_bulk_callback, +- .read_bulk_callback = visor_read_bulk_callback, + .read_int_callback = visor_read_int_callback, + }; + +@@ -221,16 +208,11 @@ static struct usb_serial_driver clie_5_d + .num_ports = 2, + .open = visor_open, + .close = visor_close, +- .throttle = visor_throttle, +- .unthrottle = visor_unthrottle, ++ .throttle = usb_serial_generic_throttle, ++ .unthrottle = usb_serial_generic_unthrottle, + .attach = clie_5_attach, + .probe = visor_probe, + .calc_num_ports = visor_calc_num_ports, +- .release = visor_release, +- .write = visor_write, +- .write_room = visor_write_room, +- .write_bulk_callback = visor_write_bulk_callback, +- .read_bulk_callback = visor_read_bulk_callback, + .read_int_callback = visor_read_int_callback, + }; + +@@ -246,38 +228,16 @@ static struct usb_serial_driver clie_3_5 + .num_ports = 1, + .open = visor_open, + .close = visor_close, +- .throttle = visor_throttle, +- .unthrottle = visor_unthrottle, ++ .throttle = usb_serial_generic_throttle, ++ .unthrottle = usb_serial_generic_unthrottle, + .attach = clie_3_5_startup, +- .release = visor_release, +- .write = visor_write, +- .write_room = visor_write_room, +- .write_bulk_callback = visor_write_bulk_callback, +- .read_bulk_callback = visor_read_bulk_callback, + }; + +-struct visor_private { +- spinlock_t lock; +- int bytes_in; +- int bytes_out; +- int outstanding_urbs; +- unsigned char throttled; +- unsigned char actually_throttled; +-}; +- +-/* number of outstanding urbs to prevent userspace DoS from happening */ +-#define URB_UPPER_LIMIT 42 +- +-static int stats; +- + /****************************************************************************** + * Handspring Visor specific driver functions + ******************************************************************************/ + static int visor_open(struct tty_struct *tty, struct usb_serial_port *port) + { +- struct usb_serial *serial = port->serial; +- struct visor_private *priv = usb_get_serial_port_data(port); +- unsigned long flags; + int result = 0; + + dbg("%s - port %d", __func__, port->number); +@@ -288,26 +248,10 @@ static int visor_open(struct tty_struct + return -ENODEV; + } + +- spin_lock_irqsave(&priv->lock, flags); +- priv->bytes_in = 0; +- priv->bytes_out = 0; +- priv->throttled = 0; +- spin_unlock_irqrestore(&priv->lock, flags); +- + /* Start reading from the device */ +- usb_fill_bulk_urb(port->read_urb, serial->dev, +- usb_rcvbulkpipe(serial->dev, +- port->bulk_in_endpointAddress), +- port->read_urb->transfer_buffer, +- port->read_urb->transfer_buffer_length, +- visor_read_bulk_callback, port); +- result = usb_submit_urb(port->read_urb, GFP_KERNEL); +- if (result) { +- dev_err(&port->dev, +- "%s - failed submitting read urb, error %d\n", +- __func__, result); ++ result = usb_serial_generic_open(tty, port); ++ if (result) + goto exit; +- } + + if (port->interrupt_in_urb) { + dbg("%s - adding interrupt input for treo", __func__); +@@ -324,13 +268,12 @@ exit: + + static void visor_close(struct usb_serial_port *port) + { +- struct visor_private *priv = usb_get_serial_port_data(port); + unsigned char *transfer_buffer; + + dbg("%s - port %d", __func__, port->number); + + /* shutdown our urbs */ +- usb_kill_urb(port->read_urb); ++ usb_serial_generic_close(port); + usb_kill_urb(port->interrupt_in_urb); + + mutex_lock(&port->serial->disc_mutex); +@@ -347,192 +290,6 @@ static void visor_close(struct usb_seria + } + } + mutex_unlock(&port->serial->disc_mutex); +- +- if (stats) +- dev_info(&port->dev, "Bytes In = %d Bytes Out = %d\n", +- priv->bytes_in, priv->bytes_out); +-} +- +- +-static int visor_write(struct tty_struct *tty, struct usb_serial_port *port, +- const unsigned char *buf, int count) +-{ +- struct visor_private *priv = usb_get_serial_port_data(port); +- struct usb_serial *serial = port->serial; +- struct urb *urb; +- unsigned char *buffer; +- unsigned long flags; +- int status; +- +- dbg("%s - port %d", __func__, port->number); +- +- spin_lock_irqsave(&priv->lock, flags); +- if (priv->outstanding_urbs > URB_UPPER_LIMIT) { +- spin_unlock_irqrestore(&priv->lock, flags); +- dbg("%s - write limit hit", __func__); +- return 0; +- } +- priv->outstanding_urbs++; +- spin_unlock_irqrestore(&priv->lock, flags); +- +- buffer = kmalloc(count, GFP_ATOMIC); +- if (!buffer) { +- dev_err(&port->dev, "out of memory\n"); +- count = -ENOMEM; +- goto error_no_buffer; +- } +- +- urb = usb_alloc_urb(0, GFP_ATOMIC); +- if (!urb) { +- dev_err(&port->dev, "no more free urbs\n"); +- count = -ENOMEM; +- goto error_no_urb; +- } +- +- memcpy(buffer, buf, count); +- +- usb_serial_debug_data(debug, &port->dev, __func__, count, buffer); +- +- usb_fill_bulk_urb(urb, serial->dev, +- usb_sndbulkpipe(serial->dev, +- port->bulk_out_endpointAddress), +- buffer, count, +- visor_write_bulk_callback, port); +- +- /* send it down the pipe */ +- status = usb_submit_urb(urb, GFP_ATOMIC); +- if (status) { +- dev_err(&port->dev, +- "%s - usb_submit_urb(write bulk) failed with status = %d\n", +- __func__, status); +- count = status; +- goto error; +- } else { +- spin_lock_irqsave(&priv->lock, flags); +- priv->bytes_out += count; +- spin_unlock_irqrestore(&priv->lock, flags); +- } +- +- /* we are done with this urb, so let the host driver +- * really free it when it is finished with it */ +- usb_free_urb(urb); +- +- return count; +-error: +- usb_free_urb(urb); +-error_no_urb: +- kfree(buffer); +-error_no_buffer: +- spin_lock_irqsave(&priv->lock, flags); +- --priv->outstanding_urbs; +- spin_unlock_irqrestore(&priv->lock, flags); +- return count; +-} +- +- +-static int visor_write_room(struct tty_struct *tty) +-{ +- struct usb_serial_port *port = tty->driver_data; +- struct visor_private *priv = usb_get_serial_port_data(port); +- unsigned long flags; +- +- dbg("%s - port %d", __func__, port->number); +- +- /* +- * We really can take anything the user throws at us +- * but let's pick a nice big number to tell the tty +- * layer that we have lots of free space, unless we don't. +- */ +- +- spin_lock_irqsave(&priv->lock, flags); +- if (priv->outstanding_urbs > URB_UPPER_LIMIT * 2 / 3) { +- spin_unlock_irqrestore(&priv->lock, flags); +- dbg("%s - write limit hit", __func__); +- return 0; +- } +- spin_unlock_irqrestore(&priv->lock, flags); +- +- return 2048; +-} +- +- +-static void visor_write_bulk_callback(struct urb *urb) +-{ +- struct usb_serial_port *port = urb->context; +- struct visor_private *priv = usb_get_serial_port_data(port); +- int status = urb->status; +- unsigned long flags; +- +- /* free up the transfer buffer, as usb_free_urb() does not do this */ +- kfree(urb->transfer_buffer); +- +- dbg("%s - port %d", __func__, port->number); +- +- if (status) +- dbg("%s - nonzero write bulk status received: %d", +- __func__, status); +- +- spin_lock_irqsave(&priv->lock, flags); +- --priv->outstanding_urbs; +- spin_unlock_irqrestore(&priv->lock, flags); +- +- usb_serial_port_softint(port); +-} +- +- +-static void visor_read_bulk_callback(struct urb *urb) +-{ +- struct usb_serial_port *port = urb->context; +- struct visor_private *priv = usb_get_serial_port_data(port); +- unsigned char *data = urb->transfer_buffer; +- int status = urb->status; +- struct tty_struct *tty; +- int result; +- int available_room = 0; +- +- dbg("%s - port %d", __func__, port->number); +- +- if (status) { +- dbg("%s - nonzero read bulk status received: %d", +- __func__, status); +- return; +- } +- +- usb_serial_debug_data(debug, &port->dev, __func__, +- urb->actual_length, data); +- +- if (urb->actual_length) { +- tty = tty_port_tty_get(&port->port); +- if (tty) { +- tty_insert_flip_string(tty, data, +- urb->actual_length); +- tty_flip_buffer_push(tty); +- tty_kref_put(tty); +- } +- spin_lock(&priv->lock); +- if (tty) +- priv->bytes_in += available_room; +- +- } else { +- spin_lock(&priv->lock); +- } +- +- /* Continue trying to always read if we should */ +- if (!priv->throttled) { +- usb_fill_bulk_urb(port->read_urb, port->serial->dev, +- usb_rcvbulkpipe(port->serial->dev, +- port->bulk_in_endpointAddress), +- port->read_urb->transfer_buffer, +- port->read_urb->transfer_buffer_length, +- visor_read_bulk_callback, port); +- result = usb_submit_urb(port->read_urb, GFP_ATOMIC); +- if (result) +- dev_err(&port->dev, +- "%s - failed resubmitting read urb, error %d\n", +- __func__, result); +- } else +- priv->actually_throttled = 1; +- spin_unlock(&priv->lock); + } + + static void visor_read_int_callback(struct urb *urb) +@@ -576,41 +333,6 @@ exit: + __func__, result); + } + +-static void visor_throttle(struct tty_struct *tty) +-{ +- struct usb_serial_port *port = tty->driver_data; +- struct visor_private *priv = usb_get_serial_port_data(port); +- +- dbg("%s - port %d", __func__, port->number); +- spin_lock_irq(&priv->lock); +- priv->throttled = 1; +- spin_unlock_irq(&priv->lock); +-} +- +- +-static void visor_unthrottle(struct tty_struct *tty) +-{ +- struct usb_serial_port *port = tty->driver_data; +- struct visor_private *priv = usb_get_serial_port_data(port); +- int result, was_throttled; +- +- dbg("%s - port %d", __func__, port->number); +- spin_lock_irq(&priv->lock); +- priv->throttled = 0; +- was_throttled = priv->actually_throttled; +- priv->actually_throttled = 0; +- spin_unlock_irq(&priv->lock); +- +- if (was_throttled) { +- port->read_urb->dev = port->serial->dev; +- result = usb_submit_urb(port->read_urb, GFP_KERNEL); +- if (result) +- dev_err(&port->dev, +- "%s - failed submitting read urb, error %d\n", +- __func__, result); +- } +-} +- + static int palm_os_3_probe(struct usb_serial *serial, + const struct usb_device_id *id) + { +@@ -778,28 +500,6 @@ static int visor_calc_num_ports(struct u + return num_ports; + } + +-static int generic_startup(struct usb_serial *serial) +-{ +- struct usb_serial_port **ports = serial->port; +- struct visor_private *priv; +- int i; +- +- for (i = 0; i < serial->num_ports; ++i) { +- priv = kzalloc(sizeof(*priv), GFP_KERNEL); +- if (!priv) { +- while (i-- != 0) { +- priv = usb_get_serial_port_data(ports[i]); +- usb_set_serial_port_data(ports[i], NULL); +- kfree(priv); +- } +- return -ENOMEM; +- } +- spin_lock_init(&priv->lock); +- usb_set_serial_port_data(ports[i], priv); +- } +- return 0; +-} +- + static int clie_3_5_startup(struct usb_serial *serial) + { + struct device *dev = &serial->dev->dev; +@@ -850,7 +550,7 @@ static int clie_3_5_startup(struct usb_s + goto out; + } + +- result = generic_startup(serial); ++ result = 0; + out: + kfree(data); + +@@ -868,7 +568,7 @@ static int treo_attach(struct usb_serial + (le16_to_cpu(serial->dev->descriptor.idVendor) + == KYOCERA_VENDOR_ID)) || + (serial->num_interrupt_in == 0)) +- goto generic_startup; ++ return 0; + + dbg("%s", __func__); + +@@ -898,8 +598,7 @@ static int treo_attach(struct usb_serial + COPY_PORT(serial->port[1], swap_port); + kfree(swap_port); + +-generic_startup: +- return generic_startup(serial); ++ return 0; + } + + static int clie_5_attach(struct usb_serial *serial) +@@ -922,20 +621,7 @@ static int clie_5_attach(struct usb_seri + serial->port[0]->bulk_out_endpointAddress = + serial->port[1]->bulk_out_endpointAddress; + +- return generic_startup(serial); +-} +- +-static void visor_release(struct usb_serial *serial) +-{ +- struct visor_private *priv; +- int i; +- +- dbg("%s", __func__); +- +- for (i = 0; i < serial->num_ports; i++) { +- priv = usb_get_serial_port_data(serial->port[i]); +- kfree(priv); +- } ++ return 0; + } + + static int __init visor_init(void) +@@ -1019,8 +705,6 @@ MODULE_LICENSE("GPL"); + + module_param(debug, bool, S_IRUGO | S_IWUSR); + MODULE_PARM_DESC(debug, "Debug enabled or not"); +-module_param(stats, bool, S_IRUGO | S_IWUSR); +-MODULE_PARM_DESC(stats, "Enables statistics or not"); + + module_param(vendor, ushort, 0); + MODULE_PARM_DESC(vendor, "User specified vendor ID"); diff --git a/usb/usb-visor.h-checkpatch-cleanups.patch b/usb/usb-visor.h-checkpatch-cleanups.patch new file mode 100644 index 00000000000000..cf7f1ba46e7631 --- /dev/null +++ b/usb/usb-visor.h-checkpatch-cleanups.patch @@ -0,0 +1,45 @@ +From foo@baz Mon May 17 10:33:41 PDT 2010 +Date: Mon, 17 May 2010 10:33:41 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: USB: visor.h: checkpatch cleanups + +Minor whitespace cleanups to make checkpatch happy. + +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/usb/serial/visor.h | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +--- a/drivers/usb/serial/visor.h ++++ b/drivers/usb/serial/visor.h +@@ -9,8 +9,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. ++ * + */ + + #ifndef __LINUX_USB_SERIAL_VISOR_H +@@ -65,7 +66,7 @@ + #define ACEECA_MEZ1000_ID 0x0001 + + #define KYOCERA_VENDOR_ID 0x0C88 +-#define KYOCERA_7135_ID 0x0021 ++#define KYOCERA_7135_ID 0x0021 + + #define FOSSIL_VENDOR_ID 0x0E67 + #define FOSSIL_ABACUS_ID 0x0002 +@@ -145,7 +146,7 @@ struct visor_connection_info { + * The maximum number of connections currently supported is 2 + */ + struct palm_ext_connection_info { +- __u8 num_ports; ++ __u8 num_ports; + __u8 endpoint_numbers_different; + __le16 reserved1; + struct { diff --git a/usb/usb-xhci-fix-compiler-warning.patch b/usb/usb-xhci-fix-compiler-warning.patch new file mode 100644 index 00000000000000..869d4e16460771 --- /dev/null +++ b/usb/usb-xhci-fix-compiler-warning.patch @@ -0,0 +1,24 @@ +From foo@baz Mon May 17 11:00:29 PDT 2010 +Date: Mon, 17 May 2010 11:00:29 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: USB: xhci: fix compiler warning. + +Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> +Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/host/xhci-ring.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/usb/host/xhci-ring.c ++++ b/drivers/usb/host/xhci-ring.c +@@ -1726,7 +1726,6 @@ static int prepare_ring(struct xhci_hcd + if (enqueue_is_link_trb(ep_ring)) { + struct xhci_ring *ring = ep_ring; + union xhci_trb *next; +- unsigned long long addr; + + xhci_dbg(xhci, "prepare_ring: pointing to link trb\n"); + next = ring->enqueue; |
