aboutsummaryrefslogtreecommitdiffstats
diff options
-rw-r--r--series2
-rw-r--r--usb/usb-remove-fake-address-of-expressions.patch137
-rw-r--r--usb/usb-serial-fix-stalled-writes.patch63
3 files changed, 202 insertions, 0 deletions
diff --git a/series b/series
index cb480aedaceb66..44bd1f11e121f9 100644
--- a/series
+++ b/series
@@ -287,6 +287,8 @@ usb/usb-xhci-set-dma-mask-for-host.patch
usb/usb-usbtest-avoid-to-free-coherent-buffer-in-atomic-context.patch
usb/usb-usbtest-support-test-device-with-only-one-iso-in-or-iso-out-endpoint.patch
usb/usb-fix-thread-unsafe-anchor-utiliy-routines.patch
+usb/usb-remove-fake-address-of-expressions.patch
+usb/usb-serial-fix-stalled-writes.patch
# staging stuff is now in the staging-next tree on git.kernel.org
diff --git a/usb/usb-remove-fake-address-of-expressions.patch b/usb/usb-remove-fake-address-of-expressions.patch
new file mode 100644
index 00000000000000..30e315b0bbb683
--- /dev/null
+++ b/usb/usb-remove-fake-address-of-expressions.patch
@@ -0,0 +1,137 @@
+From stern+4c5c36d6@rowland.harvard.edu Thu Aug 5 12:52:02 2010
+Date: Thu, 5 Aug 2010 13:12:14 -0400 (EDT)
+From: Alan Stern <stern@rowland.harvard.edu>
+To: Greg KH <greg@kroah.com>
+Subject: USB: remove fake "address-of" expressions
+Message-ID: <Pine.LNX.4.44L0.1008051309560.1944-100000@iolanthe.rowland.org>
+
+Fake "address-of" expressions that evaluate to NULL generally confuse
+readers and can provoke compiler warnings. This patch (as1412)
+removes three such fake expressions, using "#ifdef"s in their place.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/core/driver.c | 6 ++----
+ drivers/usb/core/usb.c | 6 ++----
+ drivers/usb/host/uhci-debug.c | 3 +--
+ drivers/usb/host/uhci-hcd.c | 23 ++++++++++-------------
+ 4 files changed, 15 insertions(+), 23 deletions(-)
+
+--- a/drivers/usb/core/driver.c
++++ b/drivers/usb/core/driver.c
+@@ -1791,15 +1791,13 @@ static const struct dev_pm_ops usb_bus_p
+ .runtime_idle = usb_runtime_idle,
+ };
+
+-#else
+-
+-#define usb_bus_pm_ops (*(const struct dev_pm_ops *) NULL)
+-
+ #endif /* CONFIG_USB_SUSPEND */
+
+ struct bus_type usb_bus_type = {
+ .name = "usb",
+ .match = usb_device_match,
+ .uevent = usb_uevent,
++#ifdef CONFIG_USB_SUSPEND
+ .pm = &usb_bus_pm_ops,
++#endif
+ };
+--- a/drivers/usb/core/usb.c
++++ b/drivers/usb/core/usb.c
+@@ -317,10 +317,6 @@ static const struct dev_pm_ops usb_devic
+ .restore = usb_dev_restore,
+ };
+
+-#else
+-
+-#define usb_device_pm_ops (*(struct dev_pm_ops *) NULL)
+-
+ #endif /* CONFIG_PM */
+
+
+@@ -338,7 +334,9 @@ struct device_type usb_device_type = {
+ .release = usb_release_dev,
+ .uevent = usb_dev_uevent,
+ .devnode = usb_devnode,
++#ifdef CONFIG_PM
+ .pm = &usb_device_pm_ops,
++#endif
+ };
+
+
+--- a/drivers/usb/host/uhci-debug.c
++++ b/drivers/usb/host/uhci-debug.c
+@@ -17,7 +17,6 @@
+
+ #include "uhci-hcd.h"
+
+-#define uhci_debug_operations (* (const struct file_operations *) NULL)
+ static struct dentry *uhci_debugfs_root;
+
+ #ifdef DEBUG
+@@ -558,7 +557,6 @@ static int uhci_debug_release(struct ino
+ return 0;
+ }
+
+-#undef uhci_debug_operations
+ static const struct file_operations uhci_debug_operations = {
+ .owner = THIS_MODULE,
+ .open = uhci_debug_open,
+@@ -566,6 +564,7 @@ static const struct file_operations uhci
+ .read = uhci_debug_read,
+ .release = uhci_debug_release,
+ };
++#define UHCI_DEBUG_OPS
+
+ #endif /* CONFIG_DEBUG_FS */
+
+--- a/drivers/usb/host/uhci-hcd.c
++++ b/drivers/usb/host/uhci-hcd.c
+@@ -597,7 +597,7 @@ static int uhci_start(struct usb_hcd *hc
+ struct uhci_hcd *uhci = hcd_to_uhci(hcd);
+ int retval = -EBUSY;
+ int i;
+- struct dentry *dentry;
++ struct dentry __maybe_unused *dentry;
+
+ hcd->uses_new_polling = 1;
+
+@@ -607,18 +607,16 @@ static int uhci_start(struct usb_hcd *hc
+ INIT_LIST_HEAD(&uhci->idle_qh_list);
+ init_waitqueue_head(&uhci->waitqh);
+
+- if (DEBUG_CONFIGURED) {
+- dentry = debugfs_create_file(hcd->self.bus_name,
+- S_IFREG|S_IRUGO|S_IWUSR, uhci_debugfs_root,
+- uhci, &uhci_debug_operations);
+- if (!dentry) {
+- dev_err(uhci_dev(uhci), "couldn't create uhci "
+- "debugfs entry\n");
+- retval = -ENOMEM;
+- goto err_create_debug_entry;
+- }
+- uhci->dentry = dentry;
++#ifdef UHCI_DEBUG_OPS
++ dentry = debugfs_create_file(hcd->self.bus_name,
++ S_IFREG|S_IRUGO|S_IWUSR, uhci_debugfs_root,
++ uhci, &uhci_debug_operations);
++ if (!dentry) {
++ dev_err(uhci_dev(uhci), "couldn't create uhci debugfs entry\n");
++ return -ENOMEM;
+ }
++ uhci->dentry = dentry;
++#endif
+
+ uhci->frame = dma_alloc_coherent(uhci_dev(uhci),
+ UHCI_NUMFRAMES * sizeof(*uhci->frame),
+@@ -732,7 +730,6 @@ err_alloc_frame_cpu:
+ err_alloc_frame:
+ debugfs_remove(uhci->dentry);
+
+-err_create_debug_entry:
+ return retval;
+ }
+
diff --git a/usb/usb-serial-fix-stalled-writes.patch b/usb/usb-serial-fix-stalled-writes.patch
new file mode 100644
index 00000000000000..0dd51f9d1587a2
--- /dev/null
+++ b/usb/usb-serial-fix-stalled-writes.patch
@@ -0,0 +1,63 @@
+From jhovold@gmail.com Thu Aug 5 12:52:30 2010
+From: Johan Hovold <jhovold@gmail.com>
+To: Greg KH <greg@kroah.com>
+Cc: David VomLehn <dvomlehn@cisco.com>,
+ linux-usb@vger.kernel.org,
+ alexander.stein@systec-electronic.com,
+ Johan Hovold <jhovold@gmail.com>
+Subject: USB: serial: fix stalled writes
+Date: Wed, 4 Aug 2010 15:45:57 +0200
+Message-Id: <1280929557-5670-1-git-send-email-jhovold@gmail.com>
+
+As David VomLehn points out, it was possible to receive an interrupt
+before clearing the free-urb flag which could lead to the urb being
+incorrectly marked as busy.
+
+For the same reason, move tx_bytes accounting so that it will never be
+negative.
+
+Note that the free-flags set and clear operations do not need any
+additional locking as they are manipulated while USB_SERIAL_WRITE_BUSY
+is set.
+
+Reported-by: David VomLehn <dvomlehn@cisco.com>
+Tested-by: David VomLehn <dvomlehn@cisco.com>
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Cc: stable <stable@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/generic.c | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+--- a/drivers/usb/serial/generic.c
++++ b/drivers/usb/serial/generic.c
+@@ -208,18 +208,23 @@ retry:
+ urb->transfer_buffer_length = count;
+ usb_serial_debug_data(debug, &port->dev, __func__, count,
+ urb->transfer_buffer);
++ spin_lock_irqsave(&port->lock, flags);
++ port->tx_bytes += count;
++ spin_unlock_irqrestore(&port->lock, flags);
++
++ clear_bit(i, &port->write_urbs_free);
+ result = usb_submit_urb(urb, GFP_ATOMIC);
+ if (result) {
+ dev_err(&port->dev, "%s - error submitting urb: %d\n",
+ __func__, result);
++ set_bit(i, &port->write_urbs_free);
++ spin_lock_irqsave(&port->lock, flags);
++ port->tx_bytes -= count;
++ spin_unlock_irqrestore(&port->lock, flags);
++
+ clear_bit_unlock(USB_SERIAL_WRITE_BUSY, &port->flags);
+ return result;
+ }
+- clear_bit(i, &port->write_urbs_free);
+-
+- spin_lock_irqsave(&port->lock, flags);
+- port->tx_bytes += count;
+- spin_unlock_irqrestore(&port->lock, flags);
+
+ /* Try sending off another urb, unless in irq context (in which case
+ * there will be no free urb). */