[linux-usb-devel] [PATCH 01/19] USB: devices misc: Trivial patch to build the IOWARRIOR when it is selected in Kconfig

2007-07-30 Thread Greg Kroah-Hartman
From: Juergen Beisert [EMAIL PROTECTED]

Trivial patch to build the IOWARRIOR when it is selected in Kconfig.

Signed-off-by: Juergen Beisert [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/Makefile |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index befff5f..ac49b15 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -48,6 +48,7 @@ obj-$(CONFIG_USB_SISUSBVGA)   += misc/
 obj-$(CONFIG_USB_TEST) += misc/
 obj-$(CONFIG_USB_TRANCEVIBRATOR)+= misc/
 obj-$(CONFIG_USB_USS720)   += misc/
+obj-$(CONFIG_USB_IOWARRIOR)+= misc/
 
 obj-$(CONFIG_USB_ATM)  += atm/
 obj-$(CONFIG_USB_SPEEDTOUCH)   += atm/
-- 
1.5.2.2


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 02/19] USB: Don't let usb-storage steal Blackberry Pearl

2007-07-30 Thread Greg Kroah-Hartman
From: Jeremy Katz [EMAIL PROTECTED]

The Blackberry Pearl can run in two modes; a usb-storage only mode
and a mode that allows access via mass storage and to its database.
The berry_charge module will set the device to dual mode and thus we
should ignore its native mode if that module is built

Signed-off-by: Jeremy Katz [EMAIL PROTECTED]
Signed-off-by: Phil Dibowitz [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/storage/unusual_devs.h |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/storage/unusual_devs.h 
b/drivers/usb/storage/unusual_devs.h
index a624e72..da08fcd 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1357,6 +1357,20 @@ UNUSUAL_DEV(  0x0f19, 0x0105, 0x0100, 0x0100,
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_IGNORE_RESIDUE ),
 
+/* Jeremy Katz [EMAIL PROTECTED]:
+ * The Blackberry Pearl can run in two modes; a usb-storage only mode
+ * and a mode that allows access via mass storage and to its database.
+ * The berry_charge module will set the device to dual mode and thus we
+ * should ignore its native mode if that module is built
+ */
+#ifdef CONFIG_USB_BERRY_CHARGE
+UNUSUAL_DEV(  0x0fca, 0x0006, 0x0001, 0x0001,
+   RIM,
+   Blackberry Pearl,
+   US_SC_DEVICE, US_PR_DEVICE, NULL,
+   US_FL_IGNORE_DEVICE ),
+#endif
+
 /* Reported by Michael Stattmann [EMAIL PROTECTED] */
 UNUSUAL_DEV(  0x0fce, 0xd008, 0x, 0x,
Sony Ericsson,
-- 
1.5.2.2


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 03/19] USB: more quirky devices

2007-07-30 Thread Greg Kroah-Hartman
From: Oliver Neukum [EMAIL PROTECTED]

our list of devices which cannot be suspended keeps growing.

Signed-off-by: Oliver Neukum [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/quirks.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index aa21b38..58b21f1 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -32,8 +32,16 @@ static const struct usb_device_id usb_quirk_list[] = {
{ USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 
},
/* Benq S2W 3300U */
{ USB_DEVICE(0x04a5, 0x20b0), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+   /* Canon, Inc. CanoScan N650U/N656U */
+   { USB_DEVICE(0x04a9, 0x2206), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+   /* Canon, Inc. CanoScan N670U/N676U/LiDE 20 */
+   { USB_DEVICE(0x04a9, 0x220d), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+   /* old Cannon scanner */
+   { USB_DEVICE(0x04a9, 0x2220), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Seiko Epson Corp. Perfection 1200 */
{ USB_DEVICE(0x04b8, 0x0104), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+   /* Seiko Epson Corp. Perfection 660 */
+   { USB_DEVICE(0x04b8, 0x0114), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Seiko Epson Corp - Perfection 1670 */
{ USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Samsung ML-2510 Series printer */
@@ -42,6 +50,8 @@ static const struct usb_device_id usb_quirk_list[] = {
{ USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Ultima Electronics Corp.*/
{ USB_DEVICE(0x05d8, 0x4005), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+   /* Agfa Snapscan1212u */
+   { USB_DEVICE(0x06bd, 0x2061), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Umax [hex] Astra 3400U */
{ USB_DEVICE(0x1606, 0x0060), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
 
-- 
1.5.2.2


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 04/19] USB: usb.h kernel-doc additions

2007-07-30 Thread Greg Kroah-Hartman
From: Randy Dunlap [EMAIL PROTECTED]

Add kernel-doc entries in linux/usb.h for:

Warning(linux-2.6.22-git12//include/linux/usb.h:162): No description found for 
parameter 'intf_assoc'
Warning(linux-2.6.22-git12//include/linux/usb.h:268): No description found for 
parameter 'intf_assoc[USB_MAXIADS]'

Signed-off-by: Randy Dunlap [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 include/linux/usb.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/usb.h b/include/linux/usb.h
index 7a60946..4f33a58 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -94,6 +94,7 @@ enum usb_interface_condition {
  * endpoint configurations.  They will be in no particular order.
  * @num_altsetting: number of altsettings defined.
  * @cur_altsetting: the current altsetting.
+ * @intf_assoc: interface association descriptor
  * @driver: the USB driver that is bound to this interface.
  * @minor: the minor number assigned to this interface, if this
  * interface is bound to a driver that uses the USB major number.
@@ -213,6 +214,7 @@ struct usb_interface_cache {
  * @desc: the device's configuration descriptor.
  * @string: pointer to the cached version of the iConfiguration string, if
  * present for this configuration.
+ * @intf_assoc: list of any interface association descriptors in this config
  * @interface: array of pointers to usb_interface structures, one for each
  * interface in the configuration.  The number of interfaces is stored
  * in desc.bNumInterfaces.  These pointers are valid only while the
-- 
1.5.2.2


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 05/19] USB: even more quirks

2007-07-30 Thread Greg Kroah-Hartman
From: Oliver Neukum [EMAIL PROTECTED]

The number of quirky devices seems to be large.

Signed-off-by: Oliver Neukum [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/quirks.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 58b21f1..d12de30 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -30,10 +30,14 @@
 static const struct usb_device_id usb_quirk_list[] = {
/* HP 5300/5370C scanner */
{ USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 
},
+   /* Acer Peripherals Inc. (now BenQ Corp.) Prisa 640BU */
+   { USB_DEVICE(0x04a5, 0x207e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Benq S2W 3300U */
{ USB_DEVICE(0x04a5, 0x20b0), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Canon, Inc. CanoScan N650U/N656U */
{ USB_DEVICE(0x04a9, 0x2206), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+   /* Canon, Inc. CanoScan 1220U */
+   { USB_DEVICE(0x04a9, 0x2207), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Canon, Inc. CanoScan N670U/N676U/LiDE 20 */
{ USB_DEVICE(0x04a9, 0x220d), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* old Cannon scanner */
@@ -42,8 +46,12 @@ static const struct usb_device_id usb_quirk_list[] = {
{ USB_DEVICE(0x04b8, 0x0104), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Seiko Epson Corp. Perfection 660 */
{ USB_DEVICE(0x04b8, 0x0114), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+   /* Epson Perfection 1260 Photo */
+   { USB_DEVICE(0x04b8, 0x011d), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Seiko Epson Corp - Perfection 1670 */
{ USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+   /* EPSON Perfection 2480 */
+   { USB_DEVICE(0x04b8, 0x0121), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Samsung ML-2510 Series printer */
{ USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Elsa MicroLink 56k (V.250) */
-- 
1.5.2.2


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 06/19] USB: Add CanonScan LiDE30 to the quirk list

2007-07-30 Thread Greg Kroah-Hartman
From: Johann Felix Soden [EMAIL PROTECTED]

This patch adds CanoScan N1240U/LiDE30 (Scanner) to the list of quirky USB
devices.

Signed-off-by: Johann Felix Soden [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/quirks.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index d12de30..188457b 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -34,6 +34,8 @@ static const struct usb_device_id usb_quirk_list[] = {
{ USB_DEVICE(0x04a5, 0x207e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Benq S2W 3300U */
{ USB_DEVICE(0x04a5, 0x20b0), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+   /* Canon, Inc. CanoScan N1240U/LiDE30 */
+   { USB_DEVICE(0x04a9, 0x220e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Canon, Inc. CanoScan N650U/N656U */
{ USB_DEVICE(0x04a9, 0x2206), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Canon, Inc. CanoScan 1220U */
-- 
1.5.2.2


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 07/19] USB: yet another quirky device

2007-07-30 Thread Greg Kroah-Hartman
From: Oliver Neukum [EMAIL PROTECTED]

another quirky scanner.

Signed-off-by: Oliver Neukum [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/quirks.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 188457b..b7917c5 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -54,6 +54,8 @@ static const struct usb_device_id usb_quirk_list[] = {
{ USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* EPSON Perfection 2480 */
{ USB_DEVICE(0x04b8, 0x0121), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+   /* Seiko Epson Corp.*/
+   { USB_DEVICE(0x04b8, 0x0122), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Samsung ML-2510 Series printer */
{ USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Elsa MicroLink 56k (V.250) */
-- 
1.5.2.2


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 08/19] USB: fix usb_serial_suspend(): buggy code

2007-07-30 Thread Greg Kroah-Hartman
From: Oliver Neukum [EMAIL PROTECTED]

Am Montag 23 Juli 2007 schrieb Adrian Bunk:
 Commit ec22559e0b7a05283a3413bda5d177e42c950e23 added the following
 function to drivers/usb/serial/usb-serial.c:

[..]

 The Coverity checker spotted the inconsequent NULL checking for serial.

 Looking at the code it also doesn't seem to have been intended to always
 return 0.

Coverity is right. The check for NULL is wrongly done and the error
return is lost.

Signed-off-by: Oliver Neukum [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/usb-serial.c |   15 ---
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index a366565..5e1cf78 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -1077,16 +1077,17 @@ int usb_serial_suspend(struct usb_interface *intf, 
pm_message_t message)
struct usb_serial_port *port;
int i, r = 0;
 
-   if (serial) {
-   for (i = 0; i  serial-num_ports; ++i) {
-   port = serial-port[i];
-   if (port)
-   kill_traffic(port);
-   }
+   if (!serial) /* device has been disconnected */
+   return 0;
+
+   for (i = 0; i  serial-num_ports; ++i) {
+   port = serial-port[i];
+   if (port)
+   kill_traffic(port);
}
 
if (serial-type-suspend)
-   serial-type-suspend(serial, message);
+   r = serial-type-suspend(serial, message);
 
return r;
 }
-- 
1.5.2.2


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 09/19] USB: fix scatterlist PIO case (IOMMU)

2007-07-30 Thread Greg Kroah-Hartman
From: David Brownell [EMAIL PROTECTED]

Update the scatterlist logic so that PIO options are also disabled
when an IOMMU may have coalesced pages during dma_map_sg() ... it's
not just HIGHMEM that can make trouble supporting both PIO and DMA
based host controller drivers.

There also seems to be a cross-arch issue here, with 64bit powerpc
not using an IOMMU define ... and its IOMMU_VMERGE config can always
be overridden on the kernel command line.  So this is better, but
still imperfect.

Signed-off-by: David Brownell [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/message.c |   15 +++
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 25f63f1..ad4b956 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -411,15 +411,22 @@ int usb_sg_init (
 * Some systems need to revert to PIO when DMA is temporarily
 * unavailable.  For their sakes, both transfer_buffer and
 * transfer_dma are set when possible.  However this can only
-* work on systems without HIGHMEM, since DMA buffers located
-* in high memory are not directly addressable by the CPU for
-* PIO ... so when HIGHMEM is in use, transfer_buffer is NULL
+* work on systems without:
+*
+*  - HIGHMEM, since DMA buffers located in high memory are
+*not directly addressable by the CPU for PIO;
+*
+*  - IOMMU, since dma_map_sg() is allowed to use an IOMMU to
+*make virtually discontiguous buffers be dma-contiguous
+*so that PIO and DMA need diferent numbers of URBs.
+*
+* So when HIGHMEM or IOMMU are in use, transfer_buffer is NULL
 * to prevent stale pointers and to help spot bugs.
 */
if (dma) {
io-urbs [i]-transfer_dma = sg_dma_address (sg + i);
len = sg_dma_len (sg + i);
-#ifdef CONFIG_HIGHMEM
+#if defined(CONFIG_HIGHMEM) || defined(CONFIG_IOMMU)
io-urbs[i]-transfer_buffer = NULL;
 #else
io-urbs[i]-transfer_buffer =
-- 
1.5.2.2


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 11/19] cp2101: Remove broken termios optimisation, use proper speed API

2007-07-30 Thread Greg Kroah-Hartman
From: Alan Cox [EMAIL PROTECTED]

I've also enabled the commented out support for 7200, 14400, 55854,
127117 and 3686400 baud as you can now set such rates in the kernel.

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/cp2101.c |   69 +--
 1 files changed, 27 insertions(+), 42 deletions(-)

diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c
index e831cb7..33f6ee5 100644
--- a/drivers/usb/serial/cp2101.c
+++ b/drivers/usb/serial/cp2101.c
@@ -356,7 +356,7 @@ static void cp2101_get_termios (struct usb_serial_port 
*port)
 
dbg(%s - port %d, __FUNCTION__, port-number);
 
-   if ((!port-tty) || (!port-tty-termios)) {
+   if (!port-tty || !port-tty-termios) {
dbg(%s - no tty structures, __FUNCTION__);
return;
}
@@ -526,50 +526,35 @@ static void cp2101_set_termios (struct usb_serial_port 
*port,
return;
}
cflag = port-tty-termios-c_cflag;
-
-   /* Check that they really want us to change something */
-   if (old_termios) {
-   if ((cflag == old_termios-c_cflag) 
-   (RELEVANT_IFLAG(port-tty-termios-c_iflag)
-   == RELEVANT_IFLAG(old_termios-c_iflag))) {
-   dbg(%s - nothing to change..., __FUNCTION__);
-   return;
-   }
-
-   old_cflag = old_termios-c_cflag;
-   }
+   old_cflag = old_termios-c_cflag;
+   baud = tty_get_baud_rate(port-tty);
 
/* If the baud rate is to be updated*/
-   if ((cflag  CBAUD) != (old_cflag  CBAUD)) {
-   switch (cflag  CBAUD) {
-   /*
-* The baud rates which are commented out below
-* appear to be supported by the device
-* but are non-standard
-*/
-   case B0:baud = 0;   break;
-   case B600:  baud = 600; break;
-   case B1200: baud = 1200;break;
-   case B1800: baud = 1800;break;
-   case B2400: baud = 2400;break;
-   case B4800: baud = 4800;break;
-   /*case B7200:   baud = 7200;break;*/
-   case B9600: baud = 9600;break;
-   /*ase B14400:   baud = 14400;   break;*/
-   case B19200:baud = 19200;   break;
-   /*case B28800:  baud = 28800;   break;*/
-   case B38400:baud = 38400;   break;
-   /*case B55854:  baud = 55054;   break;*/
-   case B57600:baud = 57600;   break;
-   case B115200:   baud = 115200;  break;
-   /*case B127117: baud = 127117;  break;*/
-   case B230400:   baud = 230400;  break;
-   case B460800:   baud = 460800;  break;
-   case B921600:   baud = 921600;  break;
-   /*case B3686400:baud = 3686400; break;*/
+   if (baud != tty_termios_baud_rate(old_termios)) {
+   switch (baud) {
+   case 0:
+   case 600:
+   case 1200:
+   case 1800:
+   case 2400:
+   case 4800:
+   case 7200:
+   case 9600:
+   case 14400:
+   case 19200:
+   case 28800:
+   case 38400:
+   case 55854:
+   case 57600:
+   case 115200:
+   case 127117:
+   case 230400:
+   case 460800:
+   case 921600:
+   case 3686400:
+   break;
default:
-   dev_err(port-dev, cp2101 driver does not 
-   support the baudrate requested\n);
+   baud = 9600;
break;
}
 
-- 
1.5.2.2


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 12/19] digi_acceleport: Drag the driver kicking and screaming into coding style

2007-07-30 Thread Greg Kroah-Hartman
From: Alan Cox [EMAIL PROTECTED]

- The outbreak of acute bracketitus has been cured
- The belief that brackets should have spaces everywhere likewise
- Various other coding style tweaks
- Use baud rates not Bfoo in the speed setup switch

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/digi_acceleport.c |  970 ++
 1 files changed, 410 insertions(+), 560 deletions(-)

diff --git a/drivers/usb/serial/digi_acceleport.c 
b/drivers/usb/serial/digi_acceleport.c
index 976f54e..dab2e66 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -433,38 +433,38 @@ struct digi_port {
 
 /* Local Function Declarations */
 
-static void digi_wakeup_write( struct usb_serial_port *port );
+static void digi_wakeup_write(struct usb_serial_port *port);
 static void digi_wakeup_write_lock(struct work_struct *work);
-static int digi_write_oob_command( struct usb_serial_port *port,
-   unsigned char *buf, int count, int interruptible );
-static int digi_write_inb_command( struct usb_serial_port *port,
-   unsigned char *buf, int count, unsigned long timeout );
-static int digi_set_modem_signals( struct usb_serial_port *port,
-   unsigned int modem_signals, int interruptible );
-static int digi_transmit_idle( struct usb_serial_port *port,
-   unsigned long timeout );
+static int digi_write_oob_command(struct usb_serial_port *port,
+   unsigned char *buf, int count, int interruptible);
+static int digi_write_inb_command(struct usb_serial_port *port,
+   unsigned char *buf, int count, unsigned long timeout);
+static int digi_set_modem_signals(struct usb_serial_port *port,
+   unsigned int modem_signals, int interruptible);
+static int digi_transmit_idle(struct usb_serial_port *port,
+   unsigned long timeout);
 static void digi_rx_throttle (struct usb_serial_port *port);
 static void digi_rx_unthrottle (struct usb_serial_port *port);
-static void digi_set_termios( struct usb_serial_port *port, 
-   struct ktermios *old_termios );
-static void digi_break_ctl( struct usb_serial_port *port, int break_state );
-static int digi_ioctl( struct usb_serial_port *port, struct file *file,
-   unsigned int cmd, unsigned long arg );
-static int digi_tiocmget( struct usb_serial_port *port, struct file *file );
-static int digi_tiocmset( struct usb_serial_port *port, struct file *file,
-   unsigned int set, unsigned int clear );
-static int digi_write( struct usb_serial_port *port, const unsigned char *buf, 
int count );
-static void digi_write_bulk_callback( struct urb *urb );
-static int digi_write_room( struct usb_serial_port *port );
-static int digi_chars_in_buffer( struct usb_serial_port *port );
-static int digi_open( struct usb_serial_port *port, struct file *filp );
-static void digi_close( struct usb_serial_port *port, struct file *filp );
-static int digi_startup_device( struct usb_serial *serial );
-static int digi_startup( struct usb_serial *serial );
-static void digi_shutdown( struct usb_serial *serial );
-static void digi_read_bulk_callback( struct urb *urb );
-static int digi_read_inb_callback( struct urb *urb );
-static int digi_read_oob_callback( struct urb *urb );
+static void digi_set_termios(struct usb_serial_port *port,
+   struct ktermios *old_termios);
+static void digi_break_ctl(struct usb_serial_port *port, int break_state);
+static int digi_ioctl(struct usb_serial_port *port, struct file *file,
+   unsigned int cmd, unsigned long arg);
+static int digi_tiocmget(struct usb_serial_port *port, struct file *file);
+static int digi_tiocmset(struct usb_serial_port *port, struct file *file,
+   unsigned int set, unsigned int clear);
+static int digi_write(struct usb_serial_port *port, const unsigned char *buf, 
int count);
+static void digi_write_bulk_callback(struct urb *urb);
+static int digi_write_room(struct usb_serial_port *port);
+static int digi_chars_in_buffer(struct usb_serial_port *port);
+static int digi_open(struct usb_serial_port *port, struct file *filp);
+static void digi_close(struct usb_serial_port *port, struct file *filp);
+static int digi_startup_device(struct usb_serial *serial);
+static int digi_startup(struct usb_serial *serial);
+static void digi_shutdown(struct usb_serial *serial);
+static void digi_read_bulk_callback(struct urb *urb);
+static int digi_read_inb_callback(struct urb *urb);
+static int digi_read_oob_callback(struct urb *urb);
 
 
 /* Statics */
@@ -576,9 +576,9 @@ static struct usb_serial_driver digi_acceleport_4_device = {
 *  with the equivalent code.
 */
 
-static inline long cond_wait_interruptible_timeout_irqrestore(
+static long cond_wait_interruptible_timeout_irqrestore(
wait_queue_head_t *q, long timeout,
-   spinlock_t *lock, unsigned long flags )
+   spinlock_t *lock, unsigned long flags)
 {
DEFINE_WAIT(wait);
 
@@ -600,18 +600,16 @@ static inline long

[linux-usb-devel] [PATCH 13/19] USB: mct_u232: Convert to proper speed handling API

2007-07-30 Thread Greg Kroah-Hartman
From: Alan Cox [EMAIL PROTECTED]

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Acked-by: Pete Zaitcev [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/mct_u232.c |   54 
 drivers/usb/serial/mct_u232.h |2 +-
 2 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 2a3fabc..e08c9bb 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -184,21 +184,21 @@ struct mct_u232_private {
  * we do not know how to support. We ignore them for the moment.
  * XXX Rate-limit the error message, it's user triggerable.
  */
-static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value)
+static int mct_u232_calculate_baud_rate(struct usb_serial *serial, speed_t 
value)
 {
if (le16_to_cpu(serial-dev-descriptor.idProduct) == 
MCT_U232_SITECOM_PID
  || le16_to_cpu(serial-dev-descriptor.idProduct) == 
MCT_U232_BELKIN_F5U109_PID) {
switch (value) {
-   caseB300: return 0x01;
-   caseB600: return 0x02; /* this one not tested */
-   case   B1200: return 0x03;
-   case   B2400: return 0x04;
-   case   B4800: return 0x06;
-   case   B9600: return 0x08;
-   case  B19200: return 0x09;
-   case  B38400: return 0x0a;
-   case  B57600: return 0x0b;
-   case B115200: return 0x0c;
+   case300: return 0x01;
+   case600: return 0x02; /* this one not tested */
+   case   1200: return 0x03;
+   case   2400: return 0x04;
+   case   4800: return 0x06;
+   case   9600: return 0x08;
+   case  19200: return 0x09;
+   case  38400: return 0x0a;
+   case  57600: return 0x0b;
+   case 115200: return 0x0c;
default:
err(MCT USB-RS232: unsupported baudrate request 0x%x,
 using default of B9600, value);
@@ -206,27 +206,27 @@ static int mct_u232_calculate_baud_rate(struct usb_serial 
*serial, int value)
}
} else {
switch (value) {
-   caseB300: value = 300; break;
-   caseB600: value = 600; break;
-   case   B1200: value =1200; break;
-   case   B2400: value =2400; break;
-   case   B4800: value =4800; break;
-   case   B9600: value =9600; break;
-   case  B19200: value =   19200; break;
-   case  B38400: value =   38400; break;
-   case  B57600: value =   57600; break;
-   case B115200: value =  115200; break;
-   default:
-   err(MCT USB-RS232: unsupported baudrate request 0x%x,
-using default of B9600, value);
-   value = 9600;
+   case 300: break;
+   case 600: break;
+   case 1200: break;
+   case 2400: break;
+   case 4800: break;
+   case 9600: break;
+   case 19200: break;
+   case 38400: break;
+   case 57600: break;
+   case 115200: break;
+   default:
+   err(MCT USB-RS232: unsupported baudrate 
request 0x%x,
+using default of B9600, value);
+   value = 9600;
}
return 115200/value;
}
 }
 
 static int mct_u232_set_baud_rate(struct usb_serial *serial, struct 
usb_serial_port *port,
- int value)
+ speed_t value)
 {
__le32 divisor;
 int rc;
@@ -634,7 +634,7 @@ static void mct_u232_set_termios (struct usb_serial_port 
*port,
mct_u232_set_modem_ctrl(serial, control_state);
}
 
-   mct_u232_set_baud_rate(serial, port, cflag  CBAUD);
+   mct_u232_set_baud_rate(serial, port, tty_get_baud_rate(port-tty));
 
if ((cflag  CBAUD) == B0 ) {
dbg(%s: baud is B0, __FUNCTION__);
diff --git a/drivers/usb/serial/mct_u232.h b/drivers/usb/serial/mct_u232.h
index a61bac8..aae10c8 100644
--- a/drivers/usb/serial/mct_u232.h
+++ b/drivers/usb/serial/mct_u232.h
@@ -79,7 +79,7 @@
  * 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, int value);
+static int mct_u232_calculate_baud_rate(struct usb_serial *serial, speed_t 
value);
 
 /*
  * Line Control Register (LCR)
-- 
1.5.2.2

[linux-usb-devel] [PATCH 14/19] USB: fix BUG: sleeping function called from invalid context at /home/jeremy/hg/xen/paravirt/linux/drivers/usb/core/urb.c:524, in_atomic():1, irqs_disabled():0

2007-07-30 Thread Greg Kroah-Hartman
From: Oliver Neukum [EMAIL PROTECTED]

Clearly there's a bug in
drivers/usb/serial/usb-serial.c:usb_serial_put().  It shouldn't call
kref_put() while holding a spinlock.

Signed-off-by: Oliver Neukum [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/usb-serial.c |   17 -
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 5e1cf78..9bf01a5 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -60,19 +60,19 @@ static struct usb_driver usb_serial_driver = {
 
 static int debug;
 static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially 
all NULL */
-static spinlock_t table_lock;
+static DEFINE_MUTEX(table_lock);
 static LIST_HEAD(usb_serial_driver_list);
 
 struct usb_serial *usb_serial_get_by_index(unsigned index)
 {
struct usb_serial *serial;
 
-   spin_lock(table_lock);
+   mutex_lock(table_lock);
serial = serial_table[index];
 
if (serial)
kref_get(serial-kref);
-   spin_unlock(table_lock);
+   mutex_unlock(table_lock);
return serial;
 }
 
@@ -84,7 +84,7 @@ static struct usb_serial *get_free_serial (struct usb_serial 
*serial, int num_po
dbg(%s %d, __FUNCTION__, num_ports);
 
*minor = 0;
-   spin_lock(table_lock);
+   mutex_lock(table_lock);
for (i = 0; i  SERIAL_TTY_MINORS; ++i) {
if (serial_table[i])
continue;
@@ -106,10 +106,10 @@ static struct usb_serial *get_free_serial (struct 
usb_serial *serial, int num_po
serial_table[i] = serial;
serial-port[j++]-number = i;
}
-   spin_unlock(table_lock);
+   mutex_unlock(table_lock);
return serial;
}
-   spin_unlock(table_lock);
+   mutex_unlock(table_lock);
return NULL;
 }
 
@@ -172,9 +172,9 @@ static void destroy_serial(struct kref *kref)
 
 void usb_serial_put(struct usb_serial *serial)
 {
-   spin_lock(table_lock);
+   mutex_lock(table_lock);
kref_put(serial-kref, destroy_serial);
-   spin_unlock(table_lock);
+   mutex_unlock(table_lock);
 }
 
 /*
@@ -1129,7 +1129,6 @@ static int __init usb_serial_init(void)
return -ENOMEM;
 
/* Initialize our global data */
-   spin_lock_init(table_lock);
for (i = 0; i  SERIAL_TTY_MINORS; ++i) {
serial_table[i] = NULL;
}
-- 
1.5.2.2


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 15/19] USB: drivers/usb/serial/sierra.c: make 3 functions static

2007-07-30 Thread Greg Kroah-Hartman
From: Adrian Bunk [EMAIL PROTECTED]

This patch makes three needlessly global functions static.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Cc: Kevin Lloyd [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/sierra.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 0794ccd..0bb8de4 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -45,7 +45,7 @@ enum devicetype {
DEVICE_INSTALLER =  2,
 };
 
-int sierra_set_power_state(struct usb_device *udev, __u16 swiState)
+static int sierra_set_power_state(struct usb_device *udev, __u16 swiState)
 {
int result;
dev_dbg(udev-dev, %s, SET POWER STATE);
@@ -60,7 +60,7 @@ int sierra_set_power_state(struct usb_device *udev, __u16 
swiState)
return result;
 }
 
-int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode)
+static int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode)
 {
int result;
dev_dbg(udev-dev, %s, DEVICE MODE SWITCH);
@@ -75,7 +75,8 @@ int sierra_set_ms_mode(struct usb_device *udev, __u16 
eSocMode)
return result;
 }
 
-int sierra_probe(struct usb_interface *iface, const struct usb_device_id *id)
+static int sierra_probe(struct usb_interface *iface,
+   const struct usb_device_id *id)
 {
int result;
struct usb_device *udev;
-- 
1.5.2.2


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 16/19] USB: NIKON D50 is an unusual device

2007-07-30 Thread Greg Kroah-Hartman
From: Milinevsky Dmitry [EMAIL PROTECTED]

This short patch allows NIKON D50 to be mounted as UMS[unusual device]
on Linux niam 2.6.22-rc7-cfs-v18 #2 PREEMPT Tue Jul 3 22:35:53 EEST
2007 i686 Intel(R) Celeron(R) M processor 1.50GHz GenuineIntel
GNU/Linux,
some previous kernels...

lsusb -v
Bus 001 Device 006: ID 04b0:0409 Nikon Corp.
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize064
  idVendor   0x04b0 Nikon Corp.
  idProduct  0x0409
  bcdDevice1.00
  iManufacturer   1 NIKON
  iProduct2 NIKON DSC D50
  iSerial 0
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   32
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  0
bmAttributes 0xc0
  Self Powered
MaxPower2mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   2
  bInterfaceClass 8 Mass Storage
  bInterfaceSubClass  6 SCSI
  bInterfaceProtocol 80 Bulk (Zip)
  iInterface  0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01  EP 1 OUT
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0200  1x 512 bytes
bInterval   0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82  EP 2 IN
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0200  1x 512 bytes
bInterval   0
Device Qualifier (for other device speed):
  bLength10
  bDescriptorType 6
  bcdUSB   2.00
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize064
  bNumConfigurations  1
Device Status: 0x0001
  Self Powered

Signed-off-by: Milinevsky Dmitry [EMAIL PROTECTED]
Cc: Oliver Neukum [EMAIL PROTECTED]
Cc: Alan Stern [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/storage/unusual_devs.h |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/storage/unusual_devs.h 
b/drivers/usb/storage/unusual_devs.h
index da08fcd..d8d008d 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -320,6 +320,13 @@ UNUSUAL_DEV(  0x04b0, 0x0401, 0x0200, 0x0200,
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_FIX_CAPACITY),
 
+/* Reported by Milinevsky Dmitry [EMAIL PROTECTED] */
+UNUSUAL_DEV(  0x04b0, 0x0409, 0x0100, 0x0100,
+   NIKON,
+   NIKON DSC D50,
+   US_SC_DEVICE, US_PR_DEVICE, NULL,
+   US_FL_FIX_CAPACITY),
+
 /* Reported by Andreas Bockhold [EMAIL PROTECTED] */
 UNUSUAL_DEV(  0x04b0, 0x0405, 0x0100, 0x0100,
NIKON,
-- 
1.5.2.2


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 17/19] USB: more pxa2xx_udc dead code removal

2007-07-30 Thread Greg Kroah-Hartman
From: David Brownell [EMAIL PROTECTED]

Remove some more dead code from the pxa2xx_udc driver:  support
for a no-longer-undocumented hardware test mode.  Newer chips
made this the default, evidently as the best workaround for deep
silicon bugs.  The interest was that this seemed to be the only
way to kick in the (documented!) double buffering capability.

Signed-off-by: David Brownell [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/gadget/pxa2xx_udc.c |   30 --
 1 files changed, 0 insertions(+), 30 deletions(-)

diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
index 63b9521..72b4ebb 100644
--- a/drivers/usb/gadget/pxa2xx_udc.c
+++ b/drivers/usb/gadget/pxa2xx_udc.c
@@ -93,8 +93,6 @@ static const char driver_name [] = pxa2xx_udc;
 static const char ep0name [] = ep0;
 
 
-// #define DISABLE_TEST_MODE
-
 #ifdef CONFIG_ARCH_IXP4XX
 
 /* cpu-specific register addresses are compiled in to this code */
@@ -113,17 +111,6 @@ static const char ep0name [] = ep0;
 #define SIZE_STR   
 #endif
 
-#ifdef DISABLE_TEST_MODE
-/* (mode == 0) == no undocumented chip tweaks
- * (mode  1)  == double buffer bulk IN
- * (mode  2)  == double buffer bulk OUT
- * ... so mode = 3 (or 7, 15, etc) does it for both
- */
-static ushort fifo_mode = 0;
-module_param(fifo_mode, ushort, 0);
-MODULE_PARM_DESC (fifo_mode, pxa2xx udc fifo mode);
-#endif
-
 /* ---
  * endpoint related parts of the api to the usb controller hardware,
  * used by gadget driver; and the inner talker-to-hardware core.
@@ -1252,23 +1239,6 @@ static void udc_enable (struct pxa2xx_udc *dev)
UDC_RES2 = 0x00;
}
 
-#ifdef DISABLE_TEST_MODE
-   /* test mode seems to have become the default in later chip
-* revs, preventing double buffering (and invalidating docs).
-* this EXPERIMENT enables it for bulk endpoints by tweaking
-* undefined/reserved register bits (that other drivers clear).
-* Belcarra code comments noted this usage.
-*/
-   if (fifo_mode  1) {/* IN endpoints */
-   UDC_RES1 |= USIR0_IR1|USIR0_IR6;
-   UDC_RES2 |= USIR1_IR11;
-   }
-   if (fifo_mode  2) {/* OUT endpoints */
-   UDC_RES1 |= USIR0_IR2|USIR0_IR7;
-   UDC_RES2 |= USIR1_IR12;
-   }
-#endif
-
/* enable suspend/resume and reset irqs */
udc_clear_mask_UDCCR(UDCCR_SRM | UDCCR_REM);
 
-- 
1.5.2.2


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 18/19] usb-serial: Fix edgeport regression on non-EPiC devices

2007-07-30 Thread Greg Kroah-Hartman
From: Adam Kropelin [EMAIL PROTECTED]

Fix serious regression on non-EPiC edgeport usb-serial devices. Baud
rate and MCR/LCR registers are not being written on these models due
to apparent copy-n-paste errors introduced with EPiC support.

Failure reported by Nick Pasich [EMAIL PROTECTED].

Signed-off-by: Adam Kropelin [EMAIL PROTECTED]
Cc: stable [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/io_edgeport.c |   19 ---
 1 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index dd42f57..2ecb1d2 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -2366,9 +2366,8 @@ static int send_cmd_write_baud_rate (struct edgeport_port 
*edge_port, int baudRa
int status;
unsigned char number = edge_port-port-number - 
edge_port-port-serial-minor;
 
-   if ((!edge_serial-is_epic) ||
-   ((edge_serial-is_epic) 
-(!edge_serial-epic_descriptor.Supports.IOSPSetBaudRate))) {
+   if (edge_serial-is_epic 
+   !edge_serial-epic_descriptor.Supports.IOSPSetBaudRate) {
dbg(SendCmdWriteBaudRate - NOT Setting baud rate for port = 
%d, baud = %d,
edge_port-port-number, baudRate);
return 0;
@@ -2461,18 +2460,16 @@ static int send_cmd_write_uart_register (struct 
edgeport_port *edge_port, __u8 r
 
dbg(%s - write to %s register 0x%02x, (regNum == MCR) ? MCR : 
LCR, __FUNCTION__, regValue);
 
-   if ((!edge_serial-is_epic) ||
-   ((edge_serial-is_epic) 
-(!edge_serial-epic_descriptor.Supports.IOSPWriteMCR) 
-(regNum == MCR))) {
+   if (edge_serial-is_epic 
+   !edge_serial-epic_descriptor.Supports.IOSPWriteMCR 
+   regNum == MCR) {
dbg(SendCmdWriteUartReg - Not writing to MCR Register);
return 0;
}
 
-   if ((!edge_serial-is_epic) ||
-   ((edge_serial-is_epic) 
-(!edge_serial-epic_descriptor.Supports.IOSPWriteLCR) 
-(regNum == LCR))) {
+   if (edge_serial-is_epic 
+   !edge_serial-epic_descriptor.Supports.IOSPWriteLCR 
+   regNum == LCR) {
dbg (SendCmdWriteUartReg - Not writing to LCR Register);
return 0;
}
-- 
1.5.2.2


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 19/19] USB: sparse cleanups for usb gadgets

2007-07-30 Thread Greg Kroah-Hartman
From: David Brownell [EMAIL PROTECTED]

This removes complaints about the gadget stack which are generated by
the currrent sparse:  it doesn't like the fact that zero is the null
pointer.  (Last I checked, C guarantees that's correct ...)

Signed-off-by: David Brownell [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/gadget/config.c |2 +-
 drivers/usb/gadget/epautoconf.c |2 +-
 drivers/usb/gadget/ether.c  |3 ++-
 drivers/usb/gadget/inode.c  |4 ++--
 drivers/usb/gadget/m66592-udc.c |2 +-
 drivers/usb/gadget/zero.c   |6 --
 6 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/gadget/config.c b/drivers/usb/gadget/config.c
index d18901b..c6760ae 100644
--- a/drivers/usb/gadget/config.c
+++ b/drivers/usb/gadget/config.c
@@ -50,7 +50,7 @@ usb_descriptor_fillbuf(void *buf, unsigned buflen,
return -EINVAL;
 
/* fill buffer from src[] until null descriptor ptr */
-   for (; 0 != *src; src++) {
+   for (; NULL != *src; src++) {
unsignedlen = (*src)-bLength;
 
if (len  buflen)
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index 6042364..3aa46cf 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -71,7 +71,7 @@ ep_matches (
u16 max;
 
/* endpoint already claimed? */
-   if (0 != ep-driver_data)
+   if (NULL != ep-driver_data)
return 0;
 
/* only support ep0 for portable CONTROL traffic */
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index a337673..593e235 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -1723,7 +1723,8 @@ rx_submit (struct eth_dev *dev, struct usb_request *req, 
gfp_t gfp_flags)
size += sizeof (struct rndis_packet_msg_type);
size -= size % dev-out_ep-maxpacket;
 
-   if ((skb = alloc_skb (size + NET_IP_ALIGN, gfp_flags)) == 0) {
+   skb = alloc_skb(size + NET_IP_ALIGN, gfp_flags);
+   if (skb == NULL) {
DEBUG (dev, no rx skb\n);
goto enomem;
}
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index e60745f..173004f 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -964,7 +964,7 @@ static int setup_req (struct usb_ep *ep, struct usb_request 
*req, u16 len)
}
if (len  sizeof (dev-rbuf))
req-buf = kmalloc(len, GFP_ATOMIC);
-   if (req-buf == 0) {
+   if (req-buf == NULL) {
req-buf = dev-rbuf;
return -ENOMEM;
}
@@ -1394,7 +1394,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct 
usb_ctrlrequest *ctrl)
dev-setup_abort = 0;
if (dev-state == STATE_DEV_UNCONNECTED) {
 #ifdef CONFIG_USB_GADGET_DUALSPEED
-   if (gadget-speed == USB_SPEED_HIGH  dev-hs_config == 0) {
+   if (gadget-speed == USB_SPEED_HIGH  dev-hs_config == NULL) {
spin_unlock(dev-lock);
ERROR (dev, no high speed config??\n);
return -EINVAL;
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index 700dda8..4b27d12 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -1299,7 +1299,7 @@ static int m66592_queue(struct usb_ep *_ep, struct 
usb_request *_req,
req-req.actual = 0;
req-req.status = -EINPROGRESS;
 
-   if (ep-desc == 0)  /* control */
+   if (ep-desc == NULL)   /* control */
start_ep0(ep, req);
else {
if (request  !ep-busy)
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index a2e6e3f..fcfe869 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -653,7 +653,8 @@ set_source_sink_config (struct zero_dev *dev, gfp_t 
gfp_flags)
result = usb_ep_enable (ep, d);
if (result == 0) {
ep-driver_data = dev;
-   if (source_sink_start_ep (ep, gfp_flags) != 0) {
+   if (source_sink_start_ep(ep, gfp_flags)
+   != NULL) {
dev-in_ep = ep;
continue;
}
@@ -667,7 +668,8 @@ set_source_sink_config (struct zero_dev *dev, gfp_t 
gfp_flags)
result = usb_ep_enable (ep, d);
if (result == 0) {
ep-driver_data = dev;
-   if (source_sink_start_ep (ep, gfp_flags) != 0) {
+   if (source_sink_start_ep(ep, gfp_flags)
+   != NULL

[linux-usb-devel] [PATCH 01/44] USB: use mutex instead of semaphore in the USB gadget serial driver

2007-07-19 Thread Greg Kroah-Hartman
From: Matthias Kaehlcke [EMAIL PROTECTED]

The USB gadget serial driver uses a semaphore as mutex. Use the
mutex API instead of the (binary) semaphore.

Signed-off-by: Matthias Kaehlcke [EMAIL PROTECTED]
Acked-by: David Brownell [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/gadget/serial.c |   25 +
 1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index 38138bb..9cd98e7 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -33,6 +33,7 @@
 #include linux/device.h
 #include linux/tty.h
 #include linux/tty_flip.h
+#include linux/mutex.h
 
 #include asm/byteorder.h
 #include asm/io.h
@@ -258,7 +259,7 @@ static const char *EP_IN_NAME;
 static const char *EP_OUT_NAME;
 static const char *EP_NOTIFY_NAME;
 
-static struct semaphoregs_open_close_sem[GS_NUM_PORTS];
+static struct mutex gs_open_close_lock[GS_NUM_PORTS];
 
 static unsigned int read_q_size = GS_DEFAULT_READ_Q_SIZE;
 static unsigned int write_q_size = GS_DEFAULT_WRITE_Q_SIZE;
@@ -595,7 +596,7 @@ static int __init gs_module_init(void)
tty_set_operations(gs_tty_driver, gs_tty_ops);
 
for (i=0; i  GS_NUM_PORTS; i++)
-   sema_init(gs_open_close_sem[i], 1);
+   mutex_init(gs_open_close_lock[i]);
 
retval = tty_register_driver(gs_tty_driver);
if (retval) {
@@ -635,7 +636,7 @@ static int gs_open(struct tty_struct *tty, struct file 
*file)
struct gs_port *port;
struct gs_dev *dev;
struct gs_buf *buf;
-   struct semaphore *sem;
+   struct mutex *mtx;
int ret;
 
port_num = tty-index;
@@ -656,10 +657,10 @@ static int gs_open(struct tty_struct *tty, struct file 
*file)
return -ENODEV;
}
 
-   sem = gs_open_close_sem[port_num];
-   if (down_interruptible(sem)) {
+   mtx = gs_open_close_lock[port_num];
+   if (mutex_lock_interruptible(mtx)) {
printk(KERN_ERR
-   gs_open: (%d,%p,%p) interrupted waiting for semaphore\n,
+   gs_open: (%d,%p,%p) interrupted waiting for mutex\n,
port_num, tty, file);
return -ERESTARTSYS;
}
@@ -754,12 +755,12 @@ static int gs_open(struct tty_struct *tty, struct file 
*file)
 
 exit_unlock_port:
spin_unlock_irqrestore(port-port_lock, flags);
-   up(sem);
+   mutex_unlock(mtx);
return ret;
 
 exit_unlock_dev:
spin_unlock_irqrestore(dev-dev_lock, flags);
-   up(sem);
+   mutex_unlock(mtx);
return ret;
 
 }
@@ -781,7 +782,7 @@ exit_unlock_dev:
 static void gs_close(struct tty_struct *tty, struct file *file)
 {
struct gs_port *port = tty-driver_data;
-   struct semaphore *sem;
+   struct mutex *mtx;
 
if (port == NULL) {
printk(KERN_ERR gs_close: NULL port pointer\n);
@@ -790,8 +791,8 @@ static void gs_close(struct tty_struct *tty, struct file 
*file)
 
gs_debug(gs_close: (%d,%p,%p)\n, port-port_num, tty, file);
 
-   sem = gs_open_close_sem[port-port_num];
-   down(sem);
+   mtx = gs_open_close_lock[port-port_num];
+   mutex_lock(mtx);
 
spin_lock_irq(port-port_lock);
 
@@ -846,7 +847,7 @@ static void gs_close(struct tty_struct *tty, struct file 
*file)
 
 exit:
spin_unlock_irq(port-port_lock);
-   up(sem);
+   mutex_unlock(mtx);
 }
 
 /*
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 02/44] USB: use mutex instead of semaphore in the ELAN U132 adapter driver

2007-07-19 Thread Greg Kroah-Hartman
From: Matthias Kaehlcke [EMAIL PROTECTED]

The ELAN U132 adapter driver uses the semaphore u132_module_lock
as mutex. Use the mutex API instead of the (binary) semaphore.

Signed-off-by: Matthias Kaehlcke [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/host/u132-hcd.c |   17 +
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index e98df2e..7f765ec 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -52,6 +52,7 @@
 #include linux/workqueue.h
 #include linux/platform_device.h
 #include linux/pci_ids.h
+#include linux/mutex.h
 #include asm/io.h
 #include asm/irq.h
 #include asm/system.h
@@ -83,7 +84,7 @@ static DECLARE_WAIT_QUEUE_HEAD(u132_hcd_wait);
 * u132_module_lock exists to protect access to global variables
 *
 */
-static struct semaphore u132_module_lock;
+static struct mutex u132_module_lock;
 static int u132_exiting = 0;
 static int u132_instances = 0;
 static struct list_head u132_static_list;
@@ -258,10 +259,10 @@ static void u132_hcd_delete(struct kref *kref)
 struct platform_device *pdev = u132-platform_dev;
 struct usb_hcd *hcd = u132_to_hcd(u132);
 u132-going += 1;
-down(u132_module_lock);
+mutex_lock(u132_module_lock);
 list_del_init(u132-u132_list);
 u132_instances -= 1;
-up(u132_module_lock);
+mutex_unlock(u132_module_lock);
 dev_warn(u132-platform_dev-dev, FREEING the hcd=%p and thus the 
u13
 2=%p going=%d pdev=%p\n, hcd, u132, u132-going, pdev);
 usb_put_hcd(hcd);
@@ -3111,10 +3112,10 @@ static int __devinit u132_probe(struct platform_device 
*pdev)
 int retval = 0;
 struct u132 *u132 = hcd_to_u132(hcd);
 hcd-rsrc_start = 0;
-down(u132_module_lock);
+mutex_lock(u132_module_lock);
 list_add_tail(u132-u132_list, u132_static_list);
 u132-sequence_num = ++u132_instances;
-up(u132_module_lock);
+mutex_unlock(u132_module_lock);
 u132_u132_init_kref(u132);
 u132_initialise(u132, pdev);
 hcd-product_desc = ELAN U132 Host Controller;
@@ -3216,7 +3217,7 @@ static int __init u132_hcd_init(void)
 INIT_LIST_HEAD(u132_static_list);
 u132_instances = 0;
 u132_exiting = 0;
-init_MUTEX(u132_module_lock);
+mutex_init(u132_module_lock);
 if (usb_disabled())
 return -ENODEV;
 printk(KERN_INFO driver %s built at %s on %s\n, hcd_name, __TIME__,
@@ -3232,9 +3233,9 @@ static void __exit u132_hcd_exit(void)
 {
 struct u132 *u132;
 struct u132 *temp;
-down(u132_module_lock);
+mutex_lock(u132_module_lock);
 u132_exiting += 1;
-up(u132_module_lock);
+mutex_unlock(u132_module_lock);
 list_for_each_entry_safe(u132, temp, u132_static_list, u132_list) {
 platform_device_unregister(u132-platform_dev);
 } platform_driver_unregister(u132_platform_driver);
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 03/44] USB: use mutex instead of semaphore in the Adutux driver

2007-07-19 Thread Greg Kroah-Hartman
From: Matthias Kaehlcke [EMAIL PROTECTED]

The Adutux driver uses a semaphore as mutex. Use the mutex API
instead of the (binary) semaphore.

Signed-off-by: Matthias Kaehlcke [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/misc/adutux.c |   35 ++-
 1 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
index d72c42e..274d08e 100644
--- a/drivers/usb/misc/adutux.c
+++ b/drivers/usb/misc/adutux.c
@@ -24,6 +24,7 @@
 #include linux/slab.h
 #include linux/module.h
 #include linux/usb.h
+#include linux/mutex.h
 #include asm/uaccess.h
 
 #ifdef CONFIG_USB_DEBUG
@@ -80,7 +81,7 @@ MODULE_DEVICE_TABLE(usb, device_table);
 
 /* Structure to hold all of our device specific stuff */
 struct adu_device {
-   struct semaphoresem; /* locks this structure */
+   struct mutexmtx; /* locks this structure */
struct usb_device*  udev; /* save off the usb device pointer */
struct usb_interface*   interface;
unsigned char   minor; /* the starting minor number for this 
device */
@@ -269,8 +270,8 @@ static int adu_open(struct inode *inode, struct file *file)
}
 
/* lock this device */
-   if ((retval = down_interruptible(dev-sem))) {
-   dbg(2, %s : sem down failed, __FUNCTION__);
+   if ((retval = mutex_lock_interruptible(dev-mtx))) {
+   dbg(2, %s : mutex lock failed, __FUNCTION__);
goto exit_no_device;
}
 
@@ -299,7 +300,7 @@ static int adu_open(struct inode *inode, struct file *file)
if (retval)
--dev-open_count;
}
-   up(dev-sem);
+   mutex_unlock(dev-mtx);
 
 exit_no_device:
dbg(2,%s : leave, return value %d , __FUNCTION__, retval);
@@ -347,7 +348,7 @@ static int adu_release(struct inode *inode, struct file 
*file)
}
 
/* lock our device */
-   down(dev-sem); /* not interruptible */
+   mutex_lock(dev-mtx); /* not interruptible */
 
if (dev-open_count = 0) {
dbg(1, %s : device not opened, __FUNCTION__);
@@ -357,7 +358,7 @@ static int adu_release(struct inode *inode, struct file 
*file)
 
if (dev-udev == NULL) {
/* the device was unplugged before the file was released */
-   up(dev-sem);
+   mutex_unlock(dev-mtx);
adu_delete(dev);
dev = NULL;
} else {
@@ -367,7 +368,7 @@ static int adu_release(struct inode *inode, struct file 
*file)
 
 exit:
if (dev)
-   up(dev-sem);
+   mutex_unlock(dev-mtx);
dbg(2, %s : leave, return value %d, __FUNCTION__, retval);
return retval;
 }
@@ -390,7 +391,7 @@ static ssize_t adu_read(struct file *file, __user char 
*buffer, size_t count,
dev = file-private_data;
dbg(2, %s : dev=%p, __FUNCTION__, dev);
/* lock this object */
-   if (down_interruptible(dev-sem))
+   if (mutex_lock_interruptible(dev-mtx))
return -ERESTARTSYS;
 
/* verify that the device wasn't unplugged */
@@ -522,7 +523,7 @@ static ssize_t adu_read(struct file *file, __user char 
*buffer, size_t count,
 
 exit:
/* unlock the device */
-   up(dev-sem);
+   mutex_unlock(dev-mtx);
 
dbg(2, %s : leave, return value %d, __FUNCTION__, retval);
return retval;
@@ -543,7 +544,7 @@ static ssize_t adu_write(struct file *file, const __user 
char *buffer,
dev = file-private_data;
 
/* lock this object */
-   retval = down_interruptible(dev-sem);
+   retval = mutex_lock_interruptible(dev-mtx);
if (retval)
goto exit_nolock;
 
@@ -571,9 +572,9 @@ static ssize_t adu_write(struct file *file, const __user 
char *buffer,
retval = -EINTR;
goto exit;
}
-   up(dev-sem);
+   mutex_unlock(dev-mtx);
timeout = 
interruptible_sleep_on_timeout(dev-write_wait, timeout);
-   retval = down_interruptible(dev-sem);
+   retval = mutex_lock_interruptible(dev-mtx);
if (retval) {
retval = bytes_written ? bytes_written : retval;
goto exit_nolock;
@@ -638,7 +639,7 @@ static ssize_t adu_write(struct file *file, const __user 
char *buffer,
 
 exit:
/* unlock the device */
-   up(dev-sem);
+   mutex_unlock(dev-mtx);
 exit_nolock:
 
dbg(2, %s : leave, return value %d, __FUNCTION__, retval);
@@ -698,7 +699,7 @@ static int adu_probe(struct usb_interface *interface,
goto exit;
}
 
-   init_MUTEX(dev-sem);
+   mutex_init(dev-mtx);
spin_lock_init(dev-buflock);
dev-udev = udev

[linux-usb-devel] [PATCH 04/44] USB: use mutex instead of semaphore in the FTDI ELAN driver

2007-07-19 Thread Greg Kroah-Hartman
From: Matthias Kaehlcke [EMAIL PROTECTED]

The FTDI ELAN driver uses a semaphore as mutex. Use the mutex API
instead of the (binary) semaphore.

Signed-off-by: Matthias Kaehlcke [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/misc/ftdi-elan.c |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index e0f122e..7cc6883 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -44,6 +44,7 @@
 #include linux/slab.h
 #include linux/module.h
 #include linux/kref.h
+#include linux/mutex.h
 #include asm/uaccess.h
 #include linux/usb.h
 #include linux/workqueue.h
@@ -64,7 +65,7 @@ static struct workqueue_struct *respond_queue;
 * ftdi_module_lock exists to protect access to global variables
 *
 */
-static struct semaphore ftdi_module_lock;
+static struct mutex ftdi_module_lock;
 static int ftdi_instances = 0;
 static struct list_head ftdi_static_list;
 /*
@@ -199,10 +200,10 @@ static void ftdi_elan_delete(struct kref *kref)
 dev_warn(ftdi-udev-dev, FREEING ftdi=%p\n, ftdi);
 usb_put_dev(ftdi-udev);
 ftdi-disconnected += 1;
-down(ftdi_module_lock);
+mutex_lock(ftdi_module_lock);
 list_del_init(ftdi-ftdi_list);
 ftdi_instances -= 1;
-up(ftdi_module_lock);
+mutex_unlock(ftdi_module_lock);
 kfree(ftdi-bulk_in_buffer);
 ftdi-bulk_in_buffer = NULL;
 }
@@ -2780,10 +2781,10 @@ static int ftdi_elan_probe(struct usb_interface 
*interface,
 return -ENOMEM;
 }
 memset(ftdi, 0x00, sizeof(struct usb_ftdi));
-down(ftdi_module_lock);
+mutex_lock(ftdi_module_lock);
 list_add_tail(ftdi-ftdi_list, ftdi_static_list);
 ftdi-sequence_num = ++ftdi_instances;
-up(ftdi_module_lock);
+mutex_unlock(ftdi_module_lock);
 ftdi_elan_init_kref(ftdi);
 init_MUTEX(ftdi-sw_lock);
 ftdi-udev = usb_get_dev(interface_to_usbdev(interface));
@@ -2909,7 +2910,7 @@ static int __init ftdi_elan_init(void)
 int result;
 printk(KERN_INFO driver %s built at %s on %s\n, 
ftdi_elan_driver.name,
   __TIME__, __DATE__);
-init_MUTEX(ftdi_module_lock);
+mutex_init(ftdi_module_lock);
 INIT_LIST_HEAD(ftdi_static_list);
 status_queue = create_singlethread_workqueue(ftdi-status-control);
if (!status_queue)
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 05/44] USB: sierra: Add TRU-Install (c) Support

2007-07-19 Thread Greg Kroah-Hartman
From: Kevin Lloyd [EMAIL PROTECTED]

This patch adds compatibility with Sierra Wireless' new TRU-Install
feature. Future devices that use this feature will not work unless this
patch has been applied.

Signed-off-by: Kevin Lloyd [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/sierra.c|   98 ---
 drivers/usb/storage/unusual_devs.h |   11 
 2 files changed, 89 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index e7db203..c137c89 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -1,7 +1,7 @@
 /*
   USB Driver for Sierra Wireless
 
-  Copyright (C) 2006  Kevin Lloyd [EMAIL PROTECTED]
+  Copyright (C) 2006, 2007  Kevin Lloyd [EMAIL PROTECTED]
 
   IMPORTANT DISCLAIMER: This driver is not commercially supported by
   Sierra Wireless. Use at your own risk.
@@ -12,10 +12,9 @@
 
   Portions based on the option driver by Matthias Urlichs [EMAIL PROTECTED]
   Whom based his on the Keyspan driver by Hugh Blemings [EMAIL PROTECTED]
-
 */
 
-#define DRIVER_VERSION v.1.0.6
+#define DRIVER_VERSION v.1.2.4b
 #define DRIVER_AUTHOR Kevin Lloyd [EMAIL PROTECTED]
 #define DRIVER_DESC USB Driver for Sierra Wireless USB modems
 
@@ -28,6 +27,71 @@
 #include linux/usb.h
 #include linux/usb/serial.h
 
+#define SWIMS_USB_REQUEST_SetMode  0x0B
+#define SWIMS_USB_REQUEST_TYPE_SetMode 0x40
+#define SWIMS_USB_INDEX_SetMode0x
+#define SWIMS_SET_MODE_Modem   0x0001
+
+/* per port private data */
+#define N_IN_URB   4
+#define N_OUT_URB  4
+#define IN_BUFLEN  4096
+
+static int debug;
+
+enum devicetype {
+   DEVICE_3_PORT = 0,
+   DEVICE_1_PORT = 1,
+   DEVICE_INSTALLER =  2,
+};
+
+int sierra_set_power_state(struct usb_device *udev, __u16 swiState)
+{
+   int result;
+   dev_dbg(udev-dev, %s, SET POWER STATE);
+   result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
+   0x00,   /* __u8 request  */
+   0x40,   /* __u8 request type */
+   swiState,   /* __u16 value   */
+   0,  /* __u16 index   */
+   NULL,   /* void *data*/
+   0,  /* __u16 size*/
+   USB_CTRL_SET_TIMEOUT);  /* int timeout   */
+   return result;
+}
+
+int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode)
+{
+   int result;
+   dev_dbg(udev-dev, %s, DEVICE MODE SWITCH);
+   result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
+   SWIMS_USB_REQUEST_SetMode,  /* __u8 request  */
+   SWIMS_USB_REQUEST_TYPE_SetMode, /* __u8 request type */
+   eSocMode,   /* __u16 value   */
+   SWIMS_USB_INDEX_SetMode,/* __u16 index   */
+   NULL,   /* void *data*/
+   0,  /* __u16 size*/
+   USB_CTRL_SET_TIMEOUT);  /* int timeout   */
+   return result;
+}
+
+int sierra_probe(struct usb_interface *iface, const struct usb_device_id *id)
+{
+   int result;
+   struct usb_device *udev;
+
+   udev = usb_get_dev(interface_to_usbdev(iface));
+
+   /* Check if in installer mode */
+   if (id-driver_info == DEVICE_INSTALLER) {
+   dev_dbg(udev-dev, %s, FOUND DEVICE(SW)\n);
+   result = sierra_set_ms_mode(udev, SWIMS_SET_MODE_Modem);
+   /*We do not want to bind to the device when in installer mode*/
+   return -EIO;
+   }
+
+   return usb_serial_probe(iface, id);
+}
 
 static struct usb_device_id id_table [] = {
{ USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
@@ -43,8 +107,10 @@ static struct usb_device_id id_table [] = {
{ USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 */
{ USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
 
-   { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */
-   { USB_DEVICE(0x0F3D, 0x0112) }, /* AirPrime/Sierra PC 5220 */
+   { USB_DEVICE(0x1199, 0x0112), .driver_info = DEVICE_1_PORT }, /* Sierra 
Wireless AirCard 580 */
+   { USB_DEVICE(0x0F3D, 0x0112), .driver_info = DEVICE_1_PORT }, /* 
Airprime/Sierra PC 5220 */
+
+   { USB_DEVICE(0x1199, 0x0FFF), .driver_info = DEVICE_INSTALLER},
{ }
 };
 MODULE_DEVICE_TABLE(usb, id_table);
@@ -56,6 +122,7 @@ static struct usb_device_id id_table_1port [] = {
 };
 
 static struct usb_device_id id_table_3port [] = {
+   /* CDMA Devices */
{ USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
{ USB_DEVICE(0x1199

[linux-usb-devel] [PATCH 06/44] USB: sierra: Add new devices

2007-07-19 Thread Greg Kroah-Hartman
From: Kevin Lloyd [EMAIL PROTECTED]

This patch adds new devices to the Sierra Wireless driver. This is being
resubmitted because the dependent patch (patch 01/02) needed to be
resubmitted.

Signed-off-by: Kevin Lloyd [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/sierra.c |   27 ---
 1 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index c137c89..0794ccd 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -14,7 +14,7 @@
   Whom based his on the Keyspan driver by Hugh Blemings [EMAIL PROTECTED]
 */
 
-#define DRIVER_VERSION v.1.2.4b
+#define DRIVER_VERSION v.1.2.5b
 #define DRIVER_AUTHOR Kevin Lloyd [EMAIL PROTECTED]
 #define DRIVER_DESC USB Driver for Sierra Wireless USB modems
 
@@ -97,15 +97,23 @@ static struct usb_device_id id_table [] = {
{ USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
{ USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */
{ USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
+   { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */
{ USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
{ USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */
-   { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless AirCard 595U */
{ USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */
+   { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U */
+
{ USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */
{ USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
{ USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */
-   { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 */
+   { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775  AC 875U */
{ USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
+   { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/
+   { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/
+   { USB_DEVICE(0x1199, 0x6850) }, /* Sierra Wireless AirCard 880 */
+   { USB_DEVICE(0x1199, 0x6851) }, /* Sierra Wireless AirCard 881 */
+   { USB_DEVICE(0x1199, 0x6852) }, /* Sierra Wireless AirCard 880 E */
+   { USB_DEVICE(0x1199, 0x6853) }, /* Sierra Wireless AirCard 881 E */
 
{ USB_DEVICE(0x1199, 0x0112), .driver_info = DEVICE_1_PORT }, /* Sierra 
Wireless AirCard 580 */
{ USB_DEVICE(0x0F3D, 0x0112), .driver_info = DEVICE_1_PORT }, /* 
Airprime/Sierra PC 5220 */
@@ -122,21 +130,26 @@ static struct usb_device_id id_table_1port [] = {
 };
 
 static struct usb_device_id id_table_3port [] = {
-   /* CDMA Devices */
{ USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
{ USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */
+   { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */
{ USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
{ USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
{ USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */
-   { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless AirCard 595U */
{ USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */
+   { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U*/
 
-   /* GSM/UMTS Devices */
{ USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */
{ USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
{ USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */
-   { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 */
+   { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775  AC 875U */
{ USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
+   { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/
+   { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/
+   { USB_DEVICE(0x1199, 0x6850) }, /* Sierra Wireless AirCard 880 */
+   { USB_DEVICE(0x1199, 0x6851) }, /* Sierra Wireless AirCard 881 */
+   { USB_DEVICE(0x1199, 0x6852) }, /* Sierra Wireless AirCard 880E */
+   { USB_DEVICE(0x1199, 0x6853) }, /* Sierra Wireless AirCard 881E */
{ }
 };
 
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 07/44] USB: usblp: Big cleanup breaks O_NONBLOCK

2007-07-19 Thread Greg Kroah-Hartman
From: Pete Zaitcev [EMAIL PROTECTED]

I found the first regresson in the rewritten (all dynamic and no races)
driver. If application uses O_NONBLOCK, I return -EAGAIN despite the URB
being submitted successfuly. This causes the application to resubmit the
same data erroneously.

The fix is to pretend that the transfer has succeeded even if URB was
merely queued. It is the same behaviour as with the old version.

Signed-off-by: Pete Zaitcev [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/class/usblp.c |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 9a14789..80ec103 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -741,10 +741,11 @@ static ssize_t usblp_write(struct file *file, const char 
__user *buffer, size_t
 */
rv = usblp_wwait(usblp, !!(file-f_flagsO_NONBLOCK));
if (rv  0) {
-   /*
-* If interrupted, we simply leave the URB to dangle,
-* so the -release will call usb_kill_urb().
-*/
+   if (rv == -EAGAIN) {
+   /* Presume that it's going to complete well. */
+   writecount += transfer_length;
+   }
+   /* Leave URB dangling, to be cleaned on close. */
goto collect_error;
}
 
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 08/44] isp116x-hcd: prepare for urb-status

2007-07-19 Thread Greg Kroah-Hartman
From: Alan Stern [EMAIL PROTECTED]

This patch (as931b), adapted from a patch by Olav Kongas, makes a small
set of conservative changes to the isp116x-hcd driver in preparation
for the removal of urb-status.

finish_request() is moved up in the source and is called
as soon as the URB is known to have completed, rather than
after all the active endpoints have been scanned.

The status of a completed URB is kept in a local variable
and copied to urb-status only when the URB is about to be
given back.

-EREMOTEIO error status for control transfers is set after
the status stage rather than when the short packet arrives.

Some unnecessary uses of urb-lock are removed.

Signed-off-by: Alan Stern [EMAIL PROTECTED]
Cc: Olav Kongas [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/host/isp116x-hcd.c |  187 ++-
 1 files changed, 86 insertions(+), 101 deletions(-)

diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 46873f2..5c851a3 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -228,7 +228,6 @@ static void preproc_atl_queue(struct isp116x *isp116x)
   struct urb, urb_list);
ptd = ep-ptd;
len = ep-length;
-   spin_lock(urb-lock);
ep-data = (unsigned char *)urb-transfer_buffer
+ urb-actual_length;
 
@@ -264,7 +263,6 @@ static void preproc_atl_queue(struct isp116x *isp116x)
| PTD_EP(ep-epnum);
ptd-len = PTD_LEN(len) | PTD_DIR(dir);
ptd-faddr = PTD_FA(usb_pipedevice(urb-pipe));
-   spin_unlock(urb-lock);
if (!ep-active) {
ptd-mps |= PTD_LAST_MSK;
isp116x-atl_last_dir = dir;
@@ -275,6 +273,61 @@ static void preproc_atl_queue(struct isp116x *isp116x)
 }
 
 /*
+  Take done or failed requests out of schedule. Give back
+  processed urbs.
+*/
+static void finish_request(struct isp116x *isp116x, struct isp116x_ep *ep,
+  struct urb *urb)
+__releases(isp116x-lock) __acquires(isp116x-lock)
+{
+   unsigned i;
+
+   urb-hcpriv = NULL;
+   ep-error_count = 0;
+
+   if (usb_pipecontrol(urb-pipe))
+   ep-nextpid = USB_PID_SETUP;
+
+   urb_dbg(urb, Finish);
+
+   spin_unlock(isp116x-lock);
+   usb_hcd_giveback_urb(isp116x_to_hcd(isp116x), urb);
+   spin_lock(isp116x-lock);
+
+   /* take idle endpoints out of the schedule */
+   if (!list_empty(ep-hep-urb_list))
+   return;
+
+   /* async deschedule */
+   if (!list_empty(ep-schedule)) {
+   list_del_init(ep-schedule);
+   return;
+   }
+
+   /* periodic deschedule */
+   DBG(deschedule qh%d/%p branch %d\n, ep-period, ep, ep-branch);
+   for (i = ep-branch; i  PERIODIC_SIZE; i += ep-period) {
+   struct isp116x_ep *temp;
+   struct isp116x_ep **prev = isp116x-periodic[i];
+
+   while (*prev  ((temp = *prev) != ep))
+   prev = temp-next;
+   if (*prev)
+   *prev = ep-next;
+   isp116x-load[i] -= ep-load;
+   }
+   ep-branch = PERIODIC_SIZE;
+   isp116x_to_hcd(isp116x)-self.bandwidth_allocated -=
+   ep-load / ep-period;
+
+   /* switch irq type? */
+   if (!--isp116x-periodic_count) {
+   isp116x-irqenb = ~HCuPINT_SOF;
+   isp116x-irqenb |= HCuPINT_ATL;
+   }
+}
+
+/*
   Analyze transfer results, handle partial transfers and errors
 */
 static void postproc_atl_queue(struct isp116x *isp116x)
@@ -284,6 +337,7 @@ static void postproc_atl_queue(struct isp116x *isp116x)
struct usb_device *udev;
struct ptd *ptd;
int short_not_ok;
+   int status;
u8 cc;
 
for (ep = isp116x-atl_active; ep; ep = ep-active) {
@@ -294,7 +348,7 @@ static void postproc_atl_queue(struct isp116x *isp116x)
ptd = ep-ptd;
cc = PTD_GET_CC(ptd);
short_not_ok = 1;
-   spin_lock(urb-lock);
+   status = -EINPROGRESS;
 
/* Data underrun is special. For allowed underrun
   we clear the error and continue as normal. For
@@ -302,47 +356,36 @@ static void postproc_atl_queue(struct isp116x *isp116x)
   immediately while for control transfer,
   we do a STATUS stage. */
if (cc == TD_DATAUNDERRUN) {
-   if (!(urb-transfer_flags  URB_SHORT_NOT_OK)) {
-   DBG(Allowed data underrun\n);
+   if (!(urb-transfer_flags  URB_SHORT_NOT_OK) ||
+   usb_pipecontrol(urb-pipe)) {
+   DBG

[linux-usb-devel] [PATCH 09/44] USB: add descriptors binary sysfs attribute

2007-07-19 Thread Greg Kroah-Hartman
From: Alan Stern [EMAIL PROTECTED]

This patch (as934) adds a new readonly binary sysfs attribute file
called descriptors for each USB device.  The attribute contains the
device descriptor followed by the raw descriptor entry (config plug
subsidiary descriptors) for the current configuration.

Having this information available in fixed-format binary makes life a
lot easier for user programs by avoiding the need to open, read, and
parse multiple sysfs text files.

The information in this attribute file is much like that in usbfs's
device file, but there are some significant differences:

The 2-byte fields in the device descriptor are left in
little-endian byte order, as they appear on the bus and
in the kernel.

Only one raw descriptor set is presented, that of the
current configuration.

Opening this file will not cause a suspended device to be
autoresumed.

The last item in particular should be a big selling point for libusb,
which currently forces all USB devices to be resumed as it scans the
device tree.

Signed-off-by: Alan Stern [EMAIL PROTECTED]
Cc: Dave Mielke [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/sysfs.c |   53 ++
 1 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index d47ae89..2ab222b 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -441,6 +441,54 @@ static struct attribute_group dev_attr_grp = {
.attrs = dev_attrs,
 };
 
+/* Binary descriptors */
+
+static ssize_t
+read_descriptors(struct kobject *kobj, struct bin_attribute *attr,
+   char *buf, loff_t off, size_t count)
+{
+   struct usb_device *udev = to_usb_device(
+   container_of(kobj, struct device, kobj));
+   size_t nleft = count;
+   size_t srclen, n;
+
+   usb_lock_device(udev);
+
+   /* The binary attribute begins with the device descriptor */
+   srclen = sizeof(struct usb_device_descriptor);
+   if (off  srclen) {
+   n = min_t(size_t, nleft, srclen - off);
+   memcpy(buf, off + (char *) udev-descriptor, n);
+   nleft -= n;
+   buf += n;
+   off = 0;
+   } else {
+   off -= srclen;
+   }
+
+   /* Then follows the raw descriptor entry for the current
+* configuration (config plus subsidiary descriptors).
+*/
+   if (udev-actconfig) {
+   int cfgno = udev-actconfig - udev-config;
+
+   srclen = __le16_to_cpu(udev-actconfig-desc.wTotalLength);
+   if (off  srclen) {
+   n = min_t(size_t, nleft, srclen - off);
+   memcpy(buf, off + udev-rawdescriptors[cfgno], n);
+   nleft -= n;
+   }
+   }
+   usb_unlock_device(udev);
+   return count - nleft;
+}
+
+static struct bin_attribute dev_bin_attr_descriptors = {
+   .attr = {.name = descriptors, .mode = 0444},
+   .read = read_descriptors,
+   .size = 18 + 65535, /* dev descr + max-size raw descriptor */
+};
+
 int usb_create_sysfs_dev_files(struct usb_device *udev)
 {
struct device *dev = udev-dev;
@@ -450,6 +498,10 @@ int usb_create_sysfs_dev_files(struct usb_device *udev)
if (retval)
return retval;
 
+   retval = device_create_bin_file(dev, dev_bin_attr_descriptors);
+   if (retval)
+   goto error;
+
retval = add_persist_attributes(dev);
if (retval)
goto error;
@@ -492,6 +544,7 @@ void usb_remove_sysfs_dev_files(struct usb_device *udev)
device_remove_file(dev, dev_attr_serial);
remove_power_attributes(dev);
remove_persist_attributes(dev);
+   device_remove_bin_file(dev, dev_bin_attr_descriptors);
sysfs_remove_group(dev-kobj, dev_attr_grp);
 }
 
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 10/44] USB: fix warning caused by autosuspend counter going negative

2007-07-19 Thread Greg Kroah-Hartman
From: Alan Stern [EMAIL PROTECTED]

This patch (as937) fixes a minor bug in the autosuspend usage-counting
code.  Each hub's usage counter keeps track of the number of
unsuspended children.  However the current driver increments the
counter after registering a new child, by which time the child may
already have been suspended and caused the counter to go negative.
The obvious solution is to increment the counter before registering
the child.

Signed-off-by: Alan Stern [EMAIL PROTECTED]
Cc: stable [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/hub.c |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index fd74c50..e341a1d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1335,6 +1335,10 @@ int usb_new_device(struct usb_device *udev)
udev-dev.devt = MKDEV(USB_DEVICE_MAJOR,
(((udev-bus-busnum-1) * 128) + (udev-devnum-1)));
 
+   /* Increment the parent's count of unsuspended children */
+   if (udev-parent)
+   usb_autoresume_device(udev-parent);
+
/* Register the device.  The device driver is responsible
 * for adding the device files to sysfs and for configuring
 * the device.
@@ -1342,13 +1346,11 @@ int usb_new_device(struct usb_device *udev)
err = device_add(udev-dev);
if (err) {
dev_err(udev-dev, can't device_add, error %d\n, err);
+   if (udev-parent)
+   usb_autosuspend_device(udev-parent);
goto fail;
}
 
-   /* Increment the parent's count of unsuspended children */
-   if (udev-parent)
-   usb_autoresume_device(udev-parent);
-
 exit:
return err;
 
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 11/44] USB: mos7720, mos7840: remove redundant urb check

2007-07-19 Thread Greg Kroah-Hartman
From: Florin Malita [EMAIL PROTECTED]

Coverity (1709, 1710, 1711, 1712, 1713) actually flagged these as
REVERSE_INULLs (NULL check performed after dereference). But looking at
the other drivers I can't see any similar tests and the USB core already
makes sure urb is non-null - so might as well get rid of the checks.


Signed-off-by: Florin Malita [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/mos7720.c |5 -
 drivers/usb/serial/mos7840.c |   19 ---
 2 files changed, 0 insertions(+), 24 deletions(-)

diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 231b584..01e811b 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -110,11 +110,6 @@ static void mos7720_interrupt_callback(struct urb *urb)
 
dbg(%s, : Entering\n);
 
-   if (!urb) {
-   dbg(%s,Invalid Pointer :\n);
-   return;
-   }
-
switch (status) {
case 0:
/* success */
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 37f41f5..f76480f 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -436,11 +436,6 @@ static void mos7840_control_callback(struct urb *urb)
int result = 0;
int status = urb-status;
 
-   if (!urb) {
-   dbg(%s, Invalid Pointer :\n);
-   return;
-   }
-
mos7840_port = (struct moschip_port *)urb-context;
 
switch (status) {
@@ -525,10 +520,6 @@ static void mos7840_interrupt_callback(struct urb *urb)
int status = urb-status;
 
dbg(%s,  : Entering\n);
-   if (!urb) {
-   dbg(%s, Invalid Pointer :\n);
-   return;
-   }
 
switch (status) {
case 0:
@@ -676,11 +667,6 @@ static void mos7840_bulk_in_callback(struct urb *urb)
struct tty_struct *tty;
int status = urb-status;
 
-   if (!urb) {
-   dbg(%s, Invalid Pointer :\n);
-   return;
-   }
-
if (status) {
dbg(nonzero read bulk status received: %d, status);
return;
@@ -753,11 +739,6 @@ static void mos7840_bulk_out_data_callback(struct urb *urb)
int status = urb-status;
int i;
 
-   if (!urb) {
-   dbg(%s, Invalid Pointer :\n);
-   return;
-   }
-
mos7840_port = (struct moschip_port *)urb-context;
spin_lock(mos7840_port-pool_lock);
for (i = 0; i  NUM_URBS; i++) {
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 12/44] UHCI: short control URBs get a status stage

2007-07-19 Thread Greg Kroah-Hartman
From: Alan Stern [EMAIL PROTECTED]

It has recently been pointed out that short control transfers should
have a status stage, even if they generate an error because
URB_SHORT_NOT_OK was set.  This patch (as935) changes uhci-hcd to
enable the status stage when this happens.

Signed-off-by: Alan Stern [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/host/uhci-q.c |   59 +
 1 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index 4aed305..3bb908c 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -827,8 +827,10 @@ static int uhci_submit_control(struct uhci_hcd *uhci, 
struct urb *urb,
 * If direction is send, change the packet ID from SETUP (0x2D)
 * to OUT (0xE1).  Else change it from SETUP to IN (0x69) and
 * set Short Packet Detect (SPD) for all data packets.
+*
+* 0-length transfers always get treated as send.
 */
-   if (usb_pipeout(urb-pipe))
+   if (usb_pipeout(urb-pipe) || len == 0)
destination ^= (USB_PID_SETUP ^ USB_PID_OUT);
else {
destination ^= (USB_PID_SETUP ^ USB_PID_IN);
@@ -839,7 +841,12 @@ static int uhci_submit_control(struct uhci_hcd *uhci, 
struct urb *urb,
 * Build the DATA TDs
 */
while (len  0) {
-   int pktsze = min(len, maxsze);
+   int pktsze = maxsze;
+
+   if (len = pktsze) {/* The last data packet */
+   pktsze = len;
+   status = ~TD_CTRL_SPD;
+   }
 
td = uhci_alloc_td(uhci);
if (!td)
@@ -866,20 +873,10 @@ static int uhci_submit_control(struct uhci_hcd *uhci, 
struct urb *urb,
goto nomem;
*plink = LINK_TO_TD(td);
 
-   /*
-* It's IN if the pipe is an output pipe or we're not expecting
-* data back.
-*/
-   destination = ~TD_TOKEN_PID_MASK;
-   if (usb_pipeout(urb-pipe) || !urb-transfer_buffer_length)
-   destination |= USB_PID_IN;
-   else
-   destination |= USB_PID_OUT;
-
+   /* Change direction for the status transaction */
+   destination ^= (USB_PID_IN ^ USB_PID_OUT);
destination |= TD_TOKEN_TOGGLE; /* End in Data1 */
 
-   status = ~TD_CTRL_SPD;
-
uhci_add_td_to_urbp(td, urbp);
uhci_fill_td(td, status | TD_CTRL_IOC,
destination | uhci_explen(0), 0);
@@ -1185,10 +1182,18 @@ static int uhci_result_common(struct uhci_hcd *uhci, 
struct urb *urb)
}
}
 
+   /* Did we receive a short packet? */
} else if (len  uhci_expected_length(td_token(td))) {
 
-   /* We received a short packet */
-   if (urb-transfer_flags  URB_SHORT_NOT_OK)
+   /* For control transfers, go to the status TD if
+* this isn't already the last data TD */
+   if (qh-type == USB_ENDPOINT_XFER_CONTROL) {
+   if (td-list.next != urbp-td_list.prev)
+   ret = 1;
+   }
+
+   /* For bulk and interrupt, this may be an error */
+   else if (urb-transfer_flags  URB_SHORT_NOT_OK)
ret = -EREMOTEIO;
 
/* Fixup needed only if this isn't the URB's last TD */
@@ -1208,10 +1213,6 @@ static int uhci_result_common(struct uhci_hcd *uhci, 
struct urb *urb)
 
 err:
if (ret  0) {
-   /* In case a control transfer gets an error
-* during the setup stage */
-   urb-actual_length = max(urb-actual_length, 0);
-
/* Note that the queue has stopped and save
 * the next toggle value */
qh-element = UHCI_PTR_TERM;
@@ -1489,9 +1490,25 @@ __acquires(uhci-lock)
 {
struct urb_priv *urbp = (struct urb_priv *) urb-hcpriv;
 
+   if (qh-type == USB_ENDPOINT_XFER_CONTROL) {
+
+   /* urb-actual_length  0 means the setup transaction didn't
+* complete successfully.  Either it failed or the URB was
+* unlinked first.  Regardless, don't confuse people with a
+* negative length. */
+   urb-actual_length = max(urb-actual_length, 0);
+
+   /* Report erroneous short transfers */
+   if (unlikely((urb-transfer_flags  URB_SHORT_NOT_OK) 
+   urb-actual_length 
+   urb-transfer_buffer_length 
+   urb-status == 0))
+   urb-status = -EREMOTEIO;
+   }
+
/* When giving back the first URB in an Isochronous queue

[linux-usb-devel] [PATCH 13/44] USB: documentation update for usb_unlink_urb

2007-07-19 Thread Greg Kroah-Hartman
From: Alan Stern [EMAIL PROTECTED]

This patch (as936) updates the kerneldoc for usb_unlink_urb.  The
explanation of how endpoint queues are meant to work is now clearer
and in better agreement with reality.

Signed-off-by: Alan Stern [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/urb.c |   88 ---
 1 files changed, 45 insertions(+), 43 deletions(-)

diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index 52ec44b..be63022 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -440,55 +440,57 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
  * @urb: pointer to urb describing a previously submitted request,
  * may be NULL
  *
- * This routine cancels an in-progress request.  URBs complete only
- * once per submission, and may be canceled only once per submission.
- * Successful cancellation means the requests's completion handler will
- * be called with a status code indicating that the request has been
- * canceled (rather than any other code) and will quickly be removed
- * from host controller data structures.
- *
- * This request is always asynchronous.
- * Success is indicated by returning -EINPROGRESS,
- * at which time the URB will normally have been unlinked but not yet
- * given back to the device driver.  When it is called, the completion
- * function will see urb-status == -ECONNRESET.  Failure is indicated
- * by any other return value.  Unlinking will fail when the URB is not
- * currently linked (i.e., it was never submitted, or it was unlinked
- * before, or the hardware is already finished with it), even if the
- * completion handler has not yet run.
+ * This routine cancels an in-progress request.  URBs complete only once
+ * per submission, and may be canceled only once per submission.
+ * Successful cancellation means termination of @urb will be expedited
+ * and the completion handler will be called with a status code
+ * indicating that the request has been canceled (rather than any other
+ * code).
+ *
+ * This request is always asynchronous.  Success is indicated by
+ * returning -EINPROGRESS, at which time the URB will probably not yet
+ * have been given back to the device driver.  When it is eventually
+ * called, the completion function will see @urb-status == -ECONNRESET.
+ * Failure is indicated by usb_unlink_urb() returning any other value.
+ * Unlinking will fail when @urb is not currently linked (i.e., it was
+ * never submitted, or it was unlinked before, or the hardware is already
+ * finished with it), even if the completion handler has not yet run.
  *
  * Unlinking and Endpoint Queues:
  *
+ * [The behaviors and guarantees described below do not apply to virtual
+ * root hubs but only to endpoint queues for physical USB devices.]
+ *
  * Host Controller Drivers (HCDs) place all the URBs for a particular
  * endpoint in a queue.  Normally the queue advances as the controller
  * hardware processes each request.  But when an URB terminates with an
- * error its queue stops, at least until that URB's completion routine
- * returns.  It is guaranteed that the queue will not restart until all
- * its unlinked URBs have been fully retired, with their completion
- * routines run, even if that's not until some time after the original
- * completion handler returns.  Normally the same behavior and guarantees
- * apply when an URB terminates because it was unlinked; however if an
- * URB is unlinked before the hardware has started to execute it, then
- * its queue is not guaranteed to stop until all the preceding URBs have
- * completed.
- *
- * This means that USB device drivers can safely build deep queues for
- * large or complex transfers, and clean them up reliably after any sort
- * of aborted transfer by unlinking all pending URBs at the first fault.
- *
- * Note that an URB terminating early because a short packet was received
- * will count as an error if and only if the URB_SHORT_NOT_OK flag is set.
- * Also, that all unlinks performed in any URB completion handler must
- * be asynchronous.
- *
- * Queues for isochronous endpoints are treated differently, because they
- * advance at fixed rates.  Such queues do not stop when an URB is unlinked.
- * An unlinked URB may leave a gap in the stream of packets.  It is undefined
- * whether such gaps can be filled in.
- *
- * When a control URB terminates with an error, it is likely that the
- * status stage of the transfer will not take place, even if it is merely
- * a soft error resulting from a short-packet with URB_SHORT_NOT_OK set.
+ * error its queue generally stops (see below), at least until that URB's
+ * completion routine returns.  It is guaranteed that a stopped queue
+ * will not restart until all its unlinked URBs have been fully retired,
+ * with their completion routines run, even if that's not until some time
+ * after the original completion handler returns.  The same behavior

[linux-usb-devel] [PATCH 15/44] USB: MAINTAINERS entry for amd5536udc

2007-07-19 Thread Greg Kroah-Hartman
From: Thomas Dahlmann [EMAIL PROTECTED]

MAINTAINERS entry for amd5536udc driver.

Signed-off-by: David Brownell [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 MAINTAINERS |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index fbe0dca..f49c556 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -329,6 +329,12 @@ P: Ivan Kokshaysky
 M: [EMAIL PROTECTED]
 S: Maintained for 2.4; PCI support for 2.6.
 
+AMD GEODE CS5536 USB DEVICE CONTROLLER DRIVER
+P: Thomas Dahlmann
+M: [EMAIL PROTECTED]
+L: [EMAIL PROTECTED]
+S: Supported
+
 AMD GEODE PROCESSOR/CHIPSET SUPPORT
 P: Jordan Crouse
 M: [EMAIL PROTECTED]
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 16/44] USB: Remove pointless conditional in drivers/usb/serial/io_ti.c::edge_shutdown()

2007-07-19 Thread Greg Kroah-Hartman
From: Jesper Juhl [EMAIL PROTECTED]

Coverity scan found (CID: 1708) this in
drivers/usb/serial/io_ti.c::edge_shutdown() :

...
2797for (i=0; i  serial-num_ports; ++i) {
2798edge_port = usb_get_serial_port_data(serial-port[i]);
2799edge_remove_sysfs_attrs(edge_port-port);
2800if (edge_port) {
2801edge_buf_free(edge_port-ep_out_buf);
2802kfree(edge_port);
2803}
2804usb_set_serial_port_data(serial-port[i], NULL);
2805}
...

It's complaining that we dereference 'edge_port' in line 2799 which
makes the test of that pointer against NULL in 2800 pointless, since if
edge_port was actually NULL we'd have crashed already before reaching
line 2800.
Reading the edge_open() function it seems to me that the pointer
returned by usb_get_serial_port_data(serial-port[i]) and stored in
'edge_port' can never actually be NULL here, so the test is entirely
superfluous (even if it could be NULL it would be pointless here,
ignoring the then possible crash in that case, since both
edge_buf_free() and kfree() can handle being passed NULL pointers.

This patch removes the pointless conditional (and also makes a few
tiny style corrections now that I was in the area anyway).


Signed-off-by: Jesper Juhl [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/io_ti.c |   10 --
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 0d39036..b867090 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -2794,16 +2794,14 @@ static void edge_shutdown (struct usb_serial *serial)
 
dbg (%s, __FUNCTION__);
 
-   for (i=0; i  serial-num_ports; ++i) {
+   for (i = 0; i  serial-num_ports; ++i) {
edge_port = usb_get_serial_port_data(serial-port[i]);
edge_remove_sysfs_attrs(edge_port-port);
-   if (edge_port) {
-   edge_buf_free(edge_port-ep_out_buf);
-   kfree(edge_port);
-   }
+   edge_buf_free(edge_port-ep_out_buf);
+   kfree(edge_port);
usb_set_serial_port_data(serial-port[i], NULL);
}
-   kfree (usb_get_serial_data(serial));
+   kfree(usb_get_serial_data(serial));
usb_set_serial_data(serial, NULL);
 }
 
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 17/44] USB: usb-storage: unusual_devs entry for Nikon D100

2007-07-19 Thread Greg Kroah-Hartman
From: Alan Stern [EMAIL PROTECTED]

This patch (as938) adds an unusual_devs entry for the Nikon DSC D100.

Signed-off-by: Alan Stern [EMAIL PROTECTED]
Cc: Phil Dibowitz [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/storage/unusual_devs.h |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/storage/unusual_devs.h 
b/drivers/usb/storage/unusual_devs.h
index 26fd196..a624e72 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -313,6 +313,13 @@ UNUSUAL_DEV(  0x04b0, 0x0301, 0x0010, 0x0010,
US_SC_DEVICE, US_PR_DEVICE,NULL,
US_FL_NOT_LOCKABLE ),
 
+/* Reported by Stefan de Konink [EMAIL PROTECTED] */
+UNUSUAL_DEV(  0x04b0, 0x0401, 0x0200, 0x0200,
+   NIKON,
+   NIKON DSC D100,
+   US_SC_DEVICE, US_PR_DEVICE, NULL,
+   US_FL_FIX_CAPACITY),
+
 /* Reported by Andreas Bockhold [EMAIL PROTECTED] */
 UNUSUAL_DEV(  0x04b0, 0x0405, 0x0100, 0x0100,
NIKON,
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 19/44] USB: atm: cxacru: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/atm/cxacru.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index 1bc8840..02c52f8 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -456,7 +456,7 @@ static int cxacru_start_wait_urb(struct urb *urb, struct 
completion *done,
 int* actual_length)
 {
struct timer_list timer;
-   int status;
+   int status = urb-status;
 
init_timer(timer);
timer.expires = jiffies + msecs_to_jiffies(CMD_TIMEOUT);
@@ -464,7 +464,6 @@ static int cxacru_start_wait_urb(struct urb *urb, struct 
completion *done,
timer.function = cxacru_timeout_kill;
add_timer(timer);
wait_for_completion(done);
-   status = urb-status;
del_timer_sync(timer);
 
if (actual_length)
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 20/44] USB: atm: speedtch: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/atm/speedtch.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
index 638b800..eb0615a 100644
--- a/drivers/usb/atm/speedtch.c
+++ b/drivers/usb/atm/speedtch.c
@@ -612,7 +612,8 @@ static void speedtch_handle_int(struct urb *int_urb)
struct speedtch_instance_data *instance = int_urb-context;
struct usbatm_data *usbatm = instance-usbatm;
unsigned int count = int_urb-actual_length;
-   int ret = int_urb-status;
+   int status = int_urb-status;
+   int ret;
 
/* The magic interrupt for up state */
static const unsigned char up_int[6]   = { 0xa1, 0x00, 0x01, 0x00, 
0x00, 0x00 };
@@ -621,8 +622,8 @@ static void speedtch_handle_int(struct urb *int_urb)
 
atm_dbg(usbatm, %s entered\n, __func__);
 
-   if (ret  0) {
-   atm_dbg(usbatm, %s: nonzero urb status %d!\n, __func__, ret);
+   if (status  0) {
+   atm_dbg(usbatm, %s: nonzero urb status %d!\n, __func__, 
status);
goto fail;
}
 
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 21/44] USB: atm: ueagle-atm: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/atm/ueagle-atm.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index 8f04665..a1a1c9d 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -1308,11 +1308,13 @@ static void uea_intr(struct urb *urb)
 {
struct uea_softc *sc = urb-context;
struct intr_pkt *intr = urb-transfer_buffer;
+   int status = urb-status;
+
uea_enters(INS_TO_USBDEV(sc));
 
-   if (unlikely(urb-status  0)) {
+   if (unlikely(status  0)) {
uea_err(INS_TO_USBDEV(sc), uea_intr() failed with %d\n,
-  urb-status);
+  status);
return;
}
 
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 22/44] USB: atm: usbatm: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/atm/usbatm.c |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index 11e9b15..e717f5b 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -257,9 +257,10 @@ static void usbatm_complete(struct urb *urb)
 {
struct usbatm_channel *channel = urb-context;
unsigned long flags;
+   int status = urb-status;
 
vdbg(%s: urb 0x%p, status %d, actual_length %d,
-__func__, urb, urb-status, urb-actual_length);
+__func__, urb, status, urb-actual_length);
 
/* usually in_interrupt(), but not always */
spin_lock_irqsave(channel-lock, flags);
@@ -269,16 +270,16 @@ static void usbatm_complete(struct urb *urb)
 
spin_unlock_irqrestore(channel-lock, flags);
 
-   if (unlikely(urb-status) 
+   if (unlikely(status) 
(!(channel-usbatm-flags  UDSL_IGNORE_EILSEQ) ||
-urb-status != -EILSEQ ))
+status != -EILSEQ ))
{
-   if (urb-status == -ESHUTDOWN)
+   if (status == -ESHUTDOWN)
return;
 
if (printk_ratelimit())
atm_warn(channel-usbatm, %s: urb 0x%p failed (%d)!\n,
-   __func__, urb, urb-status);
+   __func__, urb, status);
/* throttle processing in case of an error */
mod_timer(channel-delay, jiffies + 
msecs_to_jiffies(THROTTLE_MSECS));
} else
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 23/44] USB: class: cdc-acm: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/class/cdc-acm.c |   18 ++
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index cd51520..fe940e0 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -257,9 +257,10 @@ static void acm_ctrl_irq(struct urb *urb)
struct usb_cdc_notification *dr = urb-transfer_buffer;
unsigned char *data;
int newctrl;
-   int status;
+   int retval;
+   int status = urb-status;
 
-   switch (urb-status) {
+   switch (status) {
case 0:
/* success */
break;
@@ -267,10 +268,10 @@ static void acm_ctrl_irq(struct urb *urb)
case -ENOENT:
case -ESHUTDOWN:
/* this urb is terminated, clean up */
-   dbg(%s - urb shutting down with status: %d, __FUNCTION__, 
urb-status);
+   dbg(%s - urb shutting down with status: %d, __FUNCTION__, 
status);
return;
default:
-   dbg(%s - nonzero urb status received: %d, __FUNCTION__, 
urb-status);
+   dbg(%s - nonzero urb status received: %d, __FUNCTION__, 
status);
goto exit;
}
 
@@ -311,10 +312,10 @@ static void acm_ctrl_irq(struct urb *urb)
break;
}
 exit:
-   status = usb_submit_urb (urb, GFP_ATOMIC);
-   if (status)
+   retval = usb_submit_urb (urb, GFP_ATOMIC);
+   if (retval)
err (%s - usb_submit_urb failed with result %d,
-__FUNCTION__, status);
+__FUNCTION__, retval);
 }
 
 /* data interface returns incoming bytes, or we got unthrottled */
@@ -324,7 +325,8 @@ static void acm_read_bulk(struct urb *urb)
struct acm_ru *rcv = urb-context;
struct acm *acm = rcv-instance;
int status = urb-status;
-   dbg(Entering acm_read_bulk with status %d, urb-status);
+
+   dbg(Entering acm_read_bulk with status %d, status);
 
if (!ACM_READY(acm))
return;
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 24/44] USB: class: usblp: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/class/usblp.c |   18 ++
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 80ec103..5192cd9 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -289,16 +289,17 @@ static int proto_bias = -1;
 static void usblp_bulk_read(struct urb *urb)
 {
struct usblp *usblp = urb-context;
+   int status = urb-status;
 
if (usblp-present  usblp-used) {
-   if (urb-status)
+   if (status)
printk(KERN_WARNING usblp%d: 
nonzero read bulk status received: %d\n,
-   usblp-minor, urb-status);
+   usblp-minor, status);
}
spin_lock(usblp-lock);
-   if (urb-status  0)
-   usblp-rstatus = urb-status;
+   if (status  0)
+   usblp-rstatus = status;
else
usblp-rstatus = urb-actual_length;
usblp-rcomplete = 1;
@@ -311,16 +312,17 @@ static void usblp_bulk_read(struct urb *urb)
 static void usblp_bulk_write(struct urb *urb)
 {
struct usblp *usblp = urb-context;
+   int status = urb-status;
 
if (usblp-present  usblp-used) {
-   if (urb-status)
+   if (status)
printk(KERN_WARNING usblp%d: 
nonzero write bulk status received: %d\n,
-   usblp-minor, urb-status);
+   usblp-minor, status);
}
spin_lock(usblp-lock);
-   if (urb-status  0)
-   usblp-wstatus = urb-status;
+   if (status  0)
+   usblp-wstatus = status;
else
usblp-wstatus = urb-actual_length;
usblp-wcomplete = 1;
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 25/44] USB: storage: onetouch: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/storage/onetouch.c |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c
index d353693..dfd42fe 100644
--- a/drivers/usb/storage/onetouch.c
+++ b/drivers/usb/storage/onetouch.c
@@ -57,9 +57,10 @@ static void usb_onetouch_irq(struct urb *urb)
struct usb_onetouch *onetouch = urb-context;
signed char *data = onetouch-data;
struct input_dev *dev = onetouch-dev;
-   int status;
+   int status = urb-status;
+   int retval;
 
-   switch (urb-status) {
+   switch (status) {
case 0: /* success */
break;
case -ECONNRESET:   /* unlink */
@@ -75,11 +76,11 @@ static void usb_onetouch_irq(struct urb *urb)
input_sync(dev);
 
 resubmit:
-   status = usb_submit_urb (urb, GFP_ATOMIC);
-   if (status)
-   err (can't resubmit intr, %s-%s/input0, status %d,
+   retval = usb_submit_urb (urb, GFP_ATOMIC);
+   if (retval)
+   err (can't resubmit intr, %s-%s/input0, retval %d,
onetouch-udev-bus-bus_name,
-   onetouch-udev-devpath, status);
+   onetouch-udev-devpath, retval);
 }
 
 static int usb_onetouch_open(struct input_dev *dev)
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 26/44] USB: image: mdc800: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/image/mdc800.c |   45 ---
 1 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c
index 36502a0..d1131a8 100644
--- a/drivers/usb/image/mdc800.c
+++ b/drivers/usb/image/mdc800.c
@@ -284,9 +284,9 @@ static void mdc800_usb_irq (struct urb *urb)
int data_received=0, wake_up;
unsigned char* b=urb-transfer_buffer;
struct mdc800_data* mdc800=urb-context;
+   int status = urb-status;
 
-   if (urb-status = 0)
-   {
+   if (status = 0) {
 
//dbg (%i %i %i %i %i %i %i %i 
\n,b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7]);
 
@@ -324,7 +324,7 @@ static void mdc800_usb_irq (struct urb *urb)
||
((mdc800-camera_request_ready == 3)  
(mdc800-camera_busy))
||
-   (urb-status  0)
+   (status  0)
);
 
if (wake_up)
@@ -376,15 +376,12 @@ static int mdc800_usb_waitForIRQ (int mode, int msec)
 static void mdc800_usb_write_notify (struct urb *urb)
 {
struct mdc800_data* mdc800=urb-context;
+   int status = urb-status;
 
-   if (urb-status != 0)
-   {
-   err (writing command fails (status=%i), urb-status);
-   }
+   if (status != 0)
+   err (writing command fails (status=%i), status);
else
-   {   
mdc800-state=READY;
-   }
mdc800-written = 1;
wake_up (mdc800-write_wait);
 }
@@ -396,9 +393,9 @@ static void mdc800_usb_write_notify (struct urb *urb)
 static void mdc800_usb_download_notify (struct urb *urb)
 {
struct mdc800_data* mdc800=urb-context;
+   int status = urb-status;
 
-   if (urb-status == 0)
-   {
+   if (status == 0) {
/* Fill output buffer with these data */
memcpy (mdc800-out,  urb-transfer_buffer, 64);
mdc800-out_count=64;
@@ -408,10 +405,8 @@ static void mdc800_usb_download_notify (struct urb *urb)
{
mdc800-state=READY;
}
-   }
-   else
-   {
-   err (request bytes fails (status:%i), urb-status);
+   } else {
+   err (request bytes fails (status:%i), status);
}
mdc800-downloaded = 1;
wake_up (mdc800-download_wait);
@@ -649,9 +644,9 @@ static int mdc800_device_open (struct inode* inode, struct 
file *file)
 
retval=0;
mdc800-irq_urb-dev = mdc800-dev;
-   if (usb_submit_urb (mdc800-irq_urb, GFP_KERNEL))
-   {
-   err (request USB irq fails (submit_retval=%i 
urb_status=%i).,retval, mdc800-irq_urb-status);
+   retval = usb_submit_urb (mdc800-irq_urb, GFP_KERNEL);
+   if (retval) {
+   err (request USB irq fails (submit_retval=%i)., retval);
errn = -EIO;
goto error_out;
}
@@ -698,6 +693,7 @@ static ssize_t mdc800_device_read (struct file *file, char 
__user *buf, size_t l
 {
size_t left=len, sts=len; /* single transfer size */
char __user *ptr = buf;
+   int retval;
 
mutex_lock(mdc800-io_lock);
if (mdc800-state == NOT_CONNECTED)
@@ -737,9 +733,9 @@ static ssize_t mdc800_device_read (struct file *file, char 
__user *buf, size_t l
 
/* Download - Request new bytes */
mdc800-download_urb-dev = mdc800-dev;
-   if (usb_submit_urb (mdc800-download_urb, 
GFP_KERNEL))
-   {
-   err (Can't submit download urb 
(status=%i),mdc800-download_urb-status);
+   retval = usb_submit_urb (mdc800-download_urb, 
GFP_KERNEL);
+   if (retval) {
+   err (Can't submit download urb 
(retval=%i),retval);
mutex_unlock(mdc800-io_lock);
return len-left;
}
@@ -788,6 +784,7 @@ static ssize_t mdc800_device_read (struct file *file, char 
__user *buf, size_t l
 static ssize_t mdc800_device_write (struct file *file, const char __user *buf, 
size_t len, loff_t *pos)
 {
size_t i=0;
+   int retval;
 
mutex_lock(mdc800-io_lock);
if (mdc800-state != READY)
@@ -854,9 +851,9 @@ static ssize_t mdc800_device_write (struct file *file, 
const char __user *buf, s
mdc800-state=WORKING;
memcpy (mdc800-write_urb-transfer_buffer, 
mdc800-in,8);
mdc800-write_urb-dev = mdc800-dev;
-   if (usb_submit_urb (mdc800-write_urb

[linux-usb-devel] [PATCH 27/44] USB: image: microtek: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/image/microtek.c |   19 ++-
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index 51bd80d..768b2c1 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -189,7 +189,7 @@ static struct usb_driver mts_usb_driver = {
 #define MTS_DEBUG_INT() \
do { MTS_DEBUG_GOT_HERE(); \
 MTS_DEBUG(transfer = 0x%x context = 
0x%x\n,(int)transfer,(int)context ); \
-MTS_DEBUG(status = 0x%x data-length = 0x%x sent = 
0x%x\n,(int)transfer-status,(int)context-data_length, 
(int)transfer-actual_length ); \
+MTS_DEBUG(status = 0x%x data-length = 0x%x sent = 
0x%x\n,transfer-status,(int)context-data_length, 
(int)transfer-actual_length ); \
  mts_debug_dump(context-instance);\
   } while(0)
 #else
@@ -393,8 +393,6 @@ void mts_int_submit_urb (struct urb* transfer,
  context
);
 
-   transfer-status = 0;
-
res = usb_submit_urb( transfer, GFP_ATOMIC );
if ( unlikely(res) ) {
MTS_INT_ERROR( could not submit URB! Error was %d\n,(int)res 
);
@@ -444,12 +442,13 @@ static void mts_get_status( struct urb *transfer )
 static void mts_data_done( struct urb* transfer )
 /* Interrupt context! */
 {
+   int status = transfer-status;
MTS_INT_INIT();
 
if ( context-data_length != transfer-actual_length ) {
context-srb-resid = context-data_length - 
transfer-actual_length;
-   } else if ( unlikely(transfer-status) ) {
-   context-srb-result = (transfer-status == -ENOENT ? DID_ABORT 
: DID_ERROR)16;
+   } else if ( unlikely(status) ) {
+   context-srb-result = (status == -ENOENT ? DID_ABORT : 
DID_ERROR)16;
}
 
mts_get_status(transfer);
@@ -461,10 +460,11 @@ static void mts_data_done( struct urb* transfer )
 static void mts_command_done( struct urb *transfer )
 /* Interrupt context! */
 {
+   int status = transfer-status;
MTS_INT_INIT();
 
-   if ( unlikely(transfer-status) ) {
-   if (transfer-status == -ENOENT) {
+   if ( unlikely(status) ) {
+   if (status == -ENOENT) {
/* We are being killed */
MTS_DEBUG_GOT_HERE();
context-srb-result = DID_ABORT16;
@@ -502,12 +502,13 @@ static void mts_command_done( struct urb *transfer )
 static void mts_do_sg (struct urb* transfer)
 {
struct scatterlist * sg;
+   int status = transfer-status;
MTS_INT_INIT();
 
MTS_DEBUG(Processing fragment %d of %d\n, 
context-fragment,context-srb-use_sg);
 
-   if (unlikely(transfer-status)) {
-context-srb-result = (transfer-status == -ENOENT ? 
DID_ABORT : DID_ERROR)16;
+   if (unlikely(status)) {
+context-srb-result = (status == -ENOENT ? DID_ABORT : 
DID_ERROR)16;
mts_transfer_cleanup(transfer);
 }
 
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 28/44] USB: core: message: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/message.c |   34 ++
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 530e854..25f63f1 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -34,13 +34,14 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, 
int *actual_length)
 { 
struct completion done;
unsigned long expire;
-   int status;
+   int retval;
+   int status = urb-status;
 
init_completion(done); 
urb-context = done;
urb-actual_length = 0;
-   status = usb_submit_urb(urb, GFP_NOIO);
-   if (unlikely(status))
+   retval = usb_submit_urb(urb, GFP_NOIO);
+   if (unlikely(retval))
goto out;
 
expire = timeout ? msecs_to_jiffies(timeout) : MAX_SCHEDULE_TIMEOUT;
@@ -55,15 +56,15 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, 
int *actual_length)
urb-transfer_buffer_length);
 
usb_kill_urb(urb);
-   status = urb-status == -ENOENT ? -ETIMEDOUT : urb-status;
+   retval = status == -ENOENT ? -ETIMEDOUT : status;
} else
-   status = urb-status;
+   retval = status;
 out:
if (actual_length)
*actual_length = urb-actual_length;
 
usb_free_urb(urb);
-   return status;
+   return retval;
 }
 
 /*---*/
@@ -250,6 +251,7 @@ static void sg_clean (struct usb_sg_request *io)
 static void sg_complete (struct urb *urb)
 {
struct usb_sg_request   *io = urb-context;
+   int status = urb-status;
 
spin_lock (io-lock);
 
@@ -265,21 +267,21 @@ static void sg_complete (struct urb *urb)
 */
if (io-status
 (io-status != -ECONNRESET
-   || urb-status != -ECONNRESET)
+   || status != -ECONNRESET)
 urb-actual_length) {
dev_err (io-dev-bus-controller,
dev %s ep%d%s scatterlist error %d/%d\n,
io-dev-devpath,
usb_pipeendpoint (urb-pipe),
usb_pipein (urb-pipe) ? in : out,
-   urb-status, io-status);
+   status, io-status);
// BUG ();
}
 
-   if (io-status == 0  urb-status  urb-status != -ECONNRESET) {
-   int i, found, status;
+   if (io-status == 0  status  status != -ECONNRESET) {
+   int i, found, retval;
 
-   io-status = urb-status;
+   io-status = status;
 
/* the previous urbs, and this one, completed already.
 * unlink pending urbs so they won't rx/tx bad data.
@@ -290,13 +292,13 @@ static void sg_complete (struct urb *urb)
if (!io-urbs [i] || !io-urbs [i]-dev)
continue;
if (found) {
-   status = usb_unlink_urb (io-urbs [i]);
-   if (status != -EINPROGRESS
-status != -ENODEV
-status != -EBUSY)
+   retval = usb_unlink_urb (io-urbs [i]);
+   if (retval != -EINPROGRESS 
+   retval != -ENODEV 
+   retval != -EBUSY)
dev_err (io-dev-dev,
%s, unlink -- %d\n,
-   __FUNCTION__, status);
+   __FUNCTION__, retval);
} else if (urb == io-urbs [i])
found = 1;
}
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 29/44] USB: misc: adtux: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/misc/adutux.c |   24 +---
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
index 274d08e..e9fdbc8 100644
--- a/drivers/usb/misc/adutux.c
+++ b/drivers/usb/misc/adutux.c
@@ -179,17 +179,18 @@ static void adu_delete(struct adu_device *dev)
 static void adu_interrupt_in_callback(struct urb *urb)
 {
struct adu_device *dev = urb-context;
+   int status = urb-status;
 
-   dbg(4, %s : enter, status %d, __FUNCTION__, urb-status);
+   dbg(4, %s : enter, status %d, __FUNCTION__, status);
adu_debug_data(5, __FUNCTION__, urb-actual_length,
   urb-transfer_buffer);
 
spin_lock(dev-buflock);
 
-   if (urb-status != 0) {
-   if ((urb-status != -ENOENT)  (urb-status != -ECONNRESET)) {
+   if (status != 0) {
+   if ((status != -ENOENT)  (status != -ECONNRESET)) {
dbg(1, %s : nonzero status received: %d,
-   __FUNCTION__, urb-status);
+   __FUNCTION__, status);
}
goto exit;
}
@@ -217,21 +218,22 @@ exit:
wake_up_interruptible(dev-read_wait);
adu_debug_data(5, __FUNCTION__, urb-actual_length,
   urb-transfer_buffer);
-   dbg(4, %s : leave, status %d, __FUNCTION__, urb-status);
+   dbg(4, %s : leave, status %d, __FUNCTION__, status);
 }
 
 static void adu_interrupt_out_callback(struct urb *urb)
 {
struct adu_device *dev = urb-context;
+   int status = urb-status;
 
-   dbg(4, %s : enter, status %d, __FUNCTION__, urb-status);
+   dbg(4, %s : enter, status %d, __FUNCTION__, status);
adu_debug_data(5,__FUNCTION__, urb-actual_length, 
urb-transfer_buffer);
 
-   if (urb-status != 0) {
-   if ((urb-status != -ENOENT) 
-   (urb-status != -ECONNRESET)) {
+   if (status != 0) {
+   if ((status != -ENOENT) 
+   (status != -ECONNRESET)) {
dbg(1,  %s :nonzero status received: %d,
-   __FUNCTION__, urb-status);
+   __FUNCTION__, status);
}
goto exit;
}
@@ -241,7 +243,7 @@ exit:
 
adu_debug_data(5, __FUNCTION__, urb-actual_length,
   urb-transfer_buffer);
-   dbg(4, %s : leave, status %d, __FUNCTION__, urb-status);
+   dbg(4, %s : leave, status %d, __FUNCTION__, status);
 }
 
 static int adu_open(struct inode *inode, struct file *file)
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 30/44] USB: misc: appledisplay: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/misc/appledisplay.c |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
index cf70c16..b09c835 100644
--- a/drivers/usb/misc/appledisplay.c
+++ b/drivers/usb/misc/appledisplay.c
@@ -88,9 +88,10 @@ static void appledisplay_complete(struct urb *urb)
 {
struct appledisplay *pdata = urb-context;
unsigned long flags;
+   int status = urb-status;
int retval;
 
-   switch (urb-status) {
+   switch (status) {
case 0:
/* success */
break;
@@ -102,12 +103,12 @@ static void appledisplay_complete(struct urb *urb)
case -ENOENT:
case -ESHUTDOWN:
/* This urb is terminated, clean up */
-   dbg(%s - urb shutting down with status: %d,
-   __FUNCTION__, urb-status);
+   dbg(%s - urb shuttingdown with status: %d,
+   __FUNCTION__, status);
return;
default:
dbg(%s - nonzero urb status received: %d,
-   __FUNCTION__, urb-status);
+   __FUNCTION__, status);
goto exit;
}
 
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 31/44] USB: misc: auerswald: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/misc/auerswald.c |   25 +++--
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c
index 42d4e64..df7e1ec 100644
--- a/drivers/usb/misc/auerswald.c
+++ b/drivers/usb/misc/auerswald.c
@@ -862,14 +862,16 @@ static void auerswald_ctrlread_wretcomplete (struct urb * 
urb)
 pauerbuf_t bp = (pauerbuf_t) urb-context;
 pauerswald_t cp;
int ret;
+   int status = urb-status;
+
 dbg (auerswald_ctrlread_wretcomplete called);
-dbg (complete with status: %d, urb-status);
+dbg (complete with status: %d, status);
cp = ((pauerswald_t)((char *)(bp-list)-(unsigned 
long)(((pauerswald_t)0)-bufctl)));
 
/* check if it is possible to advance */
-   if (!auerswald_status_retry (urb-status) || !cp-usbdev) {
+   if (!auerswald_status_retry(status) || !cp-usbdev) {
/* reuse the buffer */
-   err (control dummy: transmission error %d, can not retry, 
urb-status);
+   err (control dummy: transmission error %d, can not retry, 
status);
auerbuf_releasebuf (bp);
/* Wake up all processes waiting for a buffer */
wake_up (cp-bufferwait);
@@ -902,21 +904,23 @@ static void auerswald_ctrlread_complete (struct urb * urb)
 pauerswald_t  cp;
 pauerscon_t   scp;
 pauerbuf_tbp  = (pauerbuf_t) urb-context;
+   int status = urb-status;
int ret;
+
 dbg (auerswald_ctrlread_complete called);
 
cp = ((pauerswald_t)((char *)(bp-list)-(unsigned 
long)(((pauerswald_t)0)-bufctl)));
 
/* check if there is valid data in this urb */
-if (urb-status) {
-   dbg (complete with non-zero status: %d, urb-status);
+if (status) {
+   dbg (complete with non-zero status: %d, status);
/* should we do a retry? */
-   if (!auerswald_status_retry (urb-status)
+   if (!auerswald_status_retry(status)
 || !cp-usbdev
 || (cp-version  AUV_RETRY)
  || (bp-retries = AU_RETRIES)) {
/* reuse the buffer */
-   err (control read: transmission error %d, can not 
retry, urb-status);
+   err (control read: transmission error %d, can not 
retry, status);
auerbuf_releasebuf (bp);
/* Wake up all processes waiting for a buffer */
wake_up (cp-bufferwait);
@@ -974,12 +978,13 @@ static void auerswald_int_complete (struct urb * urb)
 unsigned  int channelid;
 unsigned  int bytecount;
 int ret;
+   int status = urb-status;
 pauerbuf_t   bp = NULL;
 pauerswald_t cp = (pauerswald_t) urb-context;
 
 dbg (%s called, __FUNCTION__);
 
-   switch (urb-status) {
+   switch (status) {
case 0:
/* success */
break;
@@ -987,10 +992,10 @@ static void auerswald_int_complete (struct urb * urb)
case -ENOENT:
case -ESHUTDOWN:
/* this urb is terminated, clean up */
-   dbg(%s - urb shutting down with status: %d, __FUNCTION__, 
urb-status);
+   dbg(%s - urb shutting down with status: %d, __FUNCTION__, 
status);
return;
default:
-   dbg(%s - nonzero urb status received: %d, __FUNCTION__, 
urb-status);
+   dbg(%s - nonzero urb status received: %d, __FUNCTION__, 
status);
goto exit;
}
 
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 32/44] USB: misc: ftdi-elan: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/misc/ftdi-elan.c |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index 7cc6883..538b535 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -747,10 +747,12 @@ static ssize_t ftdi_elan_read(struct file *file, char 
__user *buffer,
 static void ftdi_elan_write_bulk_callback(struct urb *urb)
 {
 struct usb_ftdi *ftdi = (struct usb_ftdi *)urb-context;
-if (urb-status  !(urb-status == -ENOENT || urb-status ==
--ECONNRESET || urb-status == -ESHUTDOWN)) {
+   int status = urb-status;
+
+   if (status  !(status == -ENOENT || status == -ECONNRESET ||
+   status == -ESHUTDOWN)) {
 dev_err(ftdi-udev-dev, urb=%p write bulk status received: 
%
-d\n, urb, urb-status);
+d\n, urb, status);
 }
 usb_buffer_free(urb-dev, urb-transfer_buffer_length,
 urb-transfer_buffer, urb-transfer_dma);
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 33/44] USB: misc: iowarrior: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/misc/iowarrior.c |   21 -
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index 28548d1..46d9f27 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -158,9 +158,10 @@ static void iowarrior_callback(struct urb *urb)
int read_idx;
int aux_idx;
int offset;
-   int status;
+   int status = urb-status;
+   int retval;
 
-   switch (urb-status) {
+   switch (status) {
case 0:
/* success */
break;
@@ -213,10 +214,10 @@ static void iowarrior_callback(struct urb *urb)
wake_up_interruptible(dev-read_wait);
 
 exit:
-   status = usb_submit_urb(urb, GFP_ATOMIC);
-   if (status)
+   retval = usb_submit_urb(urb, GFP_ATOMIC);
+   if (retval)
dev_err(dev-interface-dev, %s - usb_submit_urb failed with 
result %d,
-   __FUNCTION__, status);
+   __FUNCTION__, retval);
 
 }
 
@@ -226,13 +227,15 @@ exit:
 static void iowarrior_write_callback(struct urb *urb)
 {
struct iowarrior *dev;
+   int status = urb-status;
+
dev = (struct iowarrior *)urb-context;
/* sync/async unlink faults aren't errors */
-   if (urb-status 
-   !(urb-status == -ENOENT ||
- urb-status == -ECONNRESET || urb-status == -ESHUTDOWN)) {
+   if (status 
+   !(status == -ENOENT ||
+ status == -ECONNRESET || status == -ESHUTDOWN)) {
dbg(%s - nonzero write bulk status received: %d,
-   __func__, urb-status);
+   __func__, status);
}
/* free up our allocated buffer */
usb_buffer_free(urb-dev, urb-transfer_buffer_length,
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 34/44] USB: misc: ldusb: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/misc/ldusb.c |   20 +++-
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index 5e950b9..8208496 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -219,16 +219,17 @@ static void ld_usb_interrupt_in_callback(struct urb *urb)
struct ld_usb *dev = urb-context;
size_t *actual_buffer;
unsigned int next_ring_head;
+   int status = urb-status;
int retval;
 
-   if (urb-status) {
-   if (urb-status == -ENOENT ||
-   urb-status == -ECONNRESET ||
-   urb-status == -ESHUTDOWN) {
+   if (status) {
+   if (status == -ENOENT ||
+   status == -ECONNRESET ||
+   status == -ESHUTDOWN) {
goto exit;
} else {
dbg_info(dev-intf-dev, %s: nonzero status received: 
%d\n,
-__FUNCTION__, urb-status);
+__FUNCTION__, status);
spin_lock(dev-rbsl);
goto resubmit; /* maybe we can recover */
}
@@ -275,14 +276,15 @@ exit:
 static void ld_usb_interrupt_out_callback(struct urb *urb)
 {
struct ld_usb *dev = urb-context;
+   int status = urb-status;
 
/* sync/async unlink faults aren't errors */
-   if (urb-status  !(urb-status == -ENOENT ||
-urb-status == -ECONNRESET ||
-urb-status == -ESHUTDOWN))
+   if (status  !(status == -ENOENT ||
+   status == -ECONNRESET ||
+   status == -ESHUTDOWN))
dbg_info(dev-intf-dev,
 %s - nonzero write interrupt status received: %d\n,
-__FUNCTION__, urb-status);
+__FUNCTION__, status);
 
dev-interrupt_out_busy = 0;
wake_up_interruptible(dev-write_wait);
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 35/44] USB: misc: legousbtower: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/misc/legousbtower.c |   28 +++-
 1 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index 2ed0dae..561970b 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -742,19 +742,20 @@ exit:
 static void tower_interrupt_in_callback (struct urb *urb)
 {
struct lego_usb_tower *dev = (struct lego_usb_tower *)urb-context;
+   int status = urb-status;
int retval;
 
-   dbg(4, %s: enter, status %d, __FUNCTION__, urb-status);
+   dbg(4, %s: enter, status %d, __FUNCTION__, status);
 
lego_usb_tower_debug_data(5, __FUNCTION__, urb-actual_length, 
urb-transfer_buffer);
 
-   if (urb-status) {
-   if (urb-status == -ENOENT ||
-   urb-status == -ECONNRESET ||
-   urb-status == -ESHUTDOWN) {
+   if (status) {
+   if (status == -ENOENT ||
+   status == -ECONNRESET ||
+   status == -ESHUTDOWN) {
goto exit;
} else {
-   dbg(1, %s: nonzero status received: %d, __FUNCTION__, 
urb-status);
+   dbg(1, %s: nonzero status received: %d, __FUNCTION__, 
status);
goto resubmit; /* maybe we can recover */
}
}
@@ -788,7 +789,7 @@ exit:
wake_up_interruptible (dev-read_wait);
 
lego_usb_tower_debug_data(5, __FUNCTION__, urb-actual_length, 
urb-transfer_buffer);
-   dbg(4, %s: leave, status %d, __FUNCTION__, urb-status);
+   dbg(4, %s: leave, status %d, __FUNCTION__, status);
 }
 
 
@@ -798,23 +799,24 @@ exit:
 static void tower_interrupt_out_callback (struct urb *urb)
 {
struct lego_usb_tower *dev = (struct lego_usb_tower *)urb-context;
+   int status = urb-status;
 
-   dbg(4, %s: enter, status %d, __FUNCTION__, urb-status);
+   dbg(4, %s: enter, status %d, __FUNCTION__, status);
lego_usb_tower_debug_data(5, __FUNCTION__, urb-actual_length, 
urb-transfer_buffer);
 
/* sync/async unlink faults aren't errors */
-   if (urb-status  !(urb-status == -ENOENT ||
-urb-status == -ECONNRESET ||
-urb-status == -ESHUTDOWN)) {
+   if (status  !(status == -ENOENT ||
+   status == -ECONNRESET ||
+   status == -ESHUTDOWN)) {
dbg(1, %s - nonzero write bulk status received: %d,
-   __FUNCTION__, urb-status);
+   __FUNCTION__, status);
}
 
dev-interrupt_out_busy = 0;
wake_up_interruptible(dev-write_wait);
 
lego_usb_tower_debug_data(5, __FUNCTION__, urb-actual_length, 
urb-transfer_buffer);
-   dbg(4, %s: leave, status %d, __FUNCTION__, urb-status);
+   dbg(4, %s: leave, status %d, __FUNCTION__, status);
 }
 
 
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 44/44] USB: drivers/usb/storage/dpcm.c whitespace cleanup

2007-07-19 Thread Greg Kroah-Hartman
From: S.Caglar Onur [EMAIL PROTECTED]

Following trivial patch converts smarttabs/whitespaces into real tabs.

Signed-off-by: S.Caglar Onur [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/storage/dpcm.c |   56 ++--
 1 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/usb/storage/dpcm.c b/drivers/usb/storage/dpcm.c
index 1628cb2..9a410b5 100644
--- a/drivers/usb/storage/dpcm.c
+++ b/drivers/usb/storage/dpcm.c
@@ -46,43 +46,43 @@
  */
 int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us)
 {
-  int ret;
+   int ret;
 
-  if(srb == NULL)
-return USB_STOR_TRANSPORT_ERROR;
+   if (srb == NULL)
+   return USB_STOR_TRANSPORT_ERROR;
 
-  US_DEBUGP(dpcm_transport: LUN=%d\n, srb-device-lun);
+   US_DEBUGP(dpcm_transport: LUN=%d\n, srb-device-lun);
 
-  switch(srb-device-lun) {
-  case 0:
+   switch (srb-device-lun) {
+   case 0:
 
-/*
- * LUN 0 corresponds to the CompactFlash card reader.
- */
-ret = usb_stor_CB_transport(srb, us);
-break;
+   /*
+* LUN 0 corresponds to the CompactFlash card reader.
+*/
+   ret = usb_stor_CB_transport(srb, us);
+   break;
 
 #ifdef CONFIG_USB_STORAGE_SDDR09
-  case 1:
+   case 1:
 
-/*
- * LUN 1 corresponds to the SmartMedia card reader.
- */
+   /*
+* LUN 1 corresponds to the SmartMedia card reader.
+*/
 
-/*
- * Set the LUN to 0 (just in case).
- */
-srb-device-lun = 0; us-srb-device-lun = 0;
-ret = sddr09_transport(srb, us);
-srb-device-lun = 1; us-srb-device-lun = 1;
-break;
+   /*
+* Set the LUN to 0 (just in case).
+*/
+   srb-device-lun = 0; us-srb-device-lun = 0;
+   ret = sddr09_transport(srb, us);
+   srb-device-lun = 1; us-srb-device-lun = 1;
+   break;
 
 #endif
 
-  default:
-US_DEBUGP(dpcm_transport: Invalid LUN %d\n, srb-device-lun);
-ret = USB_STOR_TRANSPORT_ERROR;
-break;
-  }
-  return ret;
+   default:
+   US_DEBUGP(dpcm_transport: Invalid LUN %d\n, 
srb-device-lun);
+   ret = USB_STOR_TRANSPORT_ERROR;
+   break;
+   }
+   return ret;
 }
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 38/44] USB: misc: usblcd: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/misc/usblcd.c |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index 504f722..7198420 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -176,16 +176,17 @@ static int lcd_ioctl(struct inode *inode, struct file 
*file, unsigned int cmd, u
 static void lcd_write_bulk_callback(struct urb *urb)
 {
struct usb_lcd *dev;
+   int status = urb-status;
 
dev = (struct usb_lcd *)urb-context;
 
/* sync/async unlink faults aren't errors */
-   if (urb-status 
-   !(urb-status == -ENOENT ||
- urb-status == -ECONNRESET ||
-  urb-status == -ESHUTDOWN)) {
+   if (status 
+   !(status == -ENOENT ||
+ status == -ECONNRESET ||
+  status == -ESHUTDOWN)) {
dbg(USBLCD: %s - nonzero write bulk status received: %d,
-   __FUNCTION__, urb-status);
+   __FUNCTION__, status);
}
 
/* free up our allocated buffer */
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 37/44] USB: misc: phidgetmotorcontrol: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/misc/phidgetmotorcontrol.c |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/misc/phidgetmotorcontrol.c 
b/drivers/usb/misc/phidgetmotorcontrol.c
index 5727e1e..df0ebcd 100644
--- a/drivers/usb/misc/phidgetmotorcontrol.c
+++ b/drivers/usb/misc/phidgetmotorcontrol.c
@@ -95,9 +95,10 @@ static void motorcontrol_irq(struct urb *urb)
struct motorcontrol *mc = urb-context;
unsigned char *buffer = mc-data;
int i, level;
-   int status;
+   int retval;
+   int status = urb-status;;
 
-   switch (urb-status) {
+   switch (status) {
case 0: /* success */
break;
case -ECONNRESET:   /* unlink */
@@ -151,12 +152,12 @@ static void motorcontrol_irq(struct urb *urb)
schedule_delayed_work(mc-do_notify, 0);
 
 resubmit:
-   status = usb_submit_urb(urb, GFP_ATOMIC);
-   if (status)
+   retval = usb_submit_urb(urb, GFP_ATOMIC);
+   if (retval)
dev_err(mc-intf-dev,
-   can't resubmit intr, %s-%s/motorcontrol0, status %d,
+   can't resubmit intr, %s-%s/motorcontrol0, retval %d,
mc-udev-bus-bus_name,
-   mc-udev-devpath, status);
+   mc-udev-devpath, retval);
 }
 
 static void do_notify(struct work_struct *work)
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 36/44] USB: misc: phidgetkit: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/misc/phidgetkit.c |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/misc/phidgetkit.c b/drivers/usb/misc/phidgetkit.c
index 371bf2b..aa9bcce 100644
--- a/drivers/usb/misc/phidgetkit.c
+++ b/drivers/usb/misc/phidgetkit.c
@@ -305,9 +305,10 @@ static void interfacekit_irq(struct urb *urb)
struct interfacekit *kit = urb-context;
unsigned char *buffer = kit-data;
int i, level, sensor;
-   int status;
+   int retval;
+   int status = urb-status;
 
-   switch (urb-status) {
+   switch (status) {
case 0: /* success */
break;
case -ECONNRESET:   /* unlink */
@@ -377,11 +378,11 @@ static void interfacekit_irq(struct urb *urb)
schedule_delayed_work(kit-do_notify, 0);
 
 resubmit:
-   status = usb_submit_urb(urb, GFP_ATOMIC);
-   if (status)
-   err(can't resubmit intr, %s-%s/interfacekit0, status %d,
+   retval = usb_submit_urb(urb, GFP_ATOMIC);
+   if (retval)
+   err(can't resubmit intr, %s-%s/interfacekit0, retval %d,
kit-udev-bus-bus_name,
-   kit-udev-devpath, status);
+   kit-udev-devpath, retval);
 }
 
 static void do_notify(struct work_struct *work)
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 39/44] USB: misc: usbtest: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/misc/usbtest.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index fb32186..e901d31 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -768,8 +768,8 @@ static void ctrl_complete (struct urb *urb)
 
/* some faults are allowed, not required */
if (subcase-expected  0  (
- ((urb-status == -subcase-expected   /* happened */
-  || urb-status == 0  /* didn't */
+ ((status == -subcase-expected/* happened */
+  || status == 0   /* didn't */
status = 0;
/* sometimes more than one fault is allowed */
else if (subcase-number == 12  status == -EPIPE)
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 40/44] USB: misc: uss720: clean up urb-status usage

2007-07-19 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/misc/uss720.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
index 1a60f9c..2734fe2 100644
--- a/drivers/usb/misc/uss720.c
+++ b/drivers/usb/misc/uss720.c
@@ -111,12 +111,13 @@ static void async_complete(struct urb *urb)
struct uss720_async_request *rq;
struct parport *pp;
struct parport_uss720_private *priv;
+   int status = urb-status;
 
rq = urb-context;
priv = rq-priv;
pp = priv-pp;
-   if (urb-status) {
-   err(async_complete: urb error %d, urb-status);
+   if (status) {
+   err(async_complete: urb error %d, status);
} else if (rq-dr.bRequest == 3) {
memcpy(priv-reg, rq-reg, sizeof(priv-reg));
 #if 0
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 41/44] USB: move routines in hcd.c

2007-07-19 Thread Greg Kroah-Hartman
From: Alan Stern [EMAIL PROTECTED]

This patch (as939) moves a couple of routine in hcd.c around.  The
purpose is to put all the general URB- and endpoint-related routines
(submit, unlink, giveback, and disable) together in one spot.

There are no functional changes.

Signed-off-by: Alan Stern [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/hcd.c |   82 
 1 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 963520f..032b118 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1033,18 +1033,6 @@ done:
 
 /*-*/
 
-/* called in any context */
-int usb_hcd_get_frame_number (struct usb_device *udev)
-{
-   struct usb_hcd  *hcd = bus_to_hcd(udev-bus);
-
-   if (!HC_IS_RUNNING (hcd-state))
-   return -ESHUTDOWN;
-   return hcd-driver-get_frame_number (hcd);
-}
-
-/*-*/
-
 /* this makes the hcd giveback() the urb more quickly, by kicking it
  * off hardware queues (which may take a while) and returning it as
  * soon as practical.  we've already set up the urb's return status,
@@ -1167,6 +1155,35 @@ done:
 
 /*-*/
 
+/**
+ * usb_hcd_giveback_urb - return URB from HCD to device driver
+ * @hcd: host controller returning the URB
+ * @urb: urb being returned to the USB device driver.
+ * Context: in_interrupt()
+ *
+ * This hands the URB from HCD to its USB device driver, using its
+ * completion function.  The HCD has freed all per-urb resources
+ * (and is done using urb-hcpriv).  It also released all HCD locks;
+ * the device driver won't cause problems if it frees, modifies,
+ * or resubmits this URB.
+ */
+void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb)
+{
+   urb_unlink(hcd, urb);
+   usbmon_urb_complete (hcd-self, urb);
+   usb_unanchor_urb(urb);
+
+   /* pass ownership to the completion handler */
+   urb-complete (urb);
+   atomic_dec (urb-use_count);
+   if (unlikely (urb-reject))
+   wake_up (usb_kill_urb_queue);
+   usb_put_urb (urb);
+}
+EXPORT_SYMBOL (usb_hcd_giveback_urb);
+
+/*-*/
+
 /* disables the endpoint: cancels any pending urbs, then synchronizes with
  * the hcd to make sure all endpoint state is gone from hardware, and then
  * waits until the endpoint's queue is completely drained. use for
@@ -1260,6 +1277,18 @@ rescan:
 
 /*-*/
 
+/* called in any context */
+int usb_hcd_get_frame_number (struct usb_device *udev)
+{
+   struct usb_hcd  *hcd = bus_to_hcd(udev-bus);
+
+   if (!HC_IS_RUNNING (hcd-state))
+   return -ESHUTDOWN;
+   return hcd-driver-get_frame_number (hcd);
+}
+
+/*-*/
+
 #ifdef CONFIG_PM
 
 int hcd_bus_suspend(struct usb_device *rhdev)
@@ -1395,35 +1424,6 @@ EXPORT_SYMBOL (usb_bus_start_enum);
 /*-*/
 
 /**
- * usb_hcd_giveback_urb - return URB from HCD to device driver
- * @hcd: host controller returning the URB
- * @urb: urb being returned to the USB device driver.
- * Context: in_interrupt()
- *
- * This hands the URB from HCD to its USB device driver, using its
- * completion function.  The HCD has freed all per-urb resources
- * (and is done using urb-hcpriv).  It also released all HCD locks;
- * the device driver won't cause problems if it frees, modifies,
- * or resubmits this URB.
- */
-void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb)
-{
-   urb_unlink(hcd, urb);
-   usbmon_urb_complete (hcd-self, urb);
-   usb_unanchor_urb(urb);
-
-   /* pass ownership to the completion handler */
-   urb-complete (urb);
-   atomic_dec (urb-use_count);
-   if (unlikely (urb-reject))
-   wake_up (usb_kill_urb_queue);
-   usb_put_urb (urb);
-}
-EXPORT_SYMBOL (usb_hcd_giveback_urb);
-
-/*-*/
-
-/**
  * usb_hcd_irq - hook IRQs to HCD framework (bus glue)
  * @irq: the IRQ being raised
  * @__hcd: pointer to the HCD whose IRQ is being signaled
-- 
1.5.2.2


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 42/44] USB: change name of spinlock in hcd.c

2007-07-19 Thread Greg Kroah-Hartman
From: Alan Stern [EMAIL PROTECTED]

This patch (as940 renames hcd_data_lock in hcd.c to hcd_urb_list_lock,
which is more descriptive of the lock's job.  It also introduces a
convenient inline routine for testing whether a particular USB device
is a root hub.

Signed-off-by: Alan Stern [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/hcd.c |   49 +--
 1 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 032b118..42ef1d5 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -99,12 +99,17 @@ EXPORT_SYMBOL_GPL (usb_bus_list_lock);
 /* used for controlling access to virtual root hubs */
 static DEFINE_SPINLOCK(hcd_root_hub_lock);
 
-/* used when updating hcd data */
-static DEFINE_SPINLOCK(hcd_data_lock);
+/* used when updating an endpoint's URB list */
+static DEFINE_SPINLOCK(hcd_urb_list_lock);
 
 /* wait queue for synchronous unlinks */
 DECLARE_WAIT_QUEUE_HEAD(usb_kill_urb_queue);
 
+static inline int is_root_hub(struct usb_device *udev)
+{
+   return (udev-parent == NULL);
+}
+
 /*-*/
 
 /*
@@ -906,14 +911,13 @@ EXPORT_SYMBOL (usb_calc_bus_time);
 static void urb_unlink(struct usb_hcd *hcd, struct urb *urb)
 {
unsigned long   flags;
-   int at_root_hub = (urb-dev == hcd-self.root_hub);
 
/* clear all state linking urb to this dev (and hcd) */
-   spin_lock_irqsave (hcd_data_lock, flags);
+   spin_lock_irqsave(hcd_urb_list_lock, flags);
list_del_init (urb-urb_list);
-   spin_unlock_irqrestore (hcd_data_lock, flags);
+   spin_unlock_irqrestore(hcd_urb_list_lock, flags);
 
-   if (hcd-self.uses_dma  !at_root_hub) {
+   if (hcd-self.uses_dma  !is_root_hub(urb-dev)) {
if (usb_pipecontrol (urb-pipe)
 !(urb-transfer_flags  URB_NO_SETUP_DMA_MAP))
dma_unmap_single (hcd-self.controller, urb-setup_dma,
@@ -955,7 +959,7 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags)
 
// FIXME:  verify that quiescing hc works right (RH cleans up)
 
-   spin_lock_irqsave (hcd_data_lock, flags);
+   spin_lock_irqsave(hcd_urb_list_lock, flags);
ep = (usb_pipein(urb-pipe) ? urb-dev-ep_in : urb-dev-ep_out)
[usb_pipeendpoint(urb-pipe)];
if (unlikely (!ep))
@@ -972,7 +976,7 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags)
status = -ESHUTDOWN;
break;
}
-   spin_unlock_irqrestore (hcd_data_lock, flags);
+   spin_unlock_irqrestore(hcd_urb_list_lock, flags);
if (status) {
INIT_LIST_HEAD (urb-urb_list);
usbmon_urb_submit_error(hcd-self, urb, status);
@@ -986,7 +990,7 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags)
urb = usb_get_urb (urb);
atomic_inc (urb-use_count);
 
-   if (urb-dev == hcd-self.root_hub) {
+   if (is_root_hub(urb-dev)) {
/* NOTE:  requirement on hub callers (usbfs and the hub
 * driver, for now) that URBs' urb-transfer_buffer be
 * valid and usb_buffer_{sync,unmap}() not be needed, since
@@ -1043,7 +1047,7 @@ unlink1 (struct usb_hcd *hcd, struct urb *urb)
 {
int value;
 
-   if (urb-dev == hcd-self.root_hub)
+   if (is_root_hub(urb-dev))
value = usb_rh_urb_dequeue (hcd, urb);
else {
 
@@ -1091,11 +1095,11 @@ int usb_hcd_unlink_urb (struct urb *urb, int status)
 * that it was submitted.  But as a rule it can't know whether or
 * not it's already been unlinked ... so we respect the reversed
 * lock sequence needed for the usb_hcd_giveback_urb() code paths
-* (urb lock, then hcd_data_lock) in case some other CPU is now
+* (urb lock, then hcd_urb_list_lock) in case some other CPU is now
 * unlinking it.
 */
spin_lock_irqsave (urb-lock, flags);
-   spin_lock (hcd_data_lock);
+   spin_lock(hcd_urb_list_lock);
 
sys = urb-dev-dev;
hcd = bus_to_hcd(urb-dev-bus);
@@ -1127,17 +1131,16 @@ int usb_hcd_unlink_urb (struct urb *urb, int status)
 * finish unlinking the initial failed usb_set_address()
 * or device descriptor fetch.
 */
-   if (!test_bit(HCD_FLAG_SAW_IRQ, hcd-flags)
-hcd-self.root_hub != urb-dev) {
+   if (!test_bit(HCD_FLAG_SAW_IRQ, hcd-flags) 
+   !is_root_hub(urb-dev)) {
dev_warn (hcd-self.controller, Unlink after no-IRQ?  
-   Controller is probably using the wrong IRQ.
-   \n);
+   Controller is probably using the wrong IRQ.\n);
set_bit(HCD_FLAG_SAW_IRQ, hcd-flags);
}
 
urb-status = status

[linux-usb-devel] [PATCH 43/44] USB: r8a66597-hcd: fixes some problem

2007-07-19 Thread Greg Kroah-Hartman
From: Yoshihiro Shimoda [EMAIL PROTECTED]

This patch incorporates some updates. Updates include:

 - Fix the problem that control transfer might fail
 - Change from GFP_KERNEL to GFP_ATOMIC
 - Clean up some coding style issue

Signed-off-by: Yoshihiro Shimoda [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/host/r8a66597-hcd.c |  110 +++
 drivers/usb/host/r8a66597.h |   87 +++
 2 files changed, 96 insertions(+), 101 deletions(-)

diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index a7a7070..d60f198 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -35,10 +35,8 @@
 #include linux/interrupt.h
 #include linux/usb.h
 #include linux/platform_device.h
-
-#include asm/io.h
-#include asm/irq.h
-#include asm/system.h
+#include linux/io.h
+#include linux/irq.h
 
 #include ../core/hcd.h
 #include r8a66597.h
@@ -54,16 +52,21 @@ static const char hcd_name[] = r8a66597_hcd;
 /* module parameters */
 static unsigned short clock = XTAL12;
 module_param(clock, ushort, 0644);
-MODULE_PARM_DESC(clock, input clock: 48MHz=32768, 24MHz=16384, 
12MHz=0(default=0));
+MODULE_PARM_DESC(clock, input clock: 48MHz=32768, 24MHz=16384, 12MHz=0 
+   (default=0));
+
 static unsigned short vif = LDRV;
 module_param(vif, ushort, 0644);
 MODULE_PARM_DESC(vif, input VIF: 3.3V=32768, 1.5V=0(default=32768));
-static unsigned short endian = 0;
+
+static unsigned short endian;
 module_param(endian, ushort, 0644);
-MODULE_PARM_DESC(endian, data endian: big=256, little=0(default=0));
+MODULE_PARM_DESC(endian, data endian: big=256, little=0 (default=0));
+
 static unsigned short irq_sense = INTL;
 module_param(irq_sense, ushort, 0644);
-MODULE_PARM_DESC(irq_sense, IRQ sense: low level=32, falling 
edge=0(default=32));
+MODULE_PARM_DESC(irq_sense, IRQ sense: low level=32, falling edge=0 
+   (default=32));
 
 static void packet_write(struct r8a66597 *r8a66597, u16 pipenum);
 static int r8a66597_get_frame(struct usb_hcd *hcd);
@@ -308,7 +311,7 @@ static int make_r8a66597_device(struct r8a66597 *r8a66597,
struct r8a66597_device *dev;
int usb_address = urb-setup_packet[2]; /* urb-pipe is address 0 */
 
-   dev = kzalloc(sizeof(struct r8a66597_device), GFP_KERNEL);
+   dev = kzalloc(sizeof(struct r8a66597_device), GFP_ATOMIC);
if (dev == NULL)
return -ENOMEM;
 
@@ -611,33 +614,33 @@ static u16 get_empty_pipenum(struct r8a66597 *r8a66597,
u16 array[R8A66597_MAX_NUM_PIPE], i = 0, min;
 
memset(array, 0, sizeof(array));
-switch(ep-bmAttributes  USB_ENDPOINT_XFERTYPE_MASK) {
-case USB_ENDPOINT_XFER_BULK:
+   switch (ep-bmAttributes  USB_ENDPOINT_XFERTYPE_MASK) {
+   case USB_ENDPOINT_XFER_BULK:
if (ep-bEndpointAddress  USB_ENDPOINT_DIR_MASK)
array[i++] = 4;
else {
array[i++] = 3;
array[i++] = 5;
}
-break;
-case USB_ENDPOINT_XFER_INT:
+   break;
+   case USB_ENDPOINT_XFER_INT:
if (ep-bEndpointAddress  USB_ENDPOINT_DIR_MASK) {
array[i++] = 6;
array[i++] = 7;
array[i++] = 8;
} else
array[i++] = 9;
-break;
-case USB_ENDPOINT_XFER_ISOC:
+   break;
+   case USB_ENDPOINT_XFER_ISOC:
if (ep-bEndpointAddress  USB_ENDPOINT_DIR_MASK)
array[i++] = 2;
else
array[i++] = 1;
-break;
-default:
-err(Illegal type);
-return 0;
-}
+   break;
+   default:
+   err(Illegal type);
+   return 0;
+   }
 
i = 1;
min = array[0];
@@ -654,7 +657,7 @@ static u16 get_r8a66597_type(__u8 type)
 {
u16 r8a66597_type;
 
-   switch(type) {
+   switch (type) {
case USB_ENDPOINT_XFER_BULK:
r8a66597_type = R8A66597_BULK;
break;
@@ -874,7 +877,7 @@ static void r8a66597_usb_preconnect(struct r8a66597 
*r8a66597, int port)
 {
r8a66597-root_hub[port].port |= (1  USB_PORT_FEAT_CONNECTION)
 | (1  USB_PORT_FEAT_C_CONNECTION);
-   r8a66597_write(r8a66597, (u16)~DTCH, get_intsts_reg(port));
+   r8a66597_write(r8a66597, ~DTCH, get_intsts_reg(port));
r8a66597_bset(r8a66597, DTCHE, get_intenb_reg(port));
 }
 
@@ -917,7 +920,7 @@ static void prepare_setup_packet(struct r8a66597 *r8a66597,
 
r8a66597_write(r8a66597, make_devsel(td-address) | td-maxpacket,
   DCPMAXP);
-   r8a66597_write(r8a66597, (u16)~(SIGN | SACK), INTSTS1);
+   r8a66597_write(r8a66597

[linux-usb-devel] [PATCH 127/149] USB: fix gregkh-usb-usb-use-menuconfig-objects

2007-07-12 Thread Greg Kroah-Hartman
From: Jan Engelhardt [EMAIL PROTECTED]

Generally, Jens Axboe was against 'default y', so I'll have some patches to
remove it.

Cc: Jens Axboe [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/Kconfig |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 071b967..172a606 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -5,7 +5,6 @@
 menuconfig USB_SUPPORT
bool USB support
depends on HAS_IOMEM
-   default y
 
 if USB_SUPPORT
 
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 128/149] USB: drivers/block/ub.c: use list_for_each_entry()

2007-07-12 Thread Greg Kroah-Hartman
From: Matthias Kaehlcke [EMAIL PROTECTED]

Low performance USB storage driver: Use list_for_each_entry() instead
of list_for_each()

Signed-off-by: Matthias Kaehlcke [EMAIL PROTECTED]
Cc: Pete Zaitcev [EMAIL PROTECTED]
Cc: Jens Axboe [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/block/ub.c |   12 +++-
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 746a118..18c8b6c 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -1547,10 +1547,8 @@ static void ub_reset_enter(struct ub_dev *sc, int try)
 #endif
 
 #if 0 /* We let them stop themselves. */
-   struct list_head *p;
struct ub_lun *lun;
-   list_for_each(p, sc-luns) {
-   lun = list_entry(p, struct ub_lun, link);
+   list_for_each_entry(lun, sc-luns, link) {
blk_stop_queue(lun-disk-queue);
}
 #endif
@@ -1562,7 +1560,6 @@ static void ub_reset_task(struct work_struct *work)
 {
struct ub_dev *sc = container_of(work, struct ub_dev, reset_work);
unsigned long flags;
-   struct list_head *p;
struct ub_lun *lun;
int lkr, rc;
 
@@ -1608,8 +1605,7 @@ static void ub_reset_task(struct work_struct *work)
spin_lock_irqsave(sc-lock, flags);
sc-reset = 0;
tasklet_schedule(sc-tasklet);
-   list_for_each(p, sc-luns) {
-   lun = list_entry(p, struct ub_lun, link);
+   list_for_each_entry(lun, sc-luns, link) {
blk_start_queue(lun-disk-queue);
}
wake_up(sc-reset_wait);
@@ -2348,7 +2344,6 @@ err_alloc:
 static void ub_disconnect(struct usb_interface *intf)
 {
struct ub_dev *sc = usb_get_intfdata(intf);
-   struct list_head *p;
struct ub_lun *lun;
unsigned long flags;
 
@@ -2403,8 +2398,7 @@ static void ub_disconnect(struct usb_interface *intf)
/*
 * Unregister the upper layer.
 */
-   list_for_each (p, sc-luns) {
-   lun = list_entry(p, struct ub_lun, link);
+   list_for_each_entry(lun, sc-luns, link) {
del_gendisk(lun-disk);
/*
 * I wish I could do:
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 136/149] USB: remove Makefile reference to obsolete OHCI_AT91

2007-07-12 Thread Greg Kroah-Hartman
From: Robert P. J. Day [EMAIL PROTECTED]

Signed-off-by: Robert P. J. Day [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/Makefile |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index b33aae5..befff5f 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -15,7 +15,6 @@ obj-$(CONFIG_USB_OHCI_HCD)+= host/
 obj-$(CONFIG_USB_UHCI_HCD) += host/
 obj-$(CONFIG_USB_SL811_HCD)+= host/
 obj-$(CONFIG_USB_U132_HCD) += host/
-obj-$(CONFIG_USB_OHCI_AT91)+= host/
 obj-$(CONFIG_USB_R8A66597_HCD) += host/
 
 obj-$(CONFIG_USB_ACM)  += class/
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 138/149] USB: usb/dma doc updates

2007-07-12 Thread Greg Kroah-Hartman
From: David Brownell [EMAIL PROTECTED]

This patch updates some of the documentation about DMA buffer management
for USB, and ways to avoid extra copying.  Our understanding of the issues
has improved over time.

 - Most drivers should *avoid* the dma-coherent allocators.  There are
   a few exceptions (like the HID driver).

 - Some methods are currently commented out; it seems folk writing
   USB drivers aren't doing performance tuning at that level yet.

 - Just avoid highmem; there's no good way to pass an I can do highmem
   DMA capability through a driver stack.  This is easy, everything
   already avoids highmem.  But it'd be nice if x86_32 systems with much
   physical memory could use it directly with network adapters and mass
   storage devices.  (Patch, anyone?)

Signed-off-by: David Brownell [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 Documentation/usb/dma.txt |   52 -
 drivers/usb/core/usb.c|   11 +
 2 files changed, 43 insertions(+), 20 deletions(-)

diff --git a/Documentation/usb/dma.txt b/Documentation/usb/dma.txt
index 62844ae..e8b50b7 100644
--- a/Documentation/usb/dma.txt
+++ b/Documentation/usb/dma.txt
@@ -32,12 +32,15 @@ ELIMINATING COPIES
 It's good to avoid making CPUs copy data needlessly.  The costs can add up,
 and effects like cache-trashing can impose subtle penalties.
 
-- When you're allocating a buffer for DMA purposes anyway, use the buffer
-  primitives.  Think of them as kmalloc and kfree that give you the right
-  kind of addresses to store in urb-transfer_buffer and urb-transfer_dma,
-  while guaranteeing that no hidden copies through DMA bounce buffers will
-  slow things down.  You'd also set URB_NO_TRANSFER_DMA_MAP in
-  urb-transfer_flags:
+- If you're doing lots of small data transfers from the same buffer all
+  the time, that can really burn up resources on systems which use an
+  IOMMU to manage the DMA mappings.  It can cost MUCH more to set up and
+  tear down the IOMMU mappings with each request than perform the I/O!
+
+  For those specific cases, USB has primitives to allocate less expensive
+  memory.  They work like kmalloc and kfree versions that give you the right
+  kind of addresses to store in urb-transfer_buffer and urb-transfer_dma.
+  You'd also set URB_NO_TRANSFER_DMA_MAP in urb-transfer_flags:
 
void *usb_buffer_alloc (struct usb_device *dev, size_t size,
int mem_flags, dma_addr_t *dma);
@@ -45,6 +48,10 @@ and effects like cache-trashing can impose subtle penalties.
void usb_buffer_free (struct usb_device *dev, size_t size,
void *addr, dma_addr_t dma);
 
+  Most drivers should *NOT* be using these primitives; they don't need
+  to use this type of memory (dma-coherent), and memory returned from
+  kmalloc() will work just fine.
+
   For control transfers you can use the buffer primitives or not for each
   of the transfer buffer and setup buffer independently.  Set the flag bits
   URB_NO_TRANSFER_DMA_MAP and URB_NO_SETUP_DMA_MAP to indicate which
@@ -54,29 +61,39 @@ and effects like cache-trashing can impose subtle penalties.
   The memory buffer returned is dma-coherent; sometimes you might need to
   force a consistent memory access ordering by using memory barriers.  It's
   not using a streaming DMA mapping, so it's good for small transfers on
-  systems where the I/O would otherwise tie up an IOMMU mapping.  (See
+  systems where the I/O would otherwise thrash an IOMMU mapping.  (See
   Documentation/DMA-mapping.txt for definitions of coherent and streaming
   DMA mappings.)
 
   Asking for 1/Nth of a page (as well as asking for N pages) is reasonably
   space-efficient.
 
+  On most systems the memory returned will be uncached, because the
+  semantics of dma-coherent memory require either bypassing CPU caches
+  or using cache hardware with bus-snooping support.  While x86 hardware
+  has such bus-snooping, many other systems use software to flush cache
+  lines to prevent DMA conflicts.
+
 - Devices on some EHCI controllers could handle DMA to/from high memory.
-  Driver probe() routines can notice this using a generic DMA call, then
-  tell higher level code (network, scsi, etc) about it like this:
 
-   if (dma_supported (intf-dev, 0xULL))
-   net-features |= NETIF_F_HIGHDMA;
+  Unfortunately, the current Linux DMA infrastructure doesn't have a sane
+  way to expose these capabilities ... and in any case, HIGHMEM is mostly a
+  design wart specific to x86_32.  So your best bet is to ensure you never
+  pass a highmem buffer into a USB driver.  That's easy; it's the default
+  behavior.  Just don't override it; e.g. with NETIF_F_HIGHDMA.
 
-  That can eliminate dma bounce buffering of requests that originate (or
-  terminate) in high memory, in cases where the buffers aren't allocated
-  with usb_buffer_alloc() but instead are dma-mapped.
+  This may force your callers

[linux-usb-devel] [PATCH 149/149] USB: ohci-pnx4008: Remove unnecessary cast of return value of kzalloc

2007-07-12 Thread Greg Kroah-Hartman
From: Suresh Jayaraman [EMAIL PROTECTED]

Remove unnecessary cast of return value of kzalloc() in
usb/host/ohci-pnx4008.c

Signed-off-by: Suresh Jayaraman [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/host/ohci-pnx4008.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c
index d601bbb..ca2a6ab 100644
--- a/drivers/usb/host/ohci-pnx4008.c
+++ b/drivers/usb/host/ohci-pnx4008.c
@@ -134,7 +134,7 @@ static int isp1301_attach(struct i2c_adapter *adap, int 
addr, int kind)
 {
struct i2c_client *c;
 
-   c = (struct i2c_client *)kzalloc(sizeof(*c), GFP_KERNEL);
+   c = kzalloc(sizeof(*c), GFP_KERNEL);
 
if (!c)
return -ENOMEM;
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 148/149] USB: additions to the quirk list

2007-07-12 Thread Greg Kroah-Hartman
From: Oliver Neukum [EMAIL PROTECTED]

this adds some scanners reported to be crashed by autosuspend to
the quirk list.

Signed-off-by: Oliver Neukum [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/quirks.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index a0fd68b..aa21b38 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -30,12 +30,20 @@
 static const struct usb_device_id usb_quirk_list[] = {
/* HP 5300/5370C scanner */
{ USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 
},
+   /* Benq S2W 3300U */
+   { USB_DEVICE(0x04a5, 0x20b0), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+   /* Seiko Epson Corp. Perfection 1200 */
+   { USB_DEVICE(0x04b8, 0x0104), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Seiko Epson Corp - Perfection 1670 */
{ USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Samsung ML-2510 Series printer */
{ USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Elsa MicroLink 56k (V.250) */
{ USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+   /* Ultima Electronics Corp.*/
+   { USB_DEVICE(0x05d8, 0x4005), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+   /* Umax [hex] Astra 3400U */
+   { USB_DEVICE(0x1606, 0x0060), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
 
/* Philips PSC805 audio device */
{ USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME },
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 147/149] usb-storage: implement autosuspend

2007-07-12 Thread Greg Kroah-Hartman
From: Alan Stern [EMAIL PROTECTED]

This patch (as930) implements autosuspend for usb-storage.  It is
adapted from a patch by Oliver Neukum.  Autosuspend is allowed except
during LUN scanning, resets, and command execution.

Signed-off-by: Alan Stern [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/storage/scsiglue.c |   13 +
 drivers/usb/storage/usb.c  |   27 ---
 2 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 1ba19ea..47e5607 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -285,10 +285,15 @@ static int device_reset(struct scsi_cmnd *srb)
 
US_DEBUGP(%s called\n, __FUNCTION__);
 
-   /* lock the device pointers and do the reset */
-   mutex_lock((us-dev_mutex));
-   result = us-transport_reset(us);
-   mutex_unlock(us-dev_mutex);
+   result = usb_autopm_get_interface(us-pusb_intf);
+   if (result == 0) {
+
+   /* lock the device pointers and do the reset */
+   mutex_lock((us-dev_mutex));
+   result = us-transport_reset(us);
+   mutex_unlock(us-dev_mutex);
+   usb_autopm_put_interface(us-pusb_intf);
+   }
 
return result  0 ? FAILED : SUCCESS;
 }
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index cf3fc91..bef8bcd 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -191,16 +191,14 @@ static int storage_suspend(struct usb_interface *iface, 
pm_message_t message)
 {
struct us_data *us = usb_get_intfdata(iface);
 
+   US_DEBUGP(%s\n, __FUNCTION__);
+
/* Wait until no command is running */
mutex_lock(us-dev_mutex);
 
-   US_DEBUGP(%s\n, __FUNCTION__);
if (us-suspend_resume_hook)
(us-suspend_resume_hook)(us, US_SUSPEND);
 
-   /* When runtime PM is working, we'll set a flag to indicate
-* whether we should autoresume when a SCSI request arrives. */
-
mutex_unlock(us-dev_mutex);
return 0;
 }
@@ -209,13 +207,11 @@ static int storage_resume(struct usb_interface *iface)
 {
struct us_data *us = usb_get_intfdata(iface);
 
-   mutex_lock(us-dev_mutex);
-
US_DEBUGP(%s\n, __FUNCTION__);
+
if (us-suspend_resume_hook)
(us-suspend_resume_hook)(us, US_RESUME);
 
-   mutex_unlock(us-dev_mutex);
return 0;
 }
 
@@ -313,6 +309,7 @@ static int usb_stor_control_thread(void * __us)
 {
struct us_data *us = (struct us_data *)__us;
struct Scsi_Host *host = us_to_host(us);
+   int autopm_rc;
 
current-flags |= PF_NOFREEZE;
 
@@ -323,6 +320,9 @@ static int usb_stor_control_thread(void * __us)

US_DEBUGP(*** thread awakened.\n);
 
+   /* Autoresume the device */
+   autopm_rc = usb_autopm_get_interface(us-pusb_intf);
+
/* lock the device pointers */
mutex_lock((us-dev_mutex));
 
@@ -381,6 +381,12 @@ static int usb_stor_control_thread(void * __us)
us-srb-result = SAM_STAT_GOOD;
}
 
+   /* Did the autoresume fail? */
+   else if (autopm_rc  0) {
+   US_DEBUGP(Could not wake device\n);
+   us-srb-result = DID_ERROR  16;
+   }
+
/* we've got a command, let's do it! */
else {
US_DEBUG(usb_stor_show_command(us-srb));
@@ -423,6 +429,10 @@ SkipForAbort:
 
/* unlock the device pointers */
mutex_unlock(us-dev_mutex);
+
+   /* Start an autosuspend */
+   if (autopm_rc == 0)
+   usb_autopm_put_interface(us-pusb_intf);
} /* for (;;) */
 
/* Wait until we are told to stop */
@@ -939,6 +949,7 @@ retry:
}
 
scsi_host_put(us_to_host(us));
+   usb_autopm_put_interface(us-pusb_intf);
complete_and_exit(threads_gone, 0);
 }
 
@@ -1028,6 +1039,7 @@ static int storage_probe(struct usb_interface *intf,
 * start it up. */
scsi_host_get(us_to_host(us));
atomic_inc(total_threads);
+   usb_autopm_get_interface(intf); /* dropped in the scanning thread */
wake_up_process(th);
 
return 0;
@@ -1065,6 +1077,7 @@ static struct usb_driver usb_storage_driver = {
.pre_reset =storage_pre_reset,
.post_reset =   storage_post_reset,
.id_table = storage_usb_ids,
+   .supports_autosuspend = 1,
 };
 
 static int __init usb_stor_init(void)
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http

[linux-usb-devel] [PATCH 146/149] USB: cdc-acm: add new device id to option driver

2007-07-12 Thread Greg Kroah-Hartman
From: Andrey Arapov [EMAIL PROTECTED]

USB: add new device id to option driver
device is Samsung X180 China cellphone

Signed-off-by: Andrey Arapov [EMAIL PROTECTED]
Acked-by: Oliver Neukum [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/class/cdc-acm.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 0081c1d..cd51520 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1157,6 +1157,9 @@ static struct usb_device_id acm_ids[] = {
{ USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */
.driver_info = NO_UNION_NORMAL, /* has no union descriptor */
},
+   { USB_DEVICE(0x0e8d, 0x0003), /* FIREFLY, MediaTek Inc; [EMAIL 
PROTECTED] */
+   .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
+   },
{ USB_DEVICE(0x0482, 0x0203), /* KYOCERA AH-K3001V */
.driver_info = NO_UNION_NORMAL, /* has no union descriptor */
},
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 145/149] USB: goku_udc trivial cleanups

2007-07-12 Thread Greg Kroah-Hartman
From: David Brownell [EMAIL PROTECTED]

Minor fixes to goku_udc ... whitespace, let -DDEBUG do its thing,
check the return value of device_register(), sparse tweaks.

Signed-off-by: David Brownell [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/gadget/goku_udc.c |   36 +---
 drivers/usb/gadget/goku_udc.h |   10 ++
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index dfadb64..d6c5f11 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -20,7 +20,6 @@
  *  - DMA works with ep1 (OUT transfers) and ep2 (IN transfers).
  */
 
-#undef DEBUG
 // #define VERBOSE /* extra debug messages (success too) */
 // #define USB_TRACE   /* packet-level success messages */
 
@@ -440,7 +439,7 @@ top:
/* use ep1/ep2 double-buffering for OUT */
if (!(size  PACKET_ACTIVE))
size = readl(regs-EPxSizeLB[ep-num]);
-   if (!(size  PACKET_ACTIVE))// can't happen
+   if (!(size  PACKET_ACTIVE))/* can't happen */
break;
size = DATASIZE;   /* EPxSizeH == 0 */
 
@@ -1092,17 +1091,17 @@ udc_proc_read(char *buffer, char **start, off_t off, 
int count,
is_usb_connected
? ((tmp  PW_PULLUP) ? full speed : powered)
: disconnected,
-   ({char *tmp;
+   ({char *state;
switch(dev-ep0state){
-   case EP0_DISCONNECT:tmp = ep0_disconnect; break;
-   case EP0_IDLE:  tmp = ep0_idle; break;
-   case EP0_IN:tmp = ep0_in; break;
-   case EP0_OUT:   tmp = ep0_out; break;
-   case EP0_STATUS:tmp = ep0_status; break;
-   case EP0_STALL: tmp = ep0_stall; break;
-   case EP0_SUSPEND:   tmp = ep0_suspend; break;
-   default:tmp = ep0_?; break;
-   } tmp; })
+   case EP0_DISCONNECT:state = ep0_disconnect; break;
+   case EP0_IDLE:  state = ep0_idle; break;
+   case EP0_IN:state = ep0_in; break;
+   case EP0_OUT:   state = ep0_out; break;
+   case EP0_STATUS:state = ep0_status; break;
+   case EP0_STALL: state = ep0_stall; break;
+   case EP0_SUSPEND:   state = ep0_suspend; break;
+   default:state = ep0_?; break;
+   } state; })
);
size -= t;
next += t;
@@ -1147,7 +1146,6 @@ udc_proc_read(char *buffer, char **start, off_t off, int 
count,
for (i = 0; i  4; i++) {
struct goku_ep  *ep = dev-ep [i];
struct goku_request *req;
-   int t;
 
if (i  !ep-desc)
continue;
@@ -1235,7 +1233,7 @@ done:
 static void udc_reinit (struct goku_udc *dev)
 {
static char *names [] = { ep0, ep1-bulk, ep2-bulk, ep3-bulk };
-   
+
unsigned i;
 
INIT_LIST_HEAD (dev-gadget.ep_list);
@@ -1848,9 +1846,9 @@ static int goku_probe(struct pci_dev *pdev, const struct 
pci_device_id *id)
 
/* done */
the_controller = dev;
-   device_register(dev-gadget.dev);
-
-   return 0;
+   retval = device_register(dev-gadget.dev);
+   if (retval == 0)
+   return 0;
 
 done:
if (dev)
@@ -1862,8 +1860,8 @@ done:
 /*-*/
 
 static struct pci_device_id pci_ids [] = { {
-   .class =((PCI_CLASS_SERIAL_USB  8) | 0xfe),
-   .class_mask =   ~0,
+   .class =((PCI_CLASS_SERIAL_USB  8) | 0xfe),
+   .class_mask =   ~0,
.vendor =   0x102f, /* Toshiba */
.device =   0x0107, /* this UDC */
.subvendor =PCI_ANY_ID,
diff --git a/drivers/usb/gadget/goku_udc.h b/drivers/usb/gadget/goku_udc.h
index ea8c8e5..bc4eb1e 100644
--- a/drivers/usb/gadget/goku_udc.h
+++ b/drivers/usb/gadget/goku_udc.h
@@ -41,8 +41,10 @@ struct goku_udc_regs {
 #define INT_SYSERROR   0x4
 #define INT_PWRDETECT  0x8
 
-#defineINT_DEVWIDE 
(INT_PWRDETECT|INT_SYSERROR/*|INT_ERR*/|INT_USBRESET|INT_SUSPEND)
-#defineINT_EP0 
(INT_SETUP|INT_ENDPOINT0/*|INT_STATUS*/|INT_STATUSNAK)
+#defineINT_DEVWIDE \
+   (INT_PWRDETECT|INT_SYSERROR/*|INT_ERR*/|INT_USBRESET|INT_SUSPEND)
+#defineINT_EP0 \
+   (INT_SETUP|INT_ENDPOINT0/*|INT_STATUS*/|INT_STATUSNAK)
 
u32 dma_master;
 #define MST_EOPB_DIS   0x0800
@@ -231,7 +233,7 @@ struct goku_request

[linux-usb-devel] [PATCH 144/149] USB: usb gadget stack can now -DDEBUG with Kconfig

2007-07-12 Thread Greg Kroah-Hartman
From: David Brownell [EMAIL PROTECTED]

Although the other USB driver directories got taught how use Kconfig
and the Makefile to enable the debugging messages enabled by -DDEBUG,
the gadget stack was overlooked.

This patch remedies that omission, but doesn't update any drivers to
remove previous idiosyncracies in this area ... other than the RNDIS
code, which defined its own DEBUG() macro in a broken way.

Signed-off-by: David Brownell [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/gadget/Kconfig  |   14 
 drivers/usb/gadget/Makefile |4 +
 drivers/usb/gadget/rndis.c  |  164 +-
 3 files changed, 100 insertions(+), 82 deletions(-)

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 74eaa7d..45e01e2 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -42,6 +42,20 @@ config USB_GADGET
   For more information, see http://www.linux-usb.org/gadget and
   the kernel DocBook documentation for this API.
 
+config USB_GADGET_DEBUG
+   boolean Debugging messages
+   depends on USB_GADGET  DEBUG_KERNEL  EXPERIMENTAL
+   help
+  Many controller and gadget drivers will print some debugging
+  messages if you use this option to ask for those messages.
+
+  Avoid enabling these messages, even if you're actively
+  debugging such a driver.  Many drivers will emit so many
+  messages that the driver timings are affected, which will
+  either create new failure modes or remove the one you're
+  trying to track down.  Never enable these messages for a
+  production build.
+
 config USB_GADGET_DEBUG_FILES
boolean Debugging information files
depends on USB_GADGET  PROC_FS
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index bff2783..8ae76f7 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -1,6 +1,10 @@
 #
 # USB peripheral controller drivers
 #
+ifeq ($(CONFIG_USB_GADGET_DEBUG),y)
+   EXTRA_CFLAGS+= -DDEBUG
+endif
+
 obj-$(CONFIG_USB_DUMMY_HCD)+= dummy_hcd.o
 obj-$(CONFIG_USB_NET2280)  += net2280.o
 obj-$(CONFIG_USB_PXA2XX)   += pxa2xx_udc.o
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
index 708657c..db1b2bf 100644
--- a/drivers/usb/gadget/rndis.c
+++ b/drivers/usb/gadget/rndis.c
@@ -53,7 +53,7 @@
  */
 
 #if 0
-#define DEBUG(str,args...) do { \
+#define DBG(str,args...) do { \
if (rndis_debug) \
printk(KERN_DEBUG str , ## args ); \
} while (0)
@@ -65,7 +65,7 @@ MODULE_PARM_DESC (rndis_debug, enable debugging);
 #else
 
 #define rndis_debug0
-#define DEBUG(str,args...) do{}while(0)
+#define DBG(str,args...)   do{}while(0)
 #endif
 
 #define RNDIS_MAX_CONFIGS  1
@@ -183,9 +183,9 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, 
unsigned buf_len,
if (!resp) return -ENOMEM;
 
if (buf_len  rndis_debug  1) {
-   DEBUG(query OID %08x value, len %d:\n, OID, buf_len);
+   DBG(query OID %08x value, len %d:\n, OID, buf_len);
for (i = 0; i  buf_len; i += 16) {
-   DEBUG (%03d: %08x %08x %08x %08x\n, i,
+   DBG(%03d: %08x %08x %08x %08x\n, i,
le32_to_cpu(get_unaligned((__le32 *)
buf[i])),
le32_to_cpu(get_unaligned((__le32 *)
@@ -207,7 +207,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, 
unsigned buf_len,
 
/* mandatory */
case OID_GEN_SUPPORTED_LIST:
-   DEBUG (%s: OID_GEN_SUPPORTED_LIST\n, __FUNCTION__);
+   DBG(%s: OID_GEN_SUPPORTED_LIST\n, __FUNCTION__);
length = sizeof (oid_supported_list);
count  = length / sizeof (u32);
for (i = 0; i  count; i++)
@@ -217,7 +217,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, 
unsigned buf_len,
 
/* mandatory */
case OID_GEN_HARDWARE_STATUS:
-   DEBUG(%s: OID_GEN_HARDWARE_STATUS\n, __FUNCTION__);
+   DBG(%s: OID_GEN_HARDWARE_STATUS\n, __FUNCTION__);
/* Bogus question!
 * Hardware must be ready to receive high level protocols.
 * BTW:
@@ -230,14 +230,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, 
unsigned buf_len,
 
/* mandatory */
case OID_GEN_MEDIA_SUPPORTED:
-   DEBUG(%s: OID_GEN_MEDIA_SUPPORTED\n, __FUNCTION__);
+   DBG(%s: OID_GEN_MEDIA_SUPPORTED\n, __FUNCTION__);
*outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium);
retval = 0;
break;
 
/* mandatory */
case OID_GEN_MEDIA_IN_USE:
-   DEBUG(%s: OID_GEN_MEDIA_IN_USE\n, __FUNCTION__);
+   DBG(%s

[linux-usb-devel] [PATCH 143/149] usb gadget stack: remove usb_ep_*_buffer(), part 2

2007-07-12 Thread Greg Kroah-Hartman
From: David Brownell [EMAIL PROTECTED]

This patch removes controller driver infrastructure which supported
the now-removed usb_ep_{alloc,free}_buffer() calls.

As can be seen, many of the implementations of this were broken to
various degrees.  Many didn't properly return dma-coherent mappings;
those which did so were necessarily ugly because of bogosity in the
underlying dma_free_coherent() calls ... which on many platforms
can't be called from the same contexts (notably in_irq) from which
their dma_alloc_coherent() sibling can be called.

The main potential downside of removing this is that gadget drivers
wouldn't have specific knowledge that the controller drivers have:
endpoints that aren't dma-capable don't need any dma mappings at all.

Signed-off-by: David Brownell [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/gadget/at91_udc.c |   21 ---
 drivers/usb/gadget/dummy_hcd.c|   36 
 drivers/usb/gadget/fsl_usb2_udc.c |   36 
 drivers/usb/gadget/goku_udc.c |   48 
 drivers/usb/gadget/lh7a40x_udc.c  |   27 -
 drivers/usb/gadget/net2280.c  |   97 -
 drivers/usb/gadget/omap_udc.c |  108 -
 drivers/usb/gadget/pxa2xx_udc.c   |   23 
 drivers/usb/gadget/s3c2410_udc.c  |   33 ---
 include/linux/usb_gadget.h|7 ---
 10 files changed, 0 insertions(+), 436 deletions(-)

diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index ba163f3..63d7d65 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -601,25 +601,6 @@ static void at91_ep_free_request(struct usb_ep *_ep, 
struct usb_request *_req)
kfree(req);
 }
 
-static void *at91_ep_alloc_buffer(
-   struct usb_ep *_ep,
-   unsigned bytes,
-   dma_addr_t *dma,
-   gfp_t gfp_flags)
-{
-   *dma = ~0;
-   return kmalloc(bytes, gfp_flags);
-}
-
-static void at91_ep_free_buffer(
-   struct usb_ep *ep,
-   void *buf,
-   dma_addr_t dma,
-   unsigned bytes)
-{
-   kfree(buf);
-}
-
 static int at91_ep_queue(struct usb_ep *_ep,
struct usb_request *_req, gfp_t gfp_flags)
 {
@@ -788,8 +769,6 @@ static const struct usb_ep_ops at91_ep_ops = {
.disable= at91_ep_disable,
.alloc_request  = at91_ep_alloc_request,
.free_request   = at91_ep_free_request,
-   .alloc_buffer   = at91_ep_alloc_buffer,
-   .free_buffer= at91_ep_free_buffer,
.queue  = at91_ep_queue,
.dequeue= at91_ep_dequeue,
.set_halt   = at91_ep_set_halt,
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 9040b50..f2fbdc7 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -497,38 +497,6 @@ dummy_free_request (struct usb_ep *_ep, struct usb_request 
*_req)
kfree (req);
 }
 
-static void *
-dummy_alloc_buffer (
-   struct usb_ep *_ep,
-   unsigned bytes,
-   dma_addr_t *dma,
-   gfp_t mem_flags
-) {
-   char*retval;
-   struct dummy_ep *ep;
-   struct dummy*dum;
-
-   ep = usb_ep_to_dummy_ep (_ep);
-   dum = ep_to_dummy (ep);
-
-   if (!dum-driver)
-   return NULL;
-   retval = kmalloc (bytes, mem_flags);
-   *dma = (dma_addr_t) retval;
-   return retval;
-}
-
-static void
-dummy_free_buffer (
-   struct usb_ep *_ep,
-   void *buf,
-   dma_addr_t dma,
-   unsigned bytes
-) {
-   if (bytes)
-   kfree (buf);
-}
-
 static void
 fifo_complete (struct usb_ep *ep, struct usb_request *req)
 {
@@ -659,10 +627,6 @@ static const struct usb_ep_ops dummy_ep_ops = {
.alloc_request  = dummy_alloc_request,
.free_request   = dummy_free_request,
 
-   .alloc_buffer   = dummy_alloc_buffer,
-   .free_buffer= dummy_free_buffer,
-   /* map, unmap, ... eventually hook the generic dma calls */
-
.queue  = dummy_queue,
.dequeue= dummy_dequeue,
 
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c 
b/drivers/usb/gadget/fsl_usb2_udc.c
index 4e14bcd..10b2b33 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.c
+++ b/drivers/usb/gadget/fsl_usb2_udc.c
@@ -601,39 +601,6 @@ static void fsl_free_request(struct usb_ep *_ep, struct 
usb_request *_req)
kfree(req);
 }
 
-/*--
- * Allocate an I/O buffer
-*-*/
-static void *fsl_alloc_buffer(struct usb_ep *_ep, unsigned bytes,
-   dma_addr_t *dma, gfp_t gfp_flags)
-{
-   struct fsl_ep *ep;
-
-   if (!_ep)
-   return NULL;
-
-   ep = container_of(_ep, struct fsl_ep, ep);
-
-   return dma_alloc_coherent(ep-udc-gadget.dev.parent,
-   bytes

[linux-usb-devel] [PATCH 142/149] usb gadget stack: remove usb_ep_*_buffer(), part 1

2007-07-12 Thread Greg Kroah-Hartman
From: David Brownell [EMAIL PROTECTED]

Remove usb_ep_{alloc,free}_buffer() calls, for small dma-coherent buffers.
This patch just removes the interface and its users; later patches will
remove controller driver support.

  - This interface is invariably not implemented correctly in the
controller drivers (e.g. using dma pools, a mechanism which
post-dates the interface by several years).

  - At this point no gadget driver really *needs* to use it.  In
current kernels, any driver that needs such a mechanism could
allocate a dma pool themselves.

Removing this interface is thus a simplification and improvement.

Note that the gmidi.c driver had a bug in this area; fixed.

Signed-off-by: David Brownell [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/gadget/file_storage.c |   19 
 drivers/usb/gadget/gmidi.c|8 +--
 drivers/usb/gadget/inode.c|4 +-
 drivers/usb/gadget/zero.c |9 ++-
 include/linux/usb_gadget.h|   41 -
 5 files changed, 11 insertions(+), 70 deletions(-)

diff --git a/drivers/usb/gadget/file_storage.c 
b/drivers/usb/gadget/file_storage.c
index 7e650d0..8712ef9 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -3733,19 +3733,12 @@ static void /* __init_or_exit */ fsg_unbind(struct 
usb_gadget *gadget)
}
 
/* Free the data buffers */
-   for (i = 0; i  NUM_BUFFERS; ++i) {
-   struct fsg_buffhd   *bh = fsg-buffhds[i];
-
-   if (bh-buf)
-   usb_ep_free_buffer(fsg-bulk_in, bh-buf, bh-dma,
-   mod_data.buflen);
-   }
+   for (i = 0; i  NUM_BUFFERS; ++i)
+   kfree(fsg-buffhds[i].buf);
 
/* Free the request and buffer for endpoint 0 */
if (req) {
-   if (req-buf)
-   usb_ep_free_buffer(fsg-ep0, req-buf,
-   req-dma, EP0_BUFSIZE);
+   kfree(req-buf);
usb_ep_free_request(fsg-ep0, req);
}
 
@@ -3972,8 +3965,7 @@ static int __init fsg_bind(struct usb_gadget *gadget)
fsg-ep0req = req = usb_ep_alloc_request(fsg-ep0, GFP_KERNEL);
if (!req)
goto out;
-   req-buf = usb_ep_alloc_buffer(fsg-ep0, EP0_BUFSIZE,
-   req-dma, GFP_KERNEL);
+   req-buf = kmalloc(EP0_BUFSIZE, GFP_KERNEL);
if (!req-buf)
goto out;
req-complete = ep0_complete;
@@ -3985,8 +3977,7 @@ static int __init fsg_bind(struct usb_gadget *gadget)
/* Allocate for the bulk-in endpoint.  We assume that
 * the buffer will also work with the bulk-out (and
 * interrupt-in) endpoint. */
-   bh-buf = usb_ep_alloc_buffer(fsg-bulk_in, mod_data.buflen,
-   bh-dma, GFP_KERNEL);
+   bh-buf = kmalloc(mod_data.buflen, GFP_KERNEL);
if (!bh-buf)
goto out;
bh-next = bh + 1;
diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c
index d08a8d0..1c5aa49 100644
--- a/drivers/usb/gadget/gmidi.c
+++ b/drivers/usb/gadget/gmidi.c
@@ -1248,17 +1248,11 @@ autoconf_fail:
tasklet_init(dev-tasklet, gmidi_in_tasklet, (unsigned long)dev);
 
/* preallocate control response and buffer */
-   dev-req = usb_ep_alloc_request(gadget-ep0, GFP_KERNEL);
+   dev-req = alloc_ep_req(gadget-ep0, USB_BUFSIZ);
if (!dev-req) {
err = -ENOMEM;
goto fail;
}
-   dev-req-buf = usb_ep_alloc_buffer(gadget-ep0, USB_BUFSIZ,
-   dev-req-dma, GFP_KERNEL);
-   if (!dev-req-buf) {
-   err = -ENOMEM;
-   goto fail;
-   }
 
dev-req-complete = gmidi_setup_complete;
 
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index f723e08..e60745f 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -923,7 +923,7 @@ static void clean_req (struct usb_ep *ep, struct 
usb_request *req)
struct dev_data *dev = ep-driver_data;
 
if (req-buf != dev-rbuf) {
-   usb_ep_free_buffer (ep, req-buf, req-dma, req-length);
+   kfree(req-buf);
req-buf = dev-rbuf;
req-dma = DMA_ADDR_INVALID;
}
@@ -963,7 +963,7 @@ static int setup_req (struct usb_ep *ep, struct usb_request 
*req, u16 len)
return -EBUSY;
}
if (len  sizeof (dev-rbuf))
-   req-buf = usb_ep_alloc_buffer (ep, len, req-dma, GFP_ATOMIC);
+   req-buf = kmalloc(len, GFP_ATOMIC);
if (req-buf == 0) {
req-buf = dev-rbuf;
return -ENOMEM;
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index 7078374..a2e6e3f 100644

[linux-usb-devel] [PATCH 141/149] USB: pxa2xx_udc -- cleanups, mostly removing dma hooks

2007-07-12 Thread Greg Kroah-Hartman
From: David Brownell [EMAIL PROTECTED]

Cleanups to the pxa2xx_udc code:

  - Primarily removing unused DMA hooks.
  - One sparse warning removed
  - Remove some Lubbock-only LED hooks (for debugging)

That DMA code was never really completed.  It worked, mostly, for IN
transfers (to the host) if they were fortuitously aligned, but that
code was never fully tested.  And it was never coded for OUT transfers
(which is where DMA would really help) ... because of chip errata on
essentially every chip other than the pxa255, and because of design
botches (nothing automated data toggle).  So it's effectively been
dead code for several years now ... no point in keeping it around.

Signed-off-by: David Brownell [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/gadget/pxa2xx_udc.c |  387 +++
 drivers/usb/gadget/pxa2xx_udc.h |   42 +
 2 files changed, 25 insertions(+), 404 deletions(-)

diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
index c9ec0b3..484de6e 100644
--- a/drivers/usb/gadget/pxa2xx_udc.c
+++ b/drivers/usb/gadget/pxa2xx_udc.c
@@ -24,7 +24,6 @@
  *
  */
 
-#undef DEBUG
 // #define VERBOSE DBG_VERBOSE
 
 #include linux/device.h
@@ -75,9 +74,17 @@
  * it constrains the sorts of USB configuration change events that work.
  * The errata for these chips are misleading; some fixed bugs from
  * pxa250 a0/a1 b0/b1/b2 sure act like they're still there.
+ *
+ * Note that the UDC hardware supports DMA (except on IXP) but that's
+ * not used here.  IN-DMA (to host) is simple enough, when the data is
+ * suitably aligned (16 bytes) ... the network stack doesn't do that,
+ * other software can.  OUT-DMA is buggy in most chip versions, as well
+ * as poorly designed (data toggle not automatic).  So this driver won't
+ * bother using DMA.  (Mostly-working IN-DMA support was available in
+ * kernels before 2.6.23, but was never enabled or well tested.)
  */
 
-#defineDRIVER_VERSION  4-May-2005
+#defineDRIVER_VERSION  30-June-2007
 #defineDRIVER_DESC PXA 25x USB Device Controller driver
 
 
@@ -86,12 +93,9 @@ static const char driver_name [] = pxa2xx_udc;
 static const char ep0name [] = ep0;
 
 
-// #define USE_DMA
-// #define USE_OUT_DMA
 // #define DISABLE_TEST_MODE
 
 #ifdef CONFIG_ARCH_IXP4XX
-#undef USE_DMA
 
 /* cpu-specific register addresses are compiled in to this code */
 #ifdef CONFIG_ARCH_PXA
@@ -103,25 +107,6 @@ static const char ep0name [] = ep0;
 #include pxa2xx_udc.h
 
 
-#ifdef USE_DMA
-static int use_dma = 1;
-module_param(use_dma, bool, 0);
-MODULE_PARM_DESC (use_dma, true to use dma);
-
-static void dma_nodesc_handler (int dmach, void *_ep);
-static void kick_dma(struct pxa2xx_ep *ep, struct pxa2xx_request *req);
-
-#ifdef USE_OUT_DMA
-#defineDMASTR  (dma support)
-#else
-#defineDMASTR  (dma in)
-#endif
-
-#else  /* !USE_DMA */
-#defineDMASTR  (pio only)
-#undef USE_OUT_DMA
-#endif
-
 #ifdef CONFIG_USB_PXA2XX_SMALL
 #define SIZE_STR(small)
 #else
@@ -280,9 +265,8 @@ static int pxa2xx_ep_enable (struct usb_ep *_ep,
}
 
ep-desc = desc;
-   ep-dma = -1;
ep-stopped = 0;
-   ep-pio_irqs = ep-dma_irqs = 0;
+   ep-pio_irqs = 0;
ep-ep.maxpacket = le16_to_cpu (desc-wMaxPacketSize);
 
/* flush fifo (mostly for OUT buffers) */
@@ -290,30 +274,6 @@ static int pxa2xx_ep_enable (struct usb_ep *_ep,
 
/* ... reset halt state too, if we could ... */
 
-#ifdef USE_DMA
-   /* for (some) bulk and ISO endpoints, try to get a DMA channel and
-* bind it to the endpoint.  otherwise use PIO.
-*/
-   switch (ep-bmAttributes) {
-   case USB_ENDPOINT_XFER_ISOC:
-   if (le16_to_cpu(desc-wMaxPacketSize) % 32)
-   break;
-   // fall through
-   case USB_ENDPOINT_XFER_BULK:
-   if (!use_dma || !ep-reg_drcmr)
-   break;
-   ep-dma = pxa_request_dma ((char *)_ep-name,
-   (le16_to_cpu (desc-wMaxPacketSize)  64)
-   ? DMA_PRIO_MEDIUM /* some iso */
-   : DMA_PRIO_LOW,
-   dma_nodesc_handler, ep);
-   if (ep-dma = 0) {
-   *ep-reg_drcmr = DRCMR_MAPVLD | ep-dma;
-   DMSG(%s using dma%d\n, _ep-name, ep-dma);
-   }
-   }
-#endif
-
DBG(DBG_VERBOSE, enabled %s\n, _ep-name);
return 0;
 }
@@ -333,14 +293,6 @@ static int pxa2xx_ep_disable (struct usb_ep *_ep)
 
nuke (ep, -ESHUTDOWN);
 
-#ifdef USE_DMA
-   if (ep-dma = 0) {
-   *ep-reg_drcmr = 0;
-   pxa_free_dma (ep-dma);
-   ep-dma = -1;
-   }
-#endif
-
/* flush fifo (mostly for IN buffers) */
pxa2xx_ep_fifo_flush (_ep);
 
@@ -390,11 +342,6

[linux-usb-devel] [PATCH 139/149] USB: quirk for samsung printer

2007-07-12 Thread Greg Kroah-Hartman
From: Oliver Neukum [EMAIL PROTECTED]

this printer does not survive suspension.

Signed-off-by: Oliver Neukum [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/quirks.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 1cfc87b..a0fd68b 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -32,6 +32,8 @@ static const struct usb_device_id usb_quirk_list[] = {
{ USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 
},
/* Seiko Epson Corp - Perfection 1670 */
{ USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+   /* Samsung ML-2510 Series printer */
+   { USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
/* Elsa MicroLink 56k (V.250) */
{ USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
 
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 137/149] USB: drivers/usb/storage/unusual_devs.h whitespace cleanup

2007-07-12 Thread Greg Kroah-Hartman
From: S.Caglar Onur [EMAIL PROTECTED]

Following patch removes trailing whitespaces at the ends of lines and converts
smarttabs/whitespaces into real tabs.

Signed-off-by: S.Caglar Onur [EMAIL PROTECTED]
Signed-off-by: Phil Dibowitz [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/storage/unusual_devs.h |  188 ++--
 1 files changed, 94 insertions(+), 94 deletions(-)

diff --git a/drivers/usb/storage/unusual_devs.h 
b/drivers/usb/storage/unusual_devs.h
index 54979c2..b6bf31a 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -50,10 +50,10 @@
 /* patch submitted by Vivian Bregier [EMAIL PROTECTED]
  */
 UNUSUAL_DEV(  0x03eb, 0x2002, 0x0100, 0x0100,
-ATMEL,
-SND1 Storage,
-US_SC_DEVICE, US_PR_DEVICE, NULL,
-US_FL_IGNORE_RESIDUE),
+   ATMEL,
+   SND1 Storage,
+   US_SC_DEVICE, US_PR_DEVICE, NULL,
+   US_FL_IGNORE_RESIDUE),
 
 /* modified by Tobias Lorenz [EMAIL PROTECTED] */
 UNUSUAL_DEV(  0x03ee, 0x6901, 0x, 0x0200,
@@ -69,18 +69,18 @@ UNUSUAL_DEV(  0x03ee, 0x6906, 0x0003, 0x0003,
US_SC_DEVICE, US_PR_DEVICE, NULL,
US_FL_IGNORE_RESIDUE ),
 
-UNUSUAL_DEV(  0x03f0, 0x0107, 0x0200, 0x0200, 
+UNUSUAL_DEV(  0x03f0, 0x0107, 0x0200, 0x0200,
HP,
CD-Writer+,
-   US_SC_8070, US_PR_CB, NULL, 0), 
+   US_SC_8070, US_PR_CB, NULL, 0),
 
 #ifdef CONFIG_USB_STORAGE_USBAT
-UNUSUAL_DEV(  0x03f0, 0x0207, 0x0001, 0x0001, 
+UNUSUAL_DEV(  0x03f0, 0x0207, 0x0001, 0x0001,
HP,
CD-Writer+ 8200e,
US_SC_8070, US_PR_USBAT, init_usbat_cd, 0),
 
-UNUSUAL_DEV(  0x03f0, 0x0307, 0x0001, 0x0001, 
+UNUSUAL_DEV(  0x03f0, 0x0307, 0x0001, 0x0001,
HP,
CD-Writer+ CD-4e,
US_SC_8070, US_PR_USBAT, init_usbat_cd, 0),
@@ -115,10 +115,10 @@ UNUSUAL_DEV(  0x0411, 0x001c, 0x0113, 0x0113,
 
 /* Submitted by Ernestas Vaiciukevicius [EMAIL PROTECTED] */
 UNUSUAL_DEV(  0x0419, 0x0100, 0x0100, 0x0100,
-Samsung Info. Systems America, Inc.,
-MP3 Player,
-US_SC_DEVICE, US_PR_DEVICE, NULL,
-US_FL_IGNORE_RESIDUE ),
+   Samsung Info. Systems America, Inc.,
+   MP3 Player,
+   US_SC_DEVICE, US_PR_DEVICE, NULL,
+   US_FL_IGNORE_RESIDUE ),
 
 /* Reported by Orgad Shaneh [EMAIL PROTECTED] */
 UNUSUAL_DEV(  0x0419, 0xaace, 0x0100, 0x0100,
@@ -256,10 +256,10 @@ UNUSUAL_DEV(  0x0457, 0x0150, 0x0100, 0x0100,
 * the revision to my model only
 */
 UNUSUAL_DEV(  0x0457, 0x0151, 0x0100, 0x0100,
-USB 2.0,
-Flash Disk,
-US_SC_DEVICE, US_PR_DEVICE, NULL,
-US_FL_NOT_LOCKABLE ),
+   USB 2.0,
+   Flash Disk,
+   US_SC_DEVICE, US_PR_DEVICE, NULL,
+   US_FL_NOT_LOCKABLE ),
 
 #ifdef CONFIG_USB_STORAGE_KARMA
 UNUSUAL_DEV(  0x045a, 0x5210, 0x0101, 0x0101,
@@ -408,19 +408,19 @@ UNUSUAL_DEV(  0x04da, 0x2373, 0x, 0x,
 /* Most of the following entries were developed with the help of
  * Shuttle/SCM directly.
  */
-UNUSUAL_DEV(  0x04e6, 0x0001, 0x0200, 0x0200, 
+UNUSUAL_DEV(  0x04e6, 0x0001, 0x0200, 0x0200,
Matshita,
LS-120,
US_SC_8020, US_PR_CB, NULL, 0),
 
-UNUSUAL_DEV(  0x04e6, 0x0002, 0x0100, 0x0100, 
+UNUSUAL_DEV(  0x04e6, 0x0002, 0x0100, 0x0100,
Shuttle,
eUSCSI Bridge,
US_SC_DEVICE, US_PR_DEVICE, usb_stor_euscsi_init, 
-   US_FL_SCM_MULT_TARG ), 
+   US_FL_SCM_MULT_TARG ),
 
 #ifdef CONFIG_USB_STORAGE_SDDR09
-UNUSUAL_DEV(  0x04e6, 0x0003, 0x, 0x, 
+UNUSUAL_DEV(  0x04e6, 0x0003, 0x, 0x,
Sandisk,
ImageMate SDDR09,
US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init,
@@ -431,52 +431,52 @@ UNUSUAL_DEV(  0x04e6, 0x0005, 0x0100, 0x0208,
SCM Microsystems,
eUSB SmartMedia / CompactFlash Adapter,
US_SC_SCSI, US_PR_DPCM_USB, usb_stor_sddr09_dpcm_init,
-   0), 
+   0),
 #endif
 
 /* Reported by Markus Demleitner [EMAIL PROTECTED] */
-UNUSUAL_DEV(  0x04e6, 0x0006, 0x0100, 0x0100, 
+UNUSUAL_DEV(  0x04e6, 0x0006, 0x0100, 0x0100,
SCM Microsystems Inc.,
eUSB MMC Adapter,
-   US_SC_SCSI, US_PR_CB, NULL, 
-   US_FL_SINGLE_LUN), 
+   US_SC_SCSI, US_PR_CB, NULL,
+   US_FL_SINGLE_LUN),
 
 /* Reported by Daniel Nouri [EMAIL PROTECTED] */
-UNUSUAL_DEV(  0x04e6, 0x0006, 0x0205, 0x0205, 
+UNUSUAL_DEV(  0x04e6, 0x0006, 0x0205, 0x0205,
Shuttle,
eUSB MMC Adapter,
-   US_SC_SCSI, US_PR_DEVICE, NULL

[linux-usb-devel] [PATCH 135/149] USB: io_*: remove bogus termios no change checks

2007-07-12 Thread Greg Kroah-Hartman
From: Alan Cox [EMAIL PROTECTED]

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/io_edgeport.c |9 -
 drivers/usb/serial/io_ti.c   |8 
 2 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index cebb32f..dd42f57 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -1513,15 +1513,6 @@ static void edge_set_termios (struct usb_serial_port 
*port, struct ktermios *old
}
 
cflag = tty-termios-c_cflag;
-   /* check that they really want us to change something */
-   if (old_termios) {
-   if (cflag == old_termios-c_cflag 
-   tty-termios-c_iflag == old_termios-c_iflag) {
-   dbg(%s - nothing to change, __FUNCTION__);
-   return;
-   }
-   }
-
dbg(%s - clfag %08x iflag %08x, __FUNCTION__, 
tty-termios-c_cflag, tty-termios-c_iflag);
if (old_termios) {
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 1c6850a..0d39036 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -2544,14 +2544,6 @@ static void edge_set_termios (struct usb_serial_port 
*port, struct ktermios *old
}
 
cflag = tty-termios-c_cflag;
-   /* check that they really want us to change something */
-   if (old_termios) {
-   if (cflag == old_termios-c_cflag 
-   tty-termios-c_iflag == old_termios-c_iflag) {
-   dbg (%s - nothing to change, __FUNCTION__);
-   return;
-   }
-   }
 
dbg(%s - clfag %08x iflag %08x, __FUNCTION__, 
tty-termios-c_cflag, tty-termios-c_iflag);
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 134/149] USB: mos7720: remove bogus no termios change check

2007-07-12 Thread Greg Kroah-Hartman
From: Alan Cox [EMAIL PROTECTED]

Signed-off-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/mos7720.c |   10 --
 1 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index da60c30..231b584 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -1238,16 +1238,6 @@ static void mos7720_set_termios(struct usb_serial_port 
*port,
return;
}
 
-   /* check that they really want us to change something */
-   if (old_termios) {
-   if ((cflag == old_termios-c_cflag) 
-   (RELEVANT_IFLAG(tty-termios-c_iflag) ==
-RELEVANT_IFLAG(old_termios-c_iflag))) {
-   dbg(Nothing to change);
-   return;
-   }
-   }
-
dbg(%s - clfag %08x iflag %08x, __FUNCTION__,
tty-termios-c_cflag,
RELEVANT_IFLAG(tty-termios-c_iflag));
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 130/149] USB: make the usb_device numa_node get assigned from controller

2007-07-12 Thread Greg Kroah-Hartman
From: Yinghai Lu [EMAIL PROTECTED]

So we can use dev_to_node(usb_dev-dev) later in kmalloc_node to dma buffer

Signed-off-by: Yinghai Lu [EMAIL PROTECTED]
Cc: Andi Kleen [EMAIL PROTECTED]
Acked-by: Christoph Lameter [EMAIL PROTECTED]
Cc: David Rientjes [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/usb.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 4a6299b..c611b3c 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -253,6 +253,7 @@ usb_alloc_dev(struct usb_device *parent, struct usb_bus 
*bus, unsigned port1)
dev-dev.bus = usb_bus_type;
dev-dev.type = usb_device_type;
dev-dev.dma_mask = bus-controller-dma_mask;
+   set_dev_node(dev-dev, dev_to_node(bus-controller));
dev-state = USB_STATE_ATTACHED;
 
INIT_LIST_HEAD(dev-ep0.urb_list);
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 129/149] USB: ftdi_sio: fix oops due to processing workarounds too early

2007-07-12 Thread Greg Kroah-Hartman
From: Oliver Neukum [EMAIL PROTECTED]

Fix an oops that happens in relation with applying work arounds for buggy
ftdi_sio devices.  The quirks were handled too early because due to changes in
the initialisation of usb serial devices the device was not fully initialised
when the old hook was called.

Addresses bug 8564

Cc: [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/ftdi_sio.c |  104 +---
 1 files changed, 44 insertions(+), 60 deletions(-)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 4066a46..7b1673a 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -271,26 +271,58 @@ static int debug;
 static __u16 vendor = FTDI_VID;
 static __u16 product;
 
+struct ftdi_private {
+   ftdi_chip_type_t chip_type;
+   /* type of the device, either SIO or FT8U232AM 
*/
+   int baud_base;  /* baud base clock for divisor setting */
+   int custom_divisor; /* custom_divisor kludge, this is for baud_base 
(different from what goes to the chip!) */
+   __u16 last_set_data_urb_value ;
+   /* the last data state set - needed for doing a 
break */
+int write_offset;   /* This is the offset in the usb data block to 
write the serial data -
+* it is different between devices
+*/
+   int flags;  /* some ASYNC_ flags are supported */
+   unsigned long last_dtr_rts; /* saved modem control outputs */
+wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */
+   char prev_status, diff_status;/* Used for TIOCMIWAIT */
+   __u8 rx_flags;  /* receive state flags (throttling) */
+   spinlock_t rx_lock; /* spinlock for receive state */
+   struct delayed_work rx_work;
+   struct usb_serial_port *port;
+   int rx_processed;
+   unsigned long rx_bytes;
+
+   __u16 interface;/* FT2232C port interface (0 for FT232/245) */
+
+   int force_baud; /* if non-zero, force the baud rate to this 
value */
+   int force_rtscts;   /* if non-zero, force RTS-CTS to always be 
enabled */
+
+   spinlock_t tx_lock; /* spinlock for transmit state */
+   unsigned long tx_bytes;
+   unsigned long tx_outstanding_bytes;
+   unsigned long tx_outstanding_urbs;
+};
+
 /* struct ftdi_sio_quirk is used by devices requiring special attention. */
 struct ftdi_sio_quirk {
int (*probe)(struct usb_serial *);
-   void (*setup)(struct usb_serial *); /* Special settings during startup. 
*/
+   void (*port_probe)(struct ftdi_private *); /* Special settings for 
probed ports. */
 };
 
 static int   ftdi_olimex_probe (struct usb_serial *serial);
-static void  ftdi_USB_UIRT_setup   (struct usb_serial *serial);
-static void  ftdi_HE_TIRA1_setup   (struct usb_serial *serial);
+static void  ftdi_USB_UIRT_setup   (struct ftdi_private *priv);
+static void  ftdi_HE_TIRA1_setup   (struct ftdi_private *priv);
 
 static struct ftdi_sio_quirk ftdi_olimex_quirk = {
.probe  = ftdi_olimex_probe,
 };
 
 static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = {
-   .setup = ftdi_USB_UIRT_setup,
+   .port_probe = ftdi_USB_UIRT_setup,
 };
 
 static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = {
-   .setup = ftdi_HE_TIRA1_setup,
+   .port_probe = ftdi_HE_TIRA1_setup,
 };
 
 /*
@@ -567,38 +599,6 @@ static const char *ftdi_chip_name[] = {
 #define THROTTLED  0x01
 #define ACTUALLY_THROTTLED 0x02
 
-struct ftdi_private {
-   ftdi_chip_type_t chip_type;
-   /* type of the device, either SIO or FT8U232AM 
*/
-   int baud_base;  /* baud base clock for divisor setting */
-   int custom_divisor; /* custom_divisor kludge, this is for baud_base 
(different from what goes to the chip!) */
-   __u16 last_set_data_urb_value ;
-   /* the last data state set - needed for doing a 
break */
-int write_offset;   /* This is the offset in the usb data block to 
write the serial data -
-* it is different between devices
-*/
-   int flags;  /* some ASYNC_ flags are supported */
-   unsigned long last_dtr_rts; /* saved modem control outputs */
-wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */
-   char prev_status, diff_status;/* Used for TIOCMIWAIT */
-   __u8 rx_flags;  /* receive state flags (throttling) */
-   spinlock_t rx_lock; /* spinlock for receive state */
-   struct delayed_work rx_work;
-   struct usb_serial_port *port;
-   int rx_processed;
-   unsigned long rx_bytes;
-
-   __u16 interface

[linux-usb-devel] [PATCH 126/149] USB: Make usb-autosuspend timer 1 sec jiffy aligned

2007-07-12 Thread Greg Kroah-Hartman
From: Venki Pallipadi [EMAIL PROTECTED]

Make usb autosuspend timers 1sec jiffy aligned.

This helps to reduce the frequency at which the CPU must be taken out of a
lower-power state.

Signed-off-by: Venkatesh Pallipadi [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/driver.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index a3aed8d..73c4936 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1010,7 +1010,7 @@ static int autosuspend_check(struct usb_device *udev)
 * or for the past.
 */
queue_delayed_work(ksuspend_usb_wq, udev-autosuspend,
-   suspend_time - jiffies);
+   round_jiffies_relative(suspend_time - jiffies));
}
return -EAGAIN;
}
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 125/149] USB: Don't autosuspend Blackberry devices.

2007-07-12 Thread Greg Kroah-Hartman
From: Jeremy Katz [EMAIL PROTECTED]

Blackberry devices charge over USB.  By autosuspending the port, they are
not able to charge reliably.

Signed-off-by: Jeremy Katz [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/quirks.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index f37fa01..1cfc87b 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -38,6 +38,11 @@ static const struct usb_device_id usb_quirk_list[] = {
/* Philips PSC805 audio device */
{ USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME },
 
+   /* RIM Blackberry */
+   { USB_DEVICE(0x0fca, 0x0001), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+   { USB_DEVICE(0x0fca, 0x0004), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+   { USB_DEVICE(0x0fca, 0x0006), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+
{ }  /* terminating entry must be last */
 };
 
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 123/149] USB: add IAD support to usbfs and sysfs

2007-07-12 Thread Greg Kroah-Hartman
From: Craig W. Nadler [EMAIL PROTECTED]

USB_IAD: Adds support for USB Interface Association Descriptors.

This patch adds support to the USB host stack for parsing, storing, and
displaying Interface Association Descriptors. In /proc/bus/usb/devices
lines starting with A: show the fields in an IAD. In sysfs if an
interface on a USB device is referenced by an IAD the following files
will be added to the sysfs directory for that interface:
iad_bFirstInterface, iad_bInterfaceCount, iad_bFunctionClass, and
iad_bFunctionSubClass, iad_bFunctionProtocol

Signed-off-by: Craig W. Nadler [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/config.c  |   15 +++
 drivers/usb/core/devices.c |   26 ++
 drivers/usb/core/message.c |   31 +++
 drivers/usb/core/sysfs.c   |   34 ++
 include/linux/usb.h|   10 ++
 5 files changed, 116 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 5e113db..cb69aa1 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -295,6 +295,7 @@ static int usb_parse_configuration(struct device *ddev, int 
cfgidx,
struct usb_descriptor_header *header;
int len, retval;
u8 inums[USB_MAXINTERFACES], nalts[USB_MAXINTERFACES];
+   unsigned iad_num = 0;
 
memcpy(config-desc, buffer, USB_DT_CONFIG_SIZE);
if (config-desc.bDescriptorType != USB_DT_CONFIG ||
@@ -372,6 +373,20 @@ static int usb_parse_configuration(struct device *ddev, 
int cfgidx,
++n;
}
 
+   } else if (header-bDescriptorType ==
+   USB_DT_INTERFACE_ASSOCIATION) {
+   if (iad_num == USB_MAXIADS) {
+   dev_warn(ddev, found more Interface 
+  Association Descriptors 
+  than allocated for in 
+  configuration %d\n, cfgno);
+   } else {
+   config-intf_assoc[iad_num] =
+   (struct usb_interface_assoc_descriptor
+   *)header;
+   iad_num++;
+   }
+
} else if (header-bDescriptorType == USB_DT_DEVICE ||
header-bDescriptorType == USB_DT_CONFIG)
dev_warn(ddev, config %d contains an unexpected 
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
index 6753ca0..87c794d 100644
--- a/drivers/usb/core/devices.c
+++ b/drivers/usb/core/devices.c
@@ -102,6 +102,10 @@ static const char *format_config =
 /* C:  #Ifs=dd Cfg#=dd Atr=xx MPwr=dddmA */
   C:%c #Ifs=%2d Cfg#=%2d Atr=%02x MxPwr=%3dmA\n;
   
+static const char *format_iad =
+/* A:  FirstIf#=dd IfCount=dd Cls=xx(s) Sub=xx Prot=xx */
+  A:  FirstIf#=%2d IfCount=%2d Cls=%02x(%-5s) Sub=%02x Prot=%02x\n;
+
 static const char *format_iface =
 /* I:  If#=dd Alt=dd #EPs=dd Cls=xx(s) Sub=xx Prot=xx Driver=*/
   I:%c If#=%2d Alt=%2d #EPs=%2d Cls=%02x(%-5s) Sub=%02x Prot=%02x 
Driver=%s\n;
@@ -146,6 +150,7 @@ static const struct class_info clas_info[] =
{USB_CLASS_STILL_IMAGE, still},
{USB_CLASS_CSCID,   scard},
{USB_CLASS_CONTENT_SEC, c-sec},
+   {USB_CLASS_VIDEO,   video},
{-1,unk.} /* leave as last */
 };
 
@@ -286,6 +291,21 @@ static char *usb_dump_interface(
return start;
 }
 
+static char *usb_dump_iad_descriptor(char *start, char *end,
+   const struct usb_interface_assoc_descriptor *iad)
+{
+   if (start  end)
+   return start;
+   start += sprintf(start, format_iad,
+iad-bFirstInterface,
+iad-bInterfaceCount,
+iad-bFunctionClass,
+class_decode(iad-bFunctionClass),
+iad-bFunctionSubClass,
+iad-bFunctionProtocol);
+   return start;
+}
+
 /* TBD:
  * 0. TBDs
  * 1. marking active interface altsettings (code lists all, but should mark
@@ -322,6 +342,12 @@ static char *usb_dump_config (
if (!config)/* getting these some in 2.3.7; none in 2.3.6 */
return start + sprintf(start, (null Cfg. desc.)\n);
start = usb_dump_config_descriptor(start, end, config-desc, active);
+   for (i = 0; i  USB_MAXIADS; i++) {
+   if (config-intf_assoc[i] == NULL)
+   break;
+   start = usb_dump_iad_descriptor(start, end,
+   config-intf_assoc[i]);
+   }
for (i = 0; i  config-desc.bNumInterfaces; i

[linux-usb-devel] [PATCH 122/149] USB: mos7720: change developer email addresses

2007-07-12 Thread Greg Kroah-Hartman
Update the original developer's email addresses at their request.


Cc: Vijaya Kumar [EMAIL PROTECTED]
Cc: Ajay Kumar [EMAIL PROTECTED]
Cc: Gurudeva [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/mos7720.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 5a4c33c..da60c30 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -9,9 +9,9 @@
  * the Free Software Foundation, version 2 of the License.
  *
  * Developed by:
- * VijayaKumar.G.N. [EMAIL PROTECTED]
- * AjayKumar [EMAIL PROTECTED]
- * Gurudeva.N. [EMAIL PROTECTED]
+ * Vijaya Kumar [EMAIL PROTECTED]
+ * Ajay Kumar [EMAIL PROTECTED]
+ * Gurudeva [EMAIL PROTECTED]
  *
  * Cleaned up from the original by:
  * Greg Kroah-Hartman [EMAIL PROTECTED]
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 120/149] USB: Don't resume root hub if the controller is suspended

2007-07-12 Thread Greg Kroah-Hartman
From: Alan Stern [EMAIL PROTECTED]

Root hubs can't be resumed if their parent controller device is still
suspended.  This patch (as925) adds a check for that condition in
hcd_bus_resume() and prevents it from being treated as a fatal
controller failure.

ehci-hcd is updated to add the corresponding test.  Unnecessary
debugging messages are removed from uhci-hcd and dummy-hcd.  The
error return code from dummy-hcd is changed to -ESHUTDOWN, the same as
the others.  ohci-hcd doesn't need any changes.

Suspend handling in the non-PCI host drivers is somewhat hit-and-miss.
This patch shouldn't have any effect on them.

Signed-off-by: Alan Stern [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/hcd.c |5 -
 drivers/usb/gadget/dummy_hcd.c |3 +--
 drivers/usb/host/ehci-hub.c|4 
 drivers/usb/host/uhci-hcd.c|5 ++---
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 5254c50..963520f 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1291,6 +1291,7 @@ int hcd_bus_resume(struct usb_device *rhdev)
 {
struct usb_hcd  *hcd = container_of(rhdev-bus, struct usb_hcd, self);
int status;
+   int old_state = hcd-state;
 
dev_dbg(rhdev-dev, usb %s%s\n,
rhdev-auto_pm ? auto- : , resume);
@@ -1309,9 +1310,11 @@ int hcd_bus_resume(struct usb_device *rhdev)
: USB_STATE_ADDRESS);
hcd-state = HC_STATE_RUNNING;
} else {
+   hcd-state = old_state;
dev_dbg(rhdev-dev, bus %s fail, err %d\n,
resume, status);
-   usb_hc_died(hcd);
+   if (status != -ESHUTDOWN)
+   usb_hc_died(hcd);
}
return status;
 }
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index fcb5526..9040b50 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -1784,8 +1784,7 @@ static int dummy_bus_resume (struct usb_hcd *hcd)
 
spin_lock_irq (dum-lock);
if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, hcd-flags)) {
-   dev_warn (hcd-self.root_hub-dev, HC isn't running!\n);
-   rc = -ENODEV;
+   rc = -ESHUTDOWN;
} else {
dum-rh_state = DUMMY_RH_RUNNING;
set_link_state (dum);
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 71aeca0..0dcb416 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -199,6 +199,10 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
if (time_before (jiffies, ehci-next_statechange))
msleep(5);
spin_lock_irq (ehci-lock);
+   if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, hcd-flags)) {
+   spin_unlock_irq(ehci-lock);
+   return -ESHUTDOWN;
+   }
 
/* Ideally and we've got a real resume here, and no port's power
 * was lost.  (For PCI, that means Vaux was maintained.)  But we
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index d22da26..76c555a 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -730,10 +730,9 @@ static int uhci_rh_resume(struct usb_hcd *hcd)
int rc = 0;
 
spin_lock_irq(uhci-lock);
-   if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, hcd-flags)) {
-   dev_warn(hcd-self.root_hub-dev, HC isn't running!\n);
+   if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, hcd-flags))
rc = -ESHUTDOWN;
-   } else if (!uhci-dead)
+   else if (!uhci-dead)
wakeup_rh(uhci);
spin_unlock_irq(uhci-lock);
return rc;
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 119/149] USB: Remove usages of dev-power.power_state

2007-07-12 Thread Greg Kroah-Hartman
From: Alan Stern [EMAIL PROTECTED]

This patch (as922) removes all but one of the remaining vestiges of
dev-power.power_state from usbcore.  The only usage left must remain
until the deprecated power/state sysfs attribute is gone.

Signed-off-by: Alan Stern [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/driver.c |6 +-
 drivers/usb/core/hcd.c|   10 --
 2 files changed, 1 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 3cd9af2..a3aed8d 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1196,11 +1196,7 @@ static int usb_resume_both(struct usb_device *udev)
/* We can't progagate beyond the USB subsystem,
 * so if a root hub's controller is suspended
 * then we're stuck. */
-   if (udev-dev.parent-power.power_state.event !=
-   PM_EVENT_ON)
-   status = -EHOSTUNREACH;
-   else
-   status = usb_resume_device(udev);
+   status = usb_resume_device(udev);
}
} else {
 
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 3df5385..5254c50 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -965,19 +965,9 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags)
else switch (hcd-state) {
case HC_STATE_RUNNING:
case HC_STATE_RESUMING:
-doit:
list_add_tail (urb-urb_list, ep-urb_list);
status = 0;
break;
-   case HC_STATE_SUSPENDED:
-   /* HC upstream links (register access, wakeup signaling) can 
work
-* even when the downstream links (and DMA etc) are quiesced; 
let
-* usbcore talk to the root hub.
-*/
-   if (hcd-self.controller-power.power_state.event == PM_EVENT_ON
-urb-dev-parent == NULL)
-   goto doit;
-   /* FALL THROUGH */
default:
status = -ESHUTDOWN;
break;
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 117/149] USB: Pete's taking over usblp

2007-07-12 Thread Greg Kroah-Hartman
From: Pete Zaitcev [EMAIL PROTECTED]

Vojtech agreed to pass usblp over to me, so if you find bugs don't bug him.

Signed-off-by: Pete Zaitcev [EMAIL PROTECTED]
Signed-off-by: Vojtech Pavlik [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 MAINTAINERS |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 228a45b..83e9195 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3723,12 +3723,12 @@ L:  [EMAIL PROTECTED]
 W: http://pegasus2.sourceforge.net/
 S: Maintained
 
-USB PRINTER DRIVER
-P: Vojtech Pavlik
-M: [EMAIL PROTECTED]
+USB PRINTER DRIVER (usblp)
+P: Pete Zaitcev
+M: [EMAIL PROTECTED]
 L: [EMAIL PROTECTED]
 L: linux-usb-devel@lists.sourceforge.net
-S: Maintained
+S: Supported
 
 USB RTL8150 DRIVER
 P: Petko Manolov
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 114/149] usb gadget: Rename husb2dev - usba

2007-07-12 Thread Greg Kroah-Hartman
From: Haavard Skinnemoen [EMAIL PROTECTED]

husb2dev was the internal name of the USB Device Controller on
AT32AP7000. Rename it to atmel_usba, which is closer to the official
name used in documentation and marketing material.

Signed-off-by: Haavard Skinnemoen [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/gadget/ether.c|2 +-
 drivers/usb/gadget/gadget_chips.h |8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 78e2402..dbaf867 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -277,7 +277,7 @@ MODULE_PARM_DESC(host_addr, Host Ethernet Address);
 #define DEV_CONFIG_CDC
 #endif
 
-#ifdef CONFIG_USB_GADGET_HUSB2DEV
+#ifdef CONFIG_USB_GADGET_ATMEL_USBA
 #define DEV_CONFIG_CDC
 #endif
 
diff --git a/drivers/usb/gadget/gadget_chips.h 
b/drivers/usb/gadget/gadget_chips.h
index 9c84b38..53e9139 100644
--- a/drivers/usb/gadget/gadget_chips.h
+++ b/drivers/usb/gadget/gadget_chips.h
@@ -82,10 +82,10 @@
 #definegadget_is_pxa27x(g) 0
 #endif
 
-#ifdef CONFIG_USB_GADGET_HUSB2DEV
-#define gadget_is_husb2dev(g)  !strcmp(husb2_udc, (g)-name)
+#ifdef CONFIG_USB_GADGET_ATMEL_USBA
+#define gadget_is_atmel_usba(g)!strcmp(atmel_usba_udc, (g)-name)
 #else
-#define gadget_is_husb2dev(g)  0
+#define gadget_is_atmel_usba(g)0
 #endif
 
 #ifdef CONFIG_USB_GADGET_S3C2410
@@ -198,7 +198,7 @@ static inline int usb_gadget_controller_number(struct 
usb_gadget *gadget)
return 0x16;
else if (gadget_is_mpc8272(gadget))
return 0x17;
-   else if (gadget_is_husb2dev(gadget))
+   else if (gadget_is_atmel_usba(gadget))
return 0x18;
else if (gadget_is_fsl_usb2(gadget))
return 0x19;
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 113/149] USB: Add URB_FREE_BUFFER flag and the logic behind it

2007-07-12 Thread Greg Kroah-Hartman
From: Marcel Holtmann [EMAIL PROTECTED]

USB: Add URB_FREE_BUFFER flag for freeing the transfer buffer

In some cases it is not needed that the driver keeps track of the
transfer buffer of an URB. It can be simply freed along with the
URB itself when the reference count goes down to zero. The new
flag URB_FREE_BUFFER enables this behavior.

Signed-off-by: Marcel Holtmann [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/urb.c |3 +++
 include/linux/usb.h|1 +
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index ac4273d..52ec44b 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -13,6 +13,9 @@ static void urb_destroy(struct kref *kref)
 {
struct urb *urb = to_urb(kref);
 
+   if (urb-transfer_flags  URB_FREE_BUFFER)
+   kfree(urb-transfer_buffer);
+
kfree(urb);
 }
 
diff --git a/include/linux/usb.h b/include/linux/usb.h
index efce9a4..533c323 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -994,6 +994,7 @@ extern int usb_disabled(void);
 #define URB_ZERO_PACKET0x0040  /* Finish bulk OUT with short 
packet */
 #define URB_NO_INTERRUPT   0x0080  /* HINT: no non-error interrupt
 * needed */
+#define URB_FREE_BUFFER0x0100  /* Free transfer buffer with 
the URB */
 
 struct usb_iso_packet_descriptor {
unsigned int offset;
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 112/149] USB: Fix up full-speed bInterval values in high-speed interrupt descriptor

2007-07-12 Thread Greg Kroah-Hartman
From: Laurent Pinchart [EMAIL PROTECTED]

Many device manufacturers are using full-speed bInterval values in high-speed
interrupt endpoint descriptors. If the bInterval value is greater than 16,
assume the device uses full-speed descriptors and fix the value accordingly.

Signed-off-by: Laurent Pinchart [EMAIL PROTECTED]
Acked-by: Alan Stern [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/core/config.c |   12 +---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 9152e12..5e113db 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -85,15 +85,21 @@ static int usb_parse_endpoint(struct device *ddev, int 
cfgno, int inum,
memcpy(endpoint-desc, d, n);
INIT_LIST_HEAD(endpoint-urb_list);
 
-   /* If the bInterval value is outside the legal range,
-* set it to a default value: 32 ms */
+   /* Fix up bInterval values outside the legal range. Use 32 ms if no
+* proper value can be guessed. */
i = 0;  /* i = min, j = max, n = default */
j = 255;
if (usb_endpoint_xfer_int(d)) {
i = 1;
switch (to_usb_device(ddev)-speed) {
case USB_SPEED_HIGH:
-   n = 9;  /* 32 ms = 2^(9-1) uframes */
+   /* Many device manufacturers are using full-speed
+* bInterval values in high-speed interrupt endpoint
+* descriptors. Try to fix those and fall back to a
+* 32 ms default value otherwise. */
+   n = fls(d-bInterval*8);
+   if (n == 0)
+   n = 9;  /* 32 ms = 2^(9-1) uframes */
j = 16;
break;
default:/* USB_SPEED_FULL or _LOW */
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 110/149] USB: usb-skeleton use anchors in suspend/resume handling

2007-07-12 Thread Greg Kroah-Hartman
From: Oliver Neukum [EMAIL PROTECTED]

use anchors in suspend/resume handling

Signed-off-by: Oliver Neukum [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/usb-skeleton.c |   42 +-
 1 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
index 1b1e669..59973ae 100644
--- a/drivers/usb/usb-skeleton.c
+++ b/drivers/usb/usb-skeleton.c
@@ -57,6 +57,7 @@ struct usb_skel {
__u8bulk_in_endpointAddr;   /* the address of the 
bulk in endpoint */
__u8bulk_out_endpointAddr;  /* the address of the 
bulk out endpoint */
int errors; /* the last request 
tanked */
+   int open_count; /* count the number of 
openers */
spinlock_t  err_lock;   /* lock for errors */
struct kref kref;
struct mutexio_mutex;   /* synchronize I/O with 
disconnect */
@@ -101,12 +102,26 @@ static int skel_open(struct inode *inode, struct file 
*file)
/* increment our usage count for the device */
kref_get(dev-kref);
 
-   /* prevent the device from being autosuspended */
-   retval = usb_autopm_get_interface(interface);
-   if (retval) {
+   /* lock the device to allow correctly handling errors
+* in resumption */
+   mutex_lock(dev-io_mutex);
+
+   if (!dev-open_count++) {
+   retval = usb_autopm_get_interface(interface);
+   if (retval) {
+   dev-open_count--;
+   mutex_unlock(dev-io_mutex);
+   kref_put(dev-kref, skel_delete);
+   goto exit;
+   }
+   } /* else { //uncomment this block if you want exclusive open
+   retval = -EBUSY;
+   dev-open_count--;
+   mutex_unlock(dev-io_mutex);
kref_put(dev-kref, skel_delete);
goto exit;
-   }
+   } */
+   /* prevent the device from being autosuspended */
 
/* save our object in the file's private structure */
file-private_data = dev;
@@ -125,7 +140,7 @@ static int skel_release(struct inode *inode, struct file 
*file)
 
/* allow the device to be autosuspended */
mutex_lock(dev-io_mutex);
-   if (dev-interface)
+   if (!--dev-open_count  dev-interface)
usb_autopm_put_interface(dev-interface);
mutex_unlock(dev-io_mutex);
 
@@ -437,10 +452,27 @@ static void skel_draw_down(struct usb_skel *dev)
usb_kill_anchored_urbs(dev-submitted);
 }
 
+static int skel_suspend(struct usb_interface *intf, pm_message_t message)
+{
+   struct usb_skel *dev = usb_get_intfdata(intf);
+
+   if (!dev)
+   return 0;
+   skel_draw_down(dev);
+   return 0;
+}
+
+static int skel_resume (struct usb_interface *intf)
+{
+   return 0;
+}
+
 static struct usb_driver skel_driver = {
.name = skeleton,
.probe =skel_probe,
.disconnect =   skel_disconnect,
+   .suspend =  skel_suspend,
+   .resume =   skel_resume,
.id_table = skel_table,
.supports_autosuspend = 1,
 };
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 109/149] USB: usb-skeleton: use anchors in disconnect handling

2007-07-12 Thread Greg Kroah-Hartman
From: Oliver Neukum [EMAIL PROTECTED]

use anchors in disconnect handling

Signed-off-by: Oliver Neukum [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/usb-skeleton.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
index a31fcfd..1b1e669 100644
--- a/drivers/usb/usb-skeleton.c
+++ b/drivers/usb/usb-skeleton.c
@@ -420,6 +420,8 @@ static void skel_disconnect(struct usb_interface *interface)
dev-interface = NULL;
mutex_unlock(dev-io_mutex);
 
+   usb_kill_anchored_urbs(dev-submitted);
+
/* decrement our usage count */
kref_put(dev-kref, skel_delete);
 
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 105/149] USB: sierra: cleanup the startup and shutdown path

2007-07-12 Thread Greg Kroah-Hartman
This removes the ugly code that was copied from the keyspan driver and
allocates the in urbs in a much shorter code path that can be understood
easier.

Also turned off the interrupt urb when no port was open as it's not nice
to keep the bus busy for no good reason at all (this should be a power
savings.)

All in all, this saved over 40 lines of code and cleaned things up
better.

Cc: Kevin Lloyd [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/sierra.c |  130 ++-
 1 files changed, 41 insertions(+), 89 deletions(-)

diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 551c6ce..e7db203 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -418,7 +418,7 @@ static int sierra_open(struct usb_serial_port *port, struct 
file *filp)
 {
struct sierra_port_private *portdata;
struct usb_serial *serial = port-serial;
-   int i, err;
+   int i;
struct urb *urb;
int result;
__u16 set_mode_dzero = 0x;
@@ -434,7 +434,7 @@ static int sierra_open(struct usb_serial_port *port, struct 
file *filp)
/* Reset low level data toggle and start reading from endpoints */
for (i = 0; i  N_IN_URB; i++) {
urb = portdata-in_urbs[i];
-   if (! urb)
+   if (!urb)
continue;
if (urb-dev != serial-dev) {
dbg(%s: dev %p != %p, __FUNCTION__,
@@ -448,11 +448,10 @@ static int sierra_open(struct usb_serial_port *port, 
struct file *filp)
 */
usb_clear_halt(urb-dev, urb-pipe);
 
-   err = usb_submit_urb(urb, GFP_KERNEL);
-   if (err) {
-   dbg(%s: submit urb %d failed (%d) %d,
-   __FUNCTION__, i, err,
-   urb-transfer_buffer_length);
+   result = usb_submit_urb(urb, GFP_KERNEL);
+   if (result) {
+   dev_err(port-dev, submit urb %d failed (%d) %d,
+   i, result, urb-transfer_buffer_length);
}
}
 
@@ -466,7 +465,14 @@ static int sierra_open(struct usb_serial_port *port, 
struct file *filp)
 
sierra_send_setup(port);
 
-   return (0);
+   /* start up the interrupt endpoint if we have one */
+   if (port-interrupt_in_urb) {
+   result = usb_submit_urb(port-interrupt_in_urb, GFP_KERNEL);
+   if (result)
+   dev_err(port-dev, submit irq_in urb failed %d,
+   result);
+   }
+   return 0;
 }
 
 static void sierra_close(struct usb_serial_port *port, struct file *filp)
@@ -486,62 +492,21 @@ static void sierra_close(struct usb_serial_port *port, 
struct file *filp)
 
/* Stop reading/writing urbs */
for (i = 0; i  N_IN_URB; i++)
-   usb_unlink_urb(portdata-in_urbs[i]);
-   }
-   port-tty = NULL;
-}
-
-/* Helper functions used by sierra_setup_urbs */
-static struct urb *sierra_setup_urb(struct usb_serial *serial, int endpoint,
-   int dir, void *ctx, char *buf, int len,
-   usb_complete_t callback)
-{
-   struct urb *urb;
-
-   if (endpoint == -1)
-   return NULL;/* endpoint not needed */
-
-   urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */
-   if (urb == NULL) {
-   dbg(%s: alloc for endpoint %d failed., __FUNCTION__, 
endpoint);
-   return NULL;
+   usb_kill_urb(portdata-in_urbs[i]);
}
 
-   /* Fill URB using supplied data. */
-   usb_fill_bulk_urb(urb, serial-dev,
- usb_sndbulkpipe(serial-dev, endpoint) | dir,
- buf, len, callback, ctx);
-
-   return urb;
-}
+   usb_kill_urb(port-interrupt_in_urb);
 
-/* Setup urbs */
-static void sierra_setup_urbs(struct usb_serial *serial)
-{
-   int i,j;
-   struct usb_serial_port *port;
-   struct sierra_port_private *portdata;
-
-   dbg(%s, __FUNCTION__);
-
-   for (i = 0; i  serial-num_ports; i++) {
-   port = serial-port[i];
-   portdata = usb_get_serial_port_data(port);
-
-   /* Do indat endpoints first */
-   for (j = 0; j  N_IN_URB; ++j) {
-   portdata-in_urbs[j] = sierra_setup_urb (serial,
-   port-bulk_in_endpointAddress, USB_DIR_IN, port,
-   portdata-in_buffer[j], IN_BUFLEN, 
sierra_indat_callback);
-   }
-   }
+   port-tty = NULL;
 }
 
 static int sierra_startup(struct usb_serial *serial)
 {
-   int i, err;
struct usb_serial_port *port;
struct sierra_port_private *portdata;
+   struct urb *urb;
+   int i;
+   int j

[linux-usb-devel] [PATCH 104/149] USB: sierra: remove incorrect usage of the urb status field

2007-07-12 Thread Greg Kroah-Hartman
You can't rely on the fact that the status really is correct like it was.

Also simplified the write path and now we allocate the urb and data on
the fly, instead of trying to do that really odd timeout check which I
am guessing doesn't really work properly.  This should speed up the
device by keeping the hardware queue full easier.

As a benefit, this reduces the size of the driver.

Cc: Kevin Lloyd [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/sierra.c |  221 +--
 1 files changed, 107 insertions(+), 114 deletions(-)

diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 6ee0b89..551c6ce 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -86,15 +86,14 @@ static int debug;
 #define N_IN_URB   4
 #define N_OUT_URB  4
 #define IN_BUFLEN  4096
-#define OUT_BUFLEN 128
 
 struct sierra_port_private {
+   spinlock_t lock;/* lock the structure */
+   int outstanding_urbs;   /* number of out urbs in flight */
+
/* Input endpoints and buffer for this port */
struct urb *in_urbs[N_IN_URB];
char in_buffer[N_IN_URB][IN_BUFLEN];
-   /* Output endpoints and buffer for this port */
-   struct urb *out_urbs[N_OUT_URB];
-   char out_buffer[N_OUT_URB][OUT_BUFLEN];
 
/* Settings for the port */
int rts_state;  /* Handshaking pins (outputs) */
@@ -103,8 +102,6 @@ struct sierra_port_private {
int dsr_state;
int dcd_state;
int ri_state;
-
-   unsigned long tx_start_time[N_OUT_URB];
 };
 
 static int sierra_send_setup(struct usb_serial_port *port)
@@ -197,61 +194,98 @@ static int sierra_ioctl(struct usb_serial_port *port, 
struct file *file,
return -ENOIOCTLCMD;
 }
 
+static void sierra_outdat_callback(struct urb *urb)
+{
+   struct usb_serial_port *port = urb-context;
+   struct sierra_port_private *portdata = usb_get_serial_port_data(port);
+   int status = urb-status;
+   unsigned long flags;
+
+   dbg(%s - port %d, __FUNCTION__, port-number);
+
+   /* free up the transfer buffer, as usb_free_urb() does not do this */
+   kfree(urb-transfer_buffer);
+
+   if (status)
+   dbg(%s - nonzero write bulk status received: %d,
+   __FUNCTION__, status);
+
+   spin_lock_irqsave(portdata-lock, flags);
+   --portdata-outstanding_urbs;
+   spin_unlock_irqrestore(portdata-lock, flags);
+
+   usb_serial_port_softint(port);
+}
+
 /* Write */
 static int sierra_write(struct usb_serial_port *port,
const unsigned char *buf, int count)
 {
-   struct sierra_port_private *portdata;
-   int i;
-   int left, todo;
-   struct urb *this_urb = NULL; /* spurious */
-   int err;
+   struct sierra_port_private *portdata = usb_get_serial_port_data(port);
+   struct usb_serial *serial = port-serial;
+   unsigned long flags;
+   unsigned char *buffer;
+   struct urb *urb;
+   int status;
 
portdata = usb_get_serial_port_data(port);
 
dbg(%s: write (%d chars), __FUNCTION__, count);
 
-   i = 0;
-   left = count;
-   for (i=0; left  0  i  N_OUT_URB; i++) {
-   todo = left;
-   if (todo  OUT_BUFLEN)
-   todo = OUT_BUFLEN;
-
-   this_urb = portdata-out_urbs[i];
-   if (this_urb-status == -EINPROGRESS) {
-   if (time_before(jiffies,
-   portdata-tx_start_time[i] + 10 * HZ))
-   continue;
-   usb_unlink_urb(this_urb);
-   continue;
-   }
-   if (this_urb-status != 0)
-   dbg(usb_write %p failed (err=%d),
-   this_urb, this_urb-status);
+   spin_lock_irqsave(portdata-lock, flags);
+   if (portdata-outstanding_urbs  N_OUT_URB) {
+   spin_unlock_irqrestore(portdata-lock, flags);
+   dbg(%s - write limit hit\n, __FUNCTION__);
+   return 0;
+   }
+   portdata-outstanding_urbs++;
+   spin_unlock_irqrestore(portdata-lock, flags);
+
+   buffer = kmalloc(count, GFP_ATOMIC);
+   if (!buffer) {
+   dev_err(port-dev, out of memory\n);
+   count = -ENOMEM;
+   goto error_no_buffer;
+   }
 
-   dbg(%s: endpoint %d buf %d, __FUNCTION__,
-   usb_pipeendpoint(this_urb-pipe), i);
+   urb = usb_alloc_urb(0, GFP_ATOMIC);
+   if (!urb) {
+   dev_err(port-dev, no more free urbs\n);
+   count = -ENOMEM;
+   goto error_no_urb;
+   }
 
-   /* send the data */
-   memcpy (this_urb-transfer_buffer, buf, todo);
-   this_urb-transfer_buffer_length = todo;
+   memcpy(buffer, buf, count

[linux-usb-devel] [PATCH 103/149] USB: serial: whiteheat: clean up urb-status usage

2007-07-12 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.


Cc: linux-usb-devel@lists.sourceforge.net
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/whiteheat.c |   25 -
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 8fd976d..8611ee5 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -974,10 +974,12 @@ static void whiteheat_unthrottle (struct usb_serial_port 
*port)
  */
 static void command_port_write_callback(struct urb *urb)
 {
+   int status = urb-status;
+
dbg(%s, __FUNCTION__);
 
-   if (urb-status) {
-   dbg (nonzero urb status: %d, urb-status);
+   if (status) {
+   dbg(nonzero urb status: %d, status);
return;
}
 }
@@ -987,6 +989,7 @@ static void command_port_read_callback(struct urb *urb)
 {
struct usb_serial_port *command_port = (struct usb_serial_port 
*)urb-context;
struct whiteheat_command_private *command_info;
+   int status = urb-status;
unsigned char *data = urb-transfer_buffer;
int result;
 
@@ -997,9 +1000,9 @@ static void command_port_read_callback(struct urb *urb)
dbg (%s - command_info is NULL, exiting., __FUNCTION__);
return;
}
-   if (urb-status) {
-   dbg(%s - nonzero urb status: %d, __FUNCTION__, urb-status);
-   if (urb-status != -ENOENT)
+   if (status) {
+   dbg(%s - nonzero urb status: %d, __FUNCTION__, status);
+   if (status != -ENOENT)
command_info-command_finished = WHITEHEAT_CMD_FAILURE;
wake_up(command_info-wait_command);
return;
@@ -1038,6 +1041,7 @@ static void whiteheat_read_callback(struct urb *urb)
struct whiteheat_urb_wrap *wrap;
unsigned char *data = urb-transfer_buffer;
struct whiteheat_private *info = usb_get_serial_port_data(port);
+   int status = urb-status;
 
dbg(%s - port %d, __FUNCTION__, port-number);
 
@@ -1051,8 +1055,9 @@ static void whiteheat_read_callback(struct urb *urb)
list_del(wrap-list);
spin_unlock(info-lock);
 
-   if (urb-status) {
-   dbg(%s - nonzero read bulk status received: %d, __FUNCTION__, 
urb-status);
+   if (status) {
+   dbg(%s - nonzero read bulk status received: %d,
+   __FUNCTION__, status);
spin_lock(info-lock);
list_add(wrap-list, info-rx_urbs_free);
spin_unlock(info-lock);
@@ -1079,6 +1084,7 @@ static void whiteheat_write_callback(struct urb *urb)
struct usb_serial_port *port = (struct usb_serial_port *)urb-context;
struct whiteheat_private *info = usb_get_serial_port_data(port);
struct whiteheat_urb_wrap *wrap;
+   int status = urb-status;
 
dbg(%s - port %d, __FUNCTION__, port-number);
 
@@ -1092,8 +1098,9 @@ static void whiteheat_write_callback(struct urb *urb)
list_move(wrap-list, info-tx_urbs_free);
spin_unlock(info-lock);
 
-   if (urb-status) {
-   dbg(%s - nonzero write bulk status received: %d, 
__FUNCTION__, urb-status);
+   if (status) {
+   dbg(%s - nonzero write bulk status received: %d,
+   __FUNCTION__, status);
return;
}
 
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 102/149] USB: serial: visor: clean up urb-status usage

2007-07-12 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.


Cc: linux-usb-devel@lists.sourceforge.net
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/visor.c |   20 
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 81ae76f..acd0eae 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -485,16 +485,17 @@ static void visor_write_bulk_callback (struct urb *urb)
 {
struct usb_serial_port *port = (struct usb_serial_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, __FUNCTION__, port-number);
-   
-   if (urb-status)
+
+   if (status)
dbg(%s - nonzero write bulk status received: %d,
-   __FUNCTION__, urb-status);
+   __FUNCTION__, status);
 
spin_lock_irqsave(priv-lock, flags);
--priv-outstanding_urbs;
@@ -509,14 +510,16 @@ static void visor_read_bulk_callback (struct urb *urb)
struct usb_serial_port *port = (struct usb_serial_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;
 
dbg(%s - port %d, __FUNCTION__, port-number);
 
-   if (urb-status) {
-   dbg(%s - nonzero read bulk status received: %d, __FUNCTION__, 
urb-status);
+   if (status) {
+   dbg(%s - nonzero read bulk status received: %d,
+   __FUNCTION__, status);
return;
}
 
@@ -556,9 +559,10 @@ static void visor_read_bulk_callback (struct urb *urb)
 static void visor_read_int_callback (struct urb *urb)
 {
struct usb_serial_port *port = (struct usb_serial_port *)urb-context;
+   int status = urb-status;
int result;
 
-   switch (urb-status) {
+   switch (status) {
case 0:
/* success */
break;
@@ -567,11 +571,11 @@ static void visor_read_int_callback (struct urb *urb)
case -ESHUTDOWN:
/* this urb is terminated, clean up */
dbg(%s - urb shutting down with status: %d,
-   __FUNCTION__, urb-status);
+   __FUNCTION__, status);
return;
default:
dbg(%s - nonzero urb status received: %d,
-   __FUNCTION__, urb-status);
+   __FUNCTION__, status);
goto exit;
}
 
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 098/149] USB: serial: pl2303: clean up urb-status usage

2007-07-12 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.


Cc: linux-usb-devel@lists.sourceforge.net
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/pl2303.c |   42 ++
 1 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 3022d65..4348c1f 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -961,11 +961,12 @@ static void pl2303_read_int_callback(struct urb *urb)
struct usb_serial_port *port = (struct usb_serial_port *) urb-context;
unsigned char *data = urb-transfer_buffer;
unsigned int actual_length = urb-actual_length;
-   int status;
+   int status = urb-status;
+   int retval;
 
dbg(%s (%d), __FUNCTION__, port-number);
 
-   switch (urb-status) {
+   switch (status) {
case 0:
/* success */
break;
@@ -974,11 +975,11 @@ static void pl2303_read_int_callback(struct urb *urb)
case -ESHUTDOWN:
/* this urb is terminated, clean up */
dbg(%s - urb shutting down with status: %d, __FUNCTION__,
-   urb-status);
+   status);
return;
default:
dbg(%s - nonzero urb status received: %d, __FUNCTION__,
-   urb-status);
+   status);
goto exit;
}
 
@@ -988,11 +989,11 @@ static void pl2303_read_int_callback(struct urb *urb)
pl2303_update_line_status(port, data, actual_length);
 
 exit:
-   status = usb_submit_urb(urb, GFP_ATOMIC);
-   if (status)
+   retval = usb_submit_urb(urb, GFP_ATOMIC);
+   if (retval)
dev_err(urb-dev-dev,
%s - usb_submit_urb failed with result %d\n,
-   __FUNCTION__, status);
+   __FUNCTION__, retval);
 }
 
 static void pl2303_read_bulk_callback(struct urb *urb)
@@ -1004,23 +1005,23 @@ static void pl2303_read_bulk_callback(struct urb *urb)
unsigned long flags;
int i;
int result;
-   u8 status;
+   int status = urb-status;
+   u8 line_status;
char tty_flag;
 
dbg(%s - port %d, __FUNCTION__, port-number);
 
-   if (urb-status) {
-   dbg(%s - urb-status = %d, __FUNCTION__, urb-status);
+   if (status) {
+   dbg(%s - urb status = %d, __FUNCTION__, status);
if (!port-open_count) {
dbg(%s - port is closed, exiting., __FUNCTION__);
return;
}
-   if (urb-status == -EPROTO) {
+   if (status == -EPROTO) {
/* PL2303 mysteriously fails with -EPROTO reschedule
 * the read */
dbg(%s - caught -EPROTO, resubmitting the urb,
__FUNCTION__);
-   urb-status = 0;
urb-dev = port-serial-dev;
result = usb_submit_urb(urb, GFP_ATOMIC);
if (result)
@@ -1040,18 +1041,18 @@ static void pl2303_read_bulk_callback(struct urb *urb)
tty_flag = TTY_NORMAL;
 
spin_lock_irqsave(priv-lock, flags);
-   status = priv-line_status;
+   line_status = priv-line_status;
priv-line_status = ~UART_STATE_TRANSIENT_MASK;
spin_unlock_irqrestore(priv-lock, flags);
wake_up_interruptible(priv-delta_msr_wait);
 
/* break takes precedence over parity, */
/* which takes precedence over framing errors */
-   if (status  UART_BREAK_ERROR )
+   if (line_status  UART_BREAK_ERROR )
tty_flag = TTY_BREAK;
-   else if (status  UART_PARITY_ERROR)
+   else if (line_status  UART_PARITY_ERROR)
tty_flag = TTY_PARITY;
-   else if (status  UART_FRAME_ERROR)
+   else if (line_status  UART_FRAME_ERROR)
tty_flag = TTY_FRAME;
dbg(%s - tty_flag = %d, __FUNCTION__, tty_flag);
 
@@ -1059,7 +1060,7 @@ static void pl2303_read_bulk_callback(struct urb *urb)
if (tty  urb-actual_length) {
tty_buffer_request_room(tty, urb-actual_length + 1);
/* overrun is special, not associated with a char */
-   if (status  UART_OVERRUN_ERROR)
+   if (line_status  UART_OVERRUN_ERROR)
tty_insert_flip_char(tty, 0, TTY_OVERRUN);
for (i = 0; i  urb-actual_length; ++i)
tty_insert_flip_char(tty, data[i], tty_flag);
@@ -1083,10 +1084,11 @@ static void pl2303_write_bulk_callback(struct urb *urb)
struct usb_serial_port *port = (struct usb_serial_port *) urb-context;
struct pl2303_private *priv = usb_get_serial_port_data(port);
int result;
+   int status

[linux-usb-devel] [PATCH 097/149] USB: serial: oti6858: clean up urb-status usage

2007-07-12 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.


Cc: linux-usb-devel@lists.sourceforge.net
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/oti6858.c |   35 ++-
 1 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index 2a60992..d7db71e 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -916,11 +916,12 @@ static void oti6858_read_int_callback(struct urb *urb)
struct usb_serial_port *port = (struct usb_serial_port *) urb-context;
struct oti6858_private *priv = usb_get_serial_port_data(port);
int transient = 0, can_recv = 0, resubmit = 1;
+   int status = urb-status;
 
-   dbg(%s(port = %d, urb-status = %d),
-   __FUNCTION__, port-number, urb-status);
+   dbg(%s(port = %d, status = %d),
+   __FUNCTION__, port-number, status);
 
-   switch (urb-status) {
+   switch (status) {
case 0:
/* success */
break;
@@ -929,15 +930,15 @@ static void oti6858_read_int_callback(struct urb *urb)
case -ESHUTDOWN:
/* this urb is terminated, clean up */
dbg(%s(): urb shutting down with status: %d,
-   __FUNCTION__, urb-status);
+   __FUNCTION__, status);
return;
default:
dbg(%s(): nonzero urb status received: %d,
-   __FUNCTION__, urb-status);
+   __FUNCTION__, status);
break;
}
 
-   if (urb-status == 0  urb-actual_length == OTI6858_CTRL_PKT_SIZE) {
+   if (status == 0  urb-actual_length == OTI6858_CTRL_PKT_SIZE) {
struct oti6858_control_pkt *xs = urb-transfer_buffer;
unsigned long flags;
 
@@ -1032,26 +1033,25 @@ static void oti6858_read_bulk_callback(struct urb *urb)
unsigned char *data = urb-transfer_buffer;
unsigned long flags;
int i, result;
+   int status = urb-status;
char tty_flag;
 
-   dbg(%s(port = %d, urb-status = %d),
-   __FUNCTION__, port-number, urb-status);
+   dbg(%s(port = %d, status = %d),
+   __FUNCTION__, port-number, status);
 
spin_lock_irqsave(priv-lock, flags);
priv-flags.read_urb_in_use = 0;
spin_unlock_irqrestore(priv-lock, flags);
 
-   if (urb-status != 0) {
+   if (status != 0) {
if (!port-open_count) {
dbg(%s(): port is closed, exiting, __FUNCTION__);
return;
}
/*
-   if (urb-status == -EPROTO) {
+   if (status == -EPROTO) {
// PL2303 mysteriously fails with -EPROTO reschedule 
the read
dbg(%s - caught -EPROTO, resubmitting the urb, 
__FUNCTION__);
-   urb-status = 0;
-   urb-dev = port-serial-dev;
result = usb_submit_urb(urb, GFP_ATOMIC);
if (result)
dev_err(urb-dev-dev, %s - failed 
resubmitting read urb, error %d\n, __FUNCTION__, result);
@@ -1101,12 +1101,13 @@ static void oti6858_write_bulk_callback(struct urb *urb)
 {
struct usb_serial_port *port = (struct usb_serial_port *) urb-context;
struct oti6858_private *priv = usb_get_serial_port_data(port);
+   int status = urb-status;
int result;
 
-   dbg(%s(port = %d, urb-status = %d),
-   __FUNCTION__, port-number, urb-status);
+   dbg(%s(port = %d, status = %d),
+   __FUNCTION__, port-number, status);
 
-   switch (urb-status) {
+   switch (status) {
case 0:
/* success */
break;
@@ -1115,13 +1116,13 @@ static void oti6858_write_bulk_callback(struct urb *urb)
case -ESHUTDOWN:
/* this urb is terminated, clean up */
dbg(%s(): urb shutting down with status: %d,
-   __FUNCTION__, urb-status);
+   __FUNCTION__, status);
priv-flags.write_urb_in_use = 0;
return;
default:
/* error in the urb, so we have to resubmit it */
dbg(%s(): nonzero write bulk status received: %d,
-   __FUNCTION__, urb-status);
+   __FUNCTION__, status);
dbg(%s(): overflow in write, __FUNCTION__);
 
port-write_urb-transfer_buffer_length = 1;
-- 
1.5.2.2

[linux-usb-devel] [PATCH 096/149] USB: serial: option: clean up urb-status usage

2007-07-12 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.


Cc: linux-usb-devel@lists.sourceforge.net
Cc: Matthias Urlichs [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/option.c |   14 --
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index b37d65f..84c12b5 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -416,15 +416,16 @@ static void option_indat_callback(struct urb *urb)
struct usb_serial_port *port;
struct tty_struct *tty;
unsigned char *data = urb-transfer_buffer;
+   int status = urb-status;
 
dbg(%s: %p, __FUNCTION__, urb);
 
endpoint = usb_pipeendpoint(urb-pipe);
port = (struct usb_serial_port *) urb-context;
 
-   if (urb-status) {
+   if (status) {
dbg(%s: nonzero status: %d on endpoint %02x.,
-   __FUNCTION__, urb-status, endpoint);
+   __FUNCTION__, status, endpoint);
} else {
tty = port-tty;
if (urb-actual_length) {
@@ -436,7 +437,7 @@ static void option_indat_callback(struct urb *urb)
}
 
/* Resubmit urb so we continue receiving */
-   if (port-open_count  urb-status != -ESHUTDOWN) {
+   if (port-open_count  status != -ESHUTDOWN) {
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err)
printk(KERN_ERR %s: resubmit read urb failed. 
@@ -471,6 +472,7 @@ static void option_outdat_callback(struct urb *urb)
 static void option_instat_callback(struct urb *urb)
 {
int err;
+   int status = urb-status;
struct usb_serial_port *port = (struct usb_serial_port *) urb-context;
struct option_port_private *portdata = usb_get_serial_port_data(port);
struct usb_serial *serial = port-serial;
@@ -478,7 +480,7 @@ static void option_instat_callback(struct urb *urb)
dbg(%s, __FUNCTION__);
dbg(%s: urb %p port %p has data %p, __FUNCTION__,urb,port,portdata);
 
-   if (urb-status == 0) {
+   if (status == 0) {
struct usb_ctrlrequest *req_pkt =
(struct usb_ctrlrequest *)urb-transfer_buffer;
 
@@ -509,10 +511,10 @@ static void option_instat_callback(struct urb *urb)
req_pkt-bRequestType,req_pkt-bRequest);
}
} else
-   dbg(%s: error %d, __FUNCTION__, urb-status);
+   dbg(%s: error %d, __FUNCTION__, status);
 
/* Resubmit urb so we continue receiving IRQ data */
-   if (urb-status != -ESHUTDOWN) {
+   if (status != -ESHUTDOWN) {
urb-dev = serial-dev;
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err)
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 092/149] USB: serial: mos7720: clean up urb-status usage

2007-07-12 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.


Cc: linux-usb-devel@lists.sourceforge.net
Cc: VijayaKumar G.N. [EMAIL PROTECTED]
Cc: AjayKumar [EMAIL PROTECTED]
Cc: Gurudeva N. [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/mos7720.c |   27 +++
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index b563e2a..5a4c33c 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -103,6 +103,7 @@ static void mos7720_interrupt_callback(struct urb *urb)
 {
int result;
int length;
+   int status = urb-status;
__u8 *data;
__u8 sp1;
__u8 sp2;
@@ -114,7 +115,7 @@ static void mos7720_interrupt_callback(struct urb *urb)
return;
}
 
-   switch (urb-status) {
+   switch (status) {
case 0:
/* success */
break;
@@ -123,11 +124,11 @@ static void mos7720_interrupt_callback(struct urb *urb)
case -ESHUTDOWN:
/* this urb is terminated, clean up */
dbg(%s - urb shutting down with status: %d, __FUNCTION__,
-   urb-status);
+   status);
return;
default:
dbg(%s - nonzero urb status received: %d, __FUNCTION__,
-   urb-status);
+   status);
goto exit;
}
 
@@ -198,14 +199,15 @@ exit:
  */
 static void mos7720_bulk_in_callback(struct urb *urb)
 {
-   int status;
+   int retval;
unsigned char *data ;
struct usb_serial_port *port;
struct moschip_port *mos7720_port;
struct tty_struct *tty;
+   int status = urb-status;
 
-   if (urb-status) {
-   dbg(nonzero read bulk status received: %d,urb-status);
+   if (status) {
+   dbg(nonzero read bulk status received: %d, status);
return;
}
 
@@ -236,10 +238,10 @@ static void mos7720_bulk_in_callback(struct urb *urb)
if (port-read_urb-status != -EINPROGRESS) {
port-read_urb-dev = port-serial-dev;
 
-   status = usb_submit_urb(port-read_urb, GFP_ATOMIC);
-   if (status)
-   dbg(usb_submit_urb(read bulk) failed, status = %d,
-   status);
+   retval = usb_submit_urb(port-read_urb, GFP_ATOMIC);
+   if (retval)
+   dbg(usb_submit_urb(read bulk) failed, retval = %d,
+   retval);
}
 }
 
@@ -252,9 +254,10 @@ static void mos7720_bulk_out_data_callback(struct urb *urb)
 {
struct moschip_port *mos7720_port;
struct tty_struct *tty;
+   int status = urb-status;
 
-   if (urb-status) {
-   dbg(nonzero write bulk status received:%d, urb-status);
+   if (status) {
+   dbg(nonzero write bulk status received:%d, status);
return;
}
 
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH 090/149] USB: serial: kobil_sct: clean up urb-status usage

2007-07-12 Thread Greg Kroah-Hartman
This done in anticipation of removal of urb-status, which will make
that patch easier to review and apply in the future.


Cc: linux-usb-devel@lists.sourceforge.net
Cc: Thomas Wahrenbruch [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
---
 drivers/usb/serial/kobil_sct.c |   26 ++
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index 0683b51..02a86db 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -358,24 +358,26 @@ static void kobil_close (struct usb_serial_port *port, 
struct file *filp)
 }
 
 
-static void kobil_read_int_callback( struct urb *purb)
+static void kobil_read_int_callback(struct urb *urb)
 {
int result;
-   struct usb_serial_port *port = (struct usb_serial_port *) purb-context;
+   struct usb_serial_port *port = urb-context;
struct tty_struct *tty;
-   unsigned char *data = purb-transfer_buffer;
+   unsigned char *data = urb-transfer_buffer;
+   int status = urb-status;
 // char *dbg_data;
 
dbg(%s - port %d, __FUNCTION__, port-number);
 
-   if (purb-status) {
-   dbg(%s - port %d Read int status not zero: %d, __FUNCTION__, 
port-number, purb-status);
+   if (status) {
+   dbg(%s - port %d Read int status not zero: %d,
+   __FUNCTION__, port-number, status);
return;
}
-   
-   tty = port-tty; 
-   if (purb-actual_length) {
-   
+
+   tty = port-tty;
+   if (urb-actual_length) {
+
// BEGIN DEBUG
/*
  dbg_data = kzalloc((3 *  purb-actual_length + 10) * 
sizeof(char), GFP_KERNEL);
@@ -390,15 +392,15 @@ static void kobil_read_int_callback( struct urb *purb)
*/
// END DEBUG
 
-   tty_buffer_request_room(tty, purb-actual_length);
-   tty_insert_flip_string(tty, data, purb-actual_length);
+   tty_buffer_request_room(tty, urb-actual_length);
+   tty_insert_flip_string(tty, data, urb-actual_length);
tty_flip_buffer_push(tty);
}
 
// someone sets the dev to 0 if the close method has been called
port-interrupt_in_urb-dev = port-serial-dev;
 
-   result = usb_submit_urb( port-interrupt_in_urb, GFP_ATOMIC ); 
+   result = usb_submit_urb(port-interrupt_in_urb, GFP_ATOMIC);
dbg(%s - port %d Send read URB returns: %i, __FUNCTION__, 
port-number, result);
 }
 
-- 
1.5.2.2


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


  1   2   3   4   5   6   >