aboutsummaryrefslogtreecommitdiffstats
diff options
-rw-r--r--driver-core/kobject-should-use-kobject_put-in-kset-example.patch29
-rw-r--r--driver-core/sysdev-fix-debugging-statements-in-registration-code.patch72
-rw-r--r--driver-core/uio-minor-style-and-comment-fixes.patch40
-rw-r--r--series12
-rw-r--r--usb.current/ohci-fix-problem-if-sm501-and-another-platform-driver-is-selected.patch73
-rw-r--r--usb/usb-add-usb_dev_reset_delayed.patch2
-rw-r--r--usb/usb-ehci-hcd-unlink-speedups.patch102
-rw-r--r--usb/usb-gadget-documentation-update.patch49
-rw-r--r--usb/usb-host-mark-const-variable-tables-as-const.patch38
-rw-r--r--usb/usb-hub-add-check-for-unsupported-bus-topology.patch59
-rw-r--r--usb/usb-irda-cleanup-on-ir-usb-module.patch920
-rw-r--r--usb/usb-uhci-mark-root_hub_hub_des-as-const.patch32
-rw-r--r--usb/usb-usbmon-use-simple_read_from_buffer.patch51
13 files changed, 1478 insertions, 1 deletions
diff --git a/driver-core/kobject-should-use-kobject_put-in-kset-example.patch b/driver-core/kobject-should-use-kobject_put-in-kset-example.patch
new file mode 100644
index 00000000000000..743efbb4e58ce5
--- /dev/null
+++ b/driver-core/kobject-should-use-kobject_put-in-kset-example.patch
@@ -0,0 +1,29 @@
+From lizf@cn.fujitsu.com Fri Jun 13 17:33:08 2008
+From: Li Zefan <lizf@cn.fujitsu.com>
+Date: Fri, 13 Jun 2008 11:09:16 +0800
+Subject: kobject: should use kobject_put() in kset-example
+To: Greg KH <gregkh@suse.de>
+Message-ID: <4851E4DC.6040603@cn.fujitsu.com>
+
+
+We should call kobject_put() instead of kfree() if kobject_init_and_add()
+returns an error, shouldn't we? Don't set up a bad example ;)
+
+Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ samples/kobject/kset-example.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/samples/kobject/kset-example.c
++++ b/samples/kobject/kset-example.c
+@@ -211,7 +211,7 @@ static struct foo_obj *create_foo_obj(co
+ */
+ retval = kobject_init_and_add(&foo->kobj, &foo_ktype, NULL, "%s", name);
+ if (retval) {
+- kfree(foo);
++ kobject_put(&foo->kobj);
+ return NULL;
+ }
+
diff --git a/driver-core/sysdev-fix-debugging-statements-in-registration-code.patch b/driver-core/sysdev-fix-debugging-statements-in-registration-code.patch
new file mode 100644
index 00000000000000..d83139c213f2a9
--- /dev/null
+++ b/driver-core/sysdev-fix-debugging-statements-in-registration-code.patch
@@ -0,0 +1,72 @@
+From ben-linux@fluff.org Fri Jun 13 17:33:39 2008
+From: Ben Dooks <ben-linux@fluff.org>
+Date: Thu, 12 Jun 2008 19:00:34 +0100
+Subject: sysdev: fix debugging statements in registration code.
+To: gregkh@suse.de, linux-kernel@vger.kernel.org
+Cc: ben@fluff.org, Ben Dooks <ben-linux@fluff.org>
+Message-ID: <20080612180034.607582396@fluff.org.uk>
+
+
+The systdev_class_register() and sysdev_register() functions have
+pr_debug() statements which are enabled when the user selects the
+driver core debug. Both of these routines do not produce the
+correct output, as they make assumptions about data which has not
+been initialised.
+
+In sysdev_class_register() the code uses the kobject_name(&cls->kset.kobj)
+at the start of the function, but this is not setup until later in the
+same call. Change this to use cls->name which is passed in from the caller.
+
+The sysdev_register() function tries to get the name of the sysdev by
+kobject_name(&sysdev->kobj), but that isn't setup until later in the same
+function so change this message to use the name of the sysdev's class and
+add another message once the name is initialised.
+
+Signed-off-by: Ben Dooks <ben-linux@fluff.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/base/sys.c | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+--- a/drivers/base/sys.c
++++ b/drivers/base/sys.c
+@@ -130,8 +130,8 @@ static struct kset *system_kset;
+
+ int sysdev_class_register(struct sysdev_class * cls)
+ {
+- pr_debug("Registering sysdev class '%s'\n",
+- kobject_name(&cls->kset.kobj));
++ pr_debug("Registering sysdev class '%s'\n", cls->name);
++
+ INIT_LIST_HEAD(&cls->drivers);
+ memset(&cls->kset.kobj, 0x00, sizeof(struct kobject));
+ cls->kset.kobj.parent = &system_kset->kobj;
+@@ -241,7 +241,8 @@ int sysdev_register(struct sys_device *
+ if (!cls)
+ return -EINVAL;
+
+- pr_debug("Registering sys device '%s'\n", kobject_name(&sysdev->kobj));
++ pr_debug("Registering sys device of class '%s'\n",
++ kobject_name(&cls->kset.kobj));
+
+ /* initialize the kobject to 0, in case it had previously been used */
+ memset(&sysdev->kobj, 0x00, sizeof(struct kobject));
+@@ -257,6 +258,9 @@ int sysdev_register(struct sys_device *
+ if (!error) {
+ struct sysdev_driver * drv;
+
++ pr_debug("Registering sys device '%s'\n",
++ kobject_name(&sysdev->kobj));
++
+ mutex_lock(&sysdev_drivers_lock);
+ /* Generic notification is implicit, because it's that
+ * code that should have called us.
+@@ -269,6 +273,7 @@ int sysdev_register(struct sys_device *
+ }
+ mutex_unlock(&sysdev_drivers_lock);
+ }
++
+ kobject_uevent(&sysdev->kobj, KOBJ_ADD);
+ return error;
+ }
diff --git a/driver-core/uio-minor-style-and-comment-fixes.patch b/driver-core/uio-minor-style-and-comment-fixes.patch
new file mode 100644
index 00000000000000..94bb0b736ec1cd
--- /dev/null
+++ b/driver-core/uio-minor-style-and-comment-fixes.patch
@@ -0,0 +1,40 @@
+From Uwe.Kleine-Koenig@digi.com Fri Jun 13 17:32:12 2008
+From: Uwe Kleine-K�nig <Uwe.Kleine-Koenig@digi.com>
+Date: Tue, 10 Jun 2008 09:14:48 +0200
+Subject: UIO: minor style and comment fixes
+To: Magnus Damm <magnus.damm@gmail.com>
+Cc: Paul Mundt <lethal@linux-sh.org>, "Hans J. Koch" <hjk@linutronix.de>, Greg KH <gregkh@suse.de>, Andrew Morton <akpm@linux-foundation.org>, Thomas Gleixner <tglx@linutronix.de>
+Message-ID: <1213082088-24294-1-git-send-email-Uwe.Kleine-Koenig@digi.com>
+
+
+Signed-off-by: Uwe Kleine-K�nig <Uwe.Kleine-Koenig@digi.com>
+Signed-off-by: Hans J. Koch <hjk@linutronix.de>
+---
+ include/linux/uio_driver.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/include/linux/uio_driver.h
++++ b/include/linux/uio_driver.h
+@@ -36,7 +36,7 @@ struct uio_mem {
+ struct uio_map *map;
+ };
+
+-#define MAX_UIO_MAPS 5
++#define MAX_UIO_MAPS 5
+
+ struct uio_device;
+
+@@ -82,11 +82,11 @@ static inline int __must_check
+ extern void uio_unregister_device(struct uio_info *info);
+ extern void uio_event_notify(struct uio_info *info);
+
+-/* defines for uio_device->irq */
++/* defines for uio_info->irq */
+ #define UIO_IRQ_CUSTOM -1
+ #define UIO_IRQ_NONE -2
+
+-/* defines for uio_device->memtype */
++/* defines for uio_mem->memtype */
+ #define UIO_MEM_NONE 0
+ #define UIO_MEM_PHYS 1
+ #define UIO_MEM_LOGICAL 2
diff --git a/series b/series
index c45213330b10a9..eb4f5040041e61 100644
--- a/series
+++ b/series
@@ -18,6 +18,7 @@ driver-core.current/kobject-fix-kobject_rename-and-config_sysfs.patch
#################################
# USB patches for 2.6.26
#################################
+usb.current/ohci-fix-problem-if-sm501-and-another-platform-driver-is-selected.patch
#####################################################################
# Stuff to be merged after 2.6.26 is out
@@ -91,7 +92,10 @@ driver-core/pnp-add-acpi-modalias-entries.patch
driver-core/uio-fix-uio-kconfig-dependancies.patch
driver-core/uio-add-write-function-to-allow-irq-masking.patch
driver-core/uio-add-generic-uio-platform-driver.patch
+driver-core/uio-minor-style-and-comment-fixes.patch
driver-core/kobject-reorder-kobject-to-save-space-on-64-bit-builds.patch
+driver-core/kobject-should-use-kobject_put-in-kset-example.patch
+driver-core/sysdev-fix-debugging-statements-in-registration-code.patch
# bus_id fun
driver-core/pci-make-pci_name-use-dev_name.patch
@@ -201,6 +205,13 @@ usb/usb-speedtch.c-fix-sparse-shadowed-variable-warning.patch
usb/usb-missing-usb_put_hcd-to-ohci-at91.patch
usb/usb-make-sa1111-ohci-driver-sa11x0-specific.patch
usb/usb-ohci_hcd-hang-submit-vs.-rmmod-race.patch
+usb/usb-hub-add-check-for-unsupported-bus-topology.patch
+usb/usb-ehci-hcd-unlink-speedups.patch
+usb/usb-irda-cleanup-on-ir-usb-module.patch
+usb/usb-gadget-documentation-update.patch
+usb/usb-host-mark-const-variable-tables-as-const.patch
+usb/usb-uhci-mark-root_hub_hub_des-as-const.patch
+usb/usb-usbmon-use-simple_read_from_buffer.patch
# wireless usb, still a work in progress
usb/bitmap-add-bitmap_copy_le.patch
@@ -252,3 +263,4 @@ usb/usb-gotemp.patch
#pending/firmware-add-kconfig-and-makefile-to-build-the-firmware-samples.patch
+
diff --git a/usb.current/ohci-fix-problem-if-sm501-and-another-platform-driver-is-selected.patch b/usb.current/ohci-fix-problem-if-sm501-and-another-platform-driver-is-selected.patch
new file mode 100644
index 00000000000000..7821beda1119b3
--- /dev/null
+++ b/usb.current/ohci-fix-problem-if-sm501-and-another-platform-driver-is-selected.patch
@@ -0,0 +1,73 @@
+From ben-linux@fluff.org Fri Jun 13 17:39:48 2008
+From: Ben Dooks <ben-linux@fluff.org>
+Date: Sun, 08 Jun 2008 17:20:11 +0100
+Subject: OHCI: Fix problem if SM501 and another platform driver is selected
+To: linux-usb@vger.kernel.org
+Cc: Ben Dooks <ben-linux@fluff.org>
+Message-ID: <20080608162011.190329883@fluff.org.uk>
+
+From: Ben Dooks <ben-linux@fluff.org>
+
+If the SM501 and another platform driver, such as the SM501
+then we end up defining PLATFORM_DRIVER twice. This patch
+seperated the SM501 onto a seperate define of SM501_OHCI_DRIVER
+so that it can be selected without overwriting the original
+definition.
+
+Signed-off-by: Ben Dooks <ben-linux@fluff.org>
+Acked-by: David Brownell <dbrownell@users.sourceforge.net>
+Cc: stable <stable@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/host/ohci-hcd.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/host/ohci-hcd.c
++++ b/drivers/usb/host/ohci-hcd.c
+@@ -1054,7 +1054,7 @@ MODULE_LICENSE ("GPL");
+
+ #ifdef CONFIG_MFD_SM501
+ #include "ohci-sm501.c"
+-#define PLATFORM_DRIVER ohci_hcd_sm501_driver
++#define SM501_OHCI_DRIVER ohci_hcd_sm501_driver
+ #endif
+
+ #if !defined(PCI_DRIVER) && \
+@@ -1062,6 +1062,7 @@ MODULE_LICENSE ("GPL");
+ !defined(OF_PLATFORM_DRIVER) && \
+ !defined(SA1111_DRIVER) && \
+ !defined(PS3_SYSTEM_BUS_DRIVER) && \
++ !defined(SM501_OHCI_DRIVER) && \
+ !defined(SSB_OHCI_DRIVER)
+ #error "missing bus glue for ohci-hcd"
+ #endif
+@@ -1121,9 +1122,18 @@ static int __init ohci_hcd_mod_init(void
+ goto error_ssb;
+ #endif
+
++#ifdef SM501_OHCI_DRIVER
++ retval = platform_driver_register(&SM501_OHCI_DRIVER);
++ if (retval < 0)
++ goto error_sm501;
++#endif
++
+ return retval;
+
+ /* Error path */
++#ifdef SM501_OHCI_DRIVER
++ error_sm501:
++#endif
+ #ifdef SSB_OHCI_DRIVER
+ error_ssb:
+ #endif
+@@ -1159,6 +1169,9 @@ module_init(ohci_hcd_mod_init);
+
+ static void __exit ohci_hcd_mod_exit(void)
+ {
++#ifdef SM501_OHCI_DRIVER
++ platform_driver_unregister(&SM501_OHCI_DRIVER);
++#endif
+ #ifdef SSB_OHCI_DRIVER
+ ssb_driver_unregister(&SSB_OHCI_DRIVER);
+ #endif
diff --git a/usb/usb-add-usb_dev_reset_delayed.patch b/usb/usb-add-usb_dev_reset_delayed.patch
index 0c5881a972edf3..62eb11303c965d 100644
--- a/usb/usb-add-usb_dev_reset_delayed.patch
+++ b/usb/usb-add-usb_dev_reset_delayed.patch
@@ -27,7 +27,7 @@ Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
-@@ -3406,3 +3406,86 @@ int usb_reset_composite_device(struct us
+@@ -3412,3 +3412,86 @@ int usb_reset_composite_device(struct us
return ret;
}
EXPORT_SYMBOL_GPL(usb_reset_composite_device);
diff --git a/usb/usb-ehci-hcd-unlink-speedups.patch b/usb/usb-ehci-hcd-unlink-speedups.patch
new file mode 100644
index 00000000000000..cc9310854e284a
--- /dev/null
+++ b/usb/usb-ehci-hcd-unlink-speedups.patch
@@ -0,0 +1,102 @@
+From david-b@pacbell.net Fri Jun 13 17:35:27 2008
+From: David Brownell <david-b@pacbell.net>
+Date: Tue, 3 Jun 2008 22:21:55 -0700
+Subject: USB: ehci-hcd unlink speedups
+To: Greg KH <greg@kroah.com>
+Cc: linux-usb@vger.kernel.org, Alan Stern <stern@rowland.harvard.edu>, Leonid <leonidv11@gmail.com>
+Message-ID: <200806032221.56047.david-b@pacbell.net>
+Content-Disposition: inline
+
+
+From: Alan Stern <stern@rowland.harvard.edu>
+
+This patch fixes a performance issue observed with some workloads
+when unlinking EHCI queue header (QH) descriptors from the async
+ring (control/bulk schedule). The mechanism intended to let an
+empty QH stay scheduled for (only) a brief period, in case it's
+quickly reused, was not working as intended. Sometimes the unlink
+proceeded too quickly (which can be a strong negative effect);
+sometimes it was too slow (wasting DMA cycles, usually a minor
+issue except for bus contention and power usage).
+
+The fix replaces a simple counter with a timestamp derived from
+the controller's microframe value.
+
+Finally, a logical error left over from the IAA watchdog-timer
+conversion is corrected. Now the driver will always either unlink
+an idle queue header or set up a timer to unlink it later. The old
+code would sometimes fail to do either.
+
+[ dbrownell@users.sourceforge.net: cleanup timestamping + shrink timer ]
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/host/ehci-hcd.c | 2 +-
+ drivers/usb/host/ehci-q.c | 15 ++++++++-------
+ drivers/usb/host/ehci.h | 6 +-----
+ 3 files changed, 10 insertions(+), 13 deletions(-)
+
+--- a/drivers/usb/host/ehci.h
++++ b/drivers/usb/host/ehci.h
+@@ -189,14 +189,10 @@ timer_action (struct ehci_hcd *ehci, enu
+ break;
+ // case TIMER_ASYNC_SHRINK:
+ default:
+- t = EHCI_SHRINK_JIFFIES;
++ t = DIV_ROUND_UP(EHCI_SHRINK_FRAMES * HZ, 1000);
+ break;
+ }
+ t += jiffies;
+- // all timings except IAA watchdog can be overridden.
+- // async queue SHRINK often precedes IAA. while it's ready
+- // to go OFF neither can matter, and afterwards the IO
+- // watchdog stops unless there's still periodic traffic.
+ if (time_before_eq(t, ehci->watchdog.expires)
+ && timer_pending (&ehci->watchdog))
+ return;
+--- a/drivers/usb/host/ehci-hcd.c
++++ b/drivers/usb/host/ehci-hcd.c
+@@ -84,7 +84,7 @@ static const char hcd_name [] = "ehci_hc
+ #define EHCI_IAA_MSECS 10 /* arbitrary */
+ #define EHCI_IO_JIFFIES (HZ/10) /* io watchdog > irq_thresh */
+ #define EHCI_ASYNC_JIFFIES (HZ/20) /* async idle timeout */
+-#define EHCI_SHRINK_JIFFIES (HZ/200) /* async qh unlink delay */
++#define EHCI_SHRINK_FRAMES 5 /* async qh unlink delay */
+
+ /* Initial IRQ latency: faster than hw default */
+ static int log2_irq_thresh = 0; // 0 to 6
+--- a/drivers/usb/host/ehci-q.c
++++ b/drivers/usb/host/ehci-q.c
+@@ -1116,8 +1116,7 @@ static void scan_async (struct ehci_hcd
+ struct ehci_qh *qh;
+ enum ehci_timer_action action = TIMER_IO_WATCHDOG;
+
+- if (!++(ehci->stamp))
+- ehci->stamp++;
++ ehci->stamp = ehci_readl(ehci, &ehci->regs->frame_index);
+ timer_action_done (ehci, TIMER_ASYNC_SHRINK);
+ rescan:
+ qh = ehci->async->qh_next.qh;
+@@ -1148,12 +1147,14 @@ rescan:
+ * doesn't stay idle for long.
+ * (plus, avoids some kind of re-activation race.)
+ */
+- if (list_empty (&qh->qtd_list)) {
+- if (qh->stamp == ehci->stamp)
++ if (list_empty(&qh->qtd_list)
++ && qh->qh_state == QH_STATE_LINKED) {
++ if (!ehci->reclaim
++ && ((ehci->stamp - qh->stamp) & 0x1fff)
++ >= (EHCI_SHRINK_FRAMES * 8))
++ start_unlink_async(ehci, qh);
++ else
+ action = TIMER_ASYNC_SHRINK;
+- else if (!ehci->reclaim
+- && qh->qh_state == QH_STATE_LINKED)
+- start_unlink_async (ehci, qh);
+ }
+
+ qh = qh->qh_next.qh;
diff --git a/usb/usb-gadget-documentation-update.patch b/usb/usb-gadget-documentation-update.patch
new file mode 100644
index 00000000000000..402cb84780e0f3
--- /dev/null
+++ b/usb/usb-gadget-documentation-update.patch
@@ -0,0 +1,49 @@
+From stern@rowland.harvard.edu Fri Jun 13 17:36:22 2008
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Mon, 2 Jun 2008 16:26:48 -0400 (EDT)
+Subject: USB Gadget: documentation update
+To: Greg KH <greg@kroah.com>
+Cc: David Brownell <david-b@pacbell.net>
+Message-ID: <Pine.LNX.4.44L0.0806021616310.16705-100000@iolanthe.rowland.org>
+
+
+This patch (as1102) clarifies two points in the USB Gadget kerneldoc:
+
+ Request completion callbacks are always made with interrupts
+ disabled;
+
+ Device controllers may not support STALLing the status stage
+ of a control transfer after the data stage is over.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Acked-by: David Brownell <dbrownell@users.sourceforge.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ include/linux/usb/gadget.h | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+--- a/include/linux/usb/gadget.h
++++ b/include/linux/usb/gadget.h
+@@ -33,7 +33,8 @@ struct usb_ep;
+ * @short_not_ok: When reading data, makes short packets be
+ * treated as errors (queue stops advancing till cleanup).
+ * @complete: Function called when request completes, so this request and
+- * its buffer may be re-used.
++ * its buffer may be re-used. The function will always be called with
++ * interrupts disabled, and it must not sleep.
+ * Reads terminate with a short packet, or when the buffer fills,
+ * whichever comes first. When writes terminate, some data bytes
+ * will usually still be in flight (often in a hardware fifo).
+@@ -271,7 +272,10 @@ static inline void usb_ep_free_request(s
+ * (Note that some USB device controllers disallow protocol stall responses
+ * in some cases.) When control responses are deferred (the response is
+ * written after the setup callback returns), then usb_ep_set_halt() may be
+- * used on ep0 to trigger protocol stalls.
++ * used on ep0 to trigger protocol stalls. Depending on the controller,
++ * it may not be possible to trigger a status-stage protocol stall when the
++ * data stage is over, that is, from within the response's completion
++ * routine.
+ *
+ * For periodic endpoints, like interrupt or isochronous ones, the usb host
+ * arranges to poll once per interval, and the gadget driver usually will
diff --git a/usb/usb-host-mark-const-variable-tables-as-const.patch b/usb/usb-host-mark-const-variable-tables-as-const.patch
new file mode 100644
index 00000000000000..c498339f3b1d44
--- /dev/null
+++ b/usb/usb-host-mark-const-variable-tables-as-const.patch
@@ -0,0 +1,38 @@
+From tom.leiming@gmail.com Fri Jun 13 17:37:28 2008
+From: Ming Lei <tom.leiming@gmail.com>
+Date: Sun, 8 Jun 2008 16:13:03 +0800
+Subject: USB: host: mark const variable tables as "const"
+To: shimoda.yoshihiro@renesas.com, greg@kroah.com
+Cc: linux-usb@vger.kernel.org, Ming Lei <tom.leiming@gmail.com>
+Message-ID: <1212912783-6512-1-git-send-email-tom.leiming@gmail.com>
+
+
+From: Ming Lei <tom.leiming@gmail.com>
+
+Mark the tables as const so that they end up in .rodata
+section and don't cacheline share with things that get
+written to.
+
+Signed-off-by: Ming Lei <tom.leiming@gmail.com>
+Cc: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/host/r8a66597-hcd.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/host/r8a66597-hcd.c
++++ b/drivers/usb/host/r8a66597-hcd.c
+@@ -312,9 +312,9 @@ static void put_child_connect_map(struct
+ static void set_pipe_reg_addr(struct r8a66597_pipe *pipe, u8 dma_ch)
+ {
+ u16 pipenum = pipe->info.pipenum;
+- unsigned long fifoaddr[] = {D0FIFO, D1FIFO, CFIFO};
+- unsigned long fifosel[] = {D0FIFOSEL, D1FIFOSEL, CFIFOSEL};
+- unsigned long fifoctr[] = {D0FIFOCTR, D1FIFOCTR, CFIFOCTR};
++ const unsigned long fifoaddr[] = {D0FIFO, D1FIFO, CFIFO};
++ const unsigned long fifosel[] = {D0FIFOSEL, D1FIFOSEL, CFIFOSEL};
++ const unsigned long fifoctr[] = {D0FIFOCTR, D1FIFOCTR, CFIFOCTR};
+
+ if (dma_ch > R8A66597_PIPE_NO_DMA) /* dma fifo not use? */
+ dma_ch = R8A66597_PIPE_NO_DMA;
diff --git a/usb/usb-hub-add-check-for-unsupported-bus-topology.patch b/usb/usb-hub-add-check-for-unsupported-bus-topology.patch
new file mode 100644
index 00000000000000..707038de3b5f33
--- /dev/null
+++ b/usb/usb-hub-add-check-for-unsupported-bus-topology.patch
@@ -0,0 +1,59 @@
+From felipe.balbi@nokia.com Fri Jun 13 17:34:34 2008
+From: Felipe Balbi <felipe.balbi@nokia.com>
+Date: Thu, 12 Jun 2008 10:49:47 +0300
+Subject: usb: hub: add check for unsupported bus topology
+To: linux-usb@vger.kernel.org
+Cc: Alan Stern <stern@rowland.harvard.edu>, Greg Kroah-Hartman <gregkh@suse.de>, Felipe Balbi <felipe.balbi@nokia.com>
+Message-ID: <1213256987-18223-1-git-send-email-felipe.balbi@nokia.com>
+
+
+We can't allow hubs on the 7th tier as they would allow
+devices on the 8th tier.
+
+Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
+Cc: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/core/devices.c | 2 --
+ drivers/usb/core/hcd.h | 2 ++
+ drivers/usb/core/hub.c | 6 ++++++
+ 3 files changed, 8 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/core/devices.c
++++ b/drivers/usb/core/devices.c
+@@ -61,8 +61,6 @@
+ #include "usb.h"
+ #include "hcd.h"
+
+-#define MAX_TOPO_LEVEL 6
+-
+ /* Define ALLOW_SERIAL_NUMBER if you want to see the serial number of devices */
+ #define ALLOW_SERIAL_NUMBER
+
+--- a/drivers/usb/core/hcd.h
++++ b/drivers/usb/core/hcd.h
+@@ -21,6 +21,8 @@
+
+ #include <linux/rwsem.h>
+
++#define MAX_TOPO_LEVEL 6
++
+ /* This file contains declarations of usbcore internals that are mostly
+ * used or exposed by Host Controller Drivers.
+ */
+--- a/drivers/usb/core/hub.c
++++ b/drivers/usb/core/hub.c
+@@ -1051,6 +1051,12 @@ static int hub_probe(struct usb_interfac
+ desc = intf->cur_altsetting;
+ hdev = interface_to_usbdev(intf);
+
++ if (hdev->level == MAX_TOPO_LEVEL) {
++ dev_err(&intf->dev, "Unsupported bus topology: "
++ "hub nested too deep\n");
++ return -E2BIG;
++ }
++
+ #ifdef CONFIG_USB_OTG_BLACKLIST_HUB
+ if (hdev->parent) {
+ dev_warn(&intf->dev, "ignoring external hub\n");
diff --git a/usb/usb-irda-cleanup-on-ir-usb-module.patch b/usb/usb-irda-cleanup-on-ir-usb-module.patch
new file mode 100644
index 00000000000000..f3614bef533a38
--- /dev/null
+++ b/usb/usb-irda-cleanup-on-ir-usb-module.patch
@@ -0,0 +1,920 @@
+From me@felipebalbi.com Fri Jun 13 17:35:54 2008
+From: Felipe Balbi <me@felipebalbi.com>
+Date: Tue, 3 Jun 2008 14:47:52 +0300
+Subject: usb: irda: cleanup on ir-usb module
+To: linux-usb@vger.kernel.org
+Cc: Greg Kroah-Hartman <gregkh@suse.de>, Felipe Balbi <me@felipebalbi.com>
+Message-ID: <1212493672-9848-1-git-send-email-me@felipebalbi.com>
+
+
+General cleanup on ir-usb module. Introduced
+a common header that could be used also on
+usb gadget framework.
+
+Lot's of cleanups and now using macros from the header
+file.
+
+Signed-off-by: Felipe Balbi <me@felipebalbi.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/serial/ir-usb.c | 488 ++++++++++++++++++++++++--------------------
+ include/linux/usb/irda.h | 151 +++++++++++++
+ 2 files changed, 420 insertions(+), 219 deletions(-)
+
+--- a/drivers/usb/serial/ir-usb.c
++++ b/drivers/usb/serial/ir-usb.c
+@@ -19,7 +19,12 @@
+ * was written by Roman Weissgaerber <weissg@vienna.at>, Dag Brattli
+ * <dag@brattli.net>, and Jean Tourrilhes <jt@hpl.hp.com>
+ *
+- * See Documentation/usb/usb-serial.txt for more information on using this driver
++ * See Documentation/usb/usb-serial.txt for more information on using this
++ * driver
++ *
++ * 2008_Jun_02 Felipe Balbi <me@felipebalbi.com>
++ * Introduced common header to be used also in USB Gadget Framework.
++ * Still needs some other style fixes.
+ *
+ * 2007_Jun_21 Alan Cox <alan@redhat.com>
+ * Minimal cleanups for some of the driver problens and tty layer abuse.
+@@ -59,9 +64,10 @@
+ #include <linux/tty_flip.h>
+ #include <linux/module.h>
+ #include <linux/spinlock.h>
+-#include <asm/uaccess.h>
++#include <linux/uaccess.h>
+ #include <linux/usb.h>
+ #include <linux/usb/serial.h>
++#include <linux/usb/irda.h>
+
+ /*
+ * Version Information
+@@ -70,100 +76,75 @@
+ #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>"
+ #define DRIVER_DESC "USB IR Dongle driver"
+
+-/* USB IrDA class spec information */
+-#define USB_CLASS_IRDA 0x02
+-#define USB_DT_IRDA 0x21
+-#define IU_REQ_GET_CLASS_DESC 0x06
+-#define SPEED_2400 0x01
+-#define SPEED_9600 0x02
+-#define SPEED_19200 0x03
+-#define SPEED_38400 0x04
+-#define SPEED_57600 0x05
+-#define SPEED_115200 0x06
+-#define SPEED_576000 0x07
+-#define SPEED_1152000 0x08
+-#define SPEED_4000000 0x09
+-
+-struct irda_class_desc {
+- u8 bLength;
+- u8 bDescriptorType;
+- u16 bcdSpecRevision;
+- u8 bmDataSize;
+- u8 bmWindowSize;
+- u8 bmMinTurnaroundTime;
+- u16 wBaudRate;
+- u8 bmAdditionalBOFs;
+- u8 bIrdaRateSniff;
+- u8 bMaxUnicastList;
+-} __attribute__ ((packed));
+-
+ static int debug;
+
+ /* if overridden by the user, then use their value for the size of the read and
+ * write urbs */
+ static int buffer_size;
++
+ /* if overridden by the user, then use the specified number of XBOFs */
+ static int xbof = -1;
+
+-static int ir_startup (struct usb_serial *serial);
+-static int ir_open (struct usb_serial_port *port, struct file *filep);
+-static void ir_close (struct usb_serial_port *port, struct file *filep);
+-static int ir_write (struct usb_serial_port *port, const unsigned char *buf, int count);
+-static void ir_write_bulk_callback (struct urb *urb);
+-static void ir_read_bulk_callback (struct urb *urb);
+-static void ir_set_termios (struct usb_serial_port *port, struct ktermios *old_termios);
++static int ir_startup(struct usb_serial *serial);
++static int ir_open(struct usb_serial_port *port, struct file *filep);
++static void ir_close(struct usb_serial_port *port, struct file *filep);
++static int ir_write(struct usb_serial_port *port,
++ const unsigned char *buf, int count);
++static void ir_write_bulk_callback(struct urb *urb);
++static void ir_read_bulk_callback(struct urb *urb);
++static void ir_set_termios(struct usb_serial_port *port,
++ struct ktermios *old_termios);
+
+ /* Not that this lot means you can only have one per system */
+-static u8 ir_baud = 0;
+-static u8 ir_xbof = 0;
+-static u8 ir_add_bof = 0;
++static u8 ir_baud;
++static u8 ir_xbof;
++static u8 ir_add_bof;
+
+-static struct usb_device_id id_table [] = {
++static struct usb_device_id ir_id_table[] = {
+ { USB_DEVICE(0x050f, 0x0180) }, /* KC Technology, KC-180 */
+ { USB_DEVICE(0x08e9, 0x0100) }, /* XTNDAccess */
+ { USB_DEVICE(0x09c4, 0x0011) }, /* ACTiSys ACT-IR2000U */
+- { USB_INTERFACE_INFO (USB_CLASS_APP_SPEC, USB_CLASS_IRDA, 0) },
++ { USB_INTERFACE_INFO(USB_CLASS_APP_SPEC, USB_SUBCLASS_IRDA, 0) },
+ { } /* Terminating entry */
+ };
+
+-MODULE_DEVICE_TABLE (usb, id_table);
++MODULE_DEVICE_TABLE(usb, ir_id_table);
+
+ static struct usb_driver ir_driver = {
+- .name = "ir-usb",
+- .probe = usb_serial_probe,
+- .disconnect = usb_serial_disconnect,
+- .id_table = id_table,
+- .no_dynamic_id = 1,
++ .name = "ir-usb",
++ .probe = usb_serial_probe,
++ .disconnect = usb_serial_disconnect,
++ .id_table = ir_id_table,
++ .no_dynamic_id = 1,
+ };
+
+-
+ static struct usb_serial_driver ir_device = {
+- .driver = {
+- .owner = THIS_MODULE,
+- .name = "ir-usb",
++ .driver = {
++ .owner = THIS_MODULE,
++ .name = "ir-usb",
+ },
+- .description = "IR Dongle",
+- .usb_driver = &ir_driver,
+- .id_table = id_table,
+- .num_ports = 1,
+- .set_termios = ir_set_termios,
+- .attach = ir_startup,
+- .open = ir_open,
+- .close = ir_close,
+- .write = ir_write,
+- .write_bulk_callback = ir_write_bulk_callback,
+- .read_bulk_callback = ir_read_bulk_callback,
++ .description = "IR Dongle",
++ .usb_driver = &ir_driver,
++ .id_table = ir_id_table,
++ .num_ports = 1,
++ .set_termios = ir_set_termios,
++ .attach = ir_startup,
++ .open = ir_open,
++ .close = ir_close,
++ .write = ir_write,
++ .write_bulk_callback = ir_write_bulk_callback,
++ .read_bulk_callback = ir_read_bulk_callback,
+ };
+
+-static inline void irda_usb_dump_class_desc(struct irda_class_desc *desc)
++static inline void irda_usb_dump_class_desc(struct usb_irda_cs_descriptor *desc)
+ {
+ dbg("bLength=%x", desc->bLength);
+ dbg("bDescriptorType=%x", desc->bDescriptorType);
+- dbg("bcdSpecRevision=%x", desc->bcdSpecRevision);
++ dbg("bcdSpecRevision=%x", __le16_to_cpu(desc->bcdSpecRevision));
+ dbg("bmDataSize=%x", desc->bmDataSize);
+ dbg("bmWindowSize=%x", desc->bmWindowSize);
+ dbg("bmMinTurnaroundTime=%d", desc->bmMinTurnaroundTime);
+- dbg("wBaudRate=%x", desc->wBaudRate);
++ dbg("wBaudRate=%x", __le16_to_cpu(desc->wBaudRate));
+ dbg("bmAdditionalBOFs=%x", desc->bmAdditionalBOFs);
+ dbg("bIrdaRateSniff=%x", desc->bIrdaRateSniff);
+ dbg("bMaxUnicastList=%x", desc->bMaxUnicastList);
+@@ -181,35 +162,37 @@ static inline void irda_usb_dump_class_d
+ *
+ * Based on the same function in drivers/net/irda/irda-usb.c
+ */
+-static struct irda_class_desc *irda_usb_find_class_desc(struct usb_device *dev, unsigned int ifnum)
++static struct usb_irda_cs_descriptor *
++irda_usb_find_class_desc(struct usb_device *dev, unsigned int ifnum)
+ {
+- struct irda_class_desc *desc;
++ struct usb_irda_cs_descriptor *desc;
+ int ret;
+-
+- desc = kzalloc(sizeof (struct irda_class_desc), GFP_KERNEL);
+- if (desc == NULL)
++
++ desc = kzalloc(sizeof(*desc), GFP_KERNEL);
++ if (!desc)
+ return NULL;
+-
+- ret = usb_control_msg(dev, usb_rcvctrlpipe(dev,0),
+- IU_REQ_GET_CLASS_DESC,
++
++ ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
++ USB_REQ_CS_IRDA_GET_CLASS_DESC,
+ USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
+ 0, ifnum, desc, sizeof(*desc), 1000);
+-
++
+ dbg("%s - ret=%d", __func__, ret);
+ if (ret < sizeof(*desc)) {
+ dbg("%s - class descriptor read %s (%d)",
+ __func__,
+- (ret<0) ? "failed" : "too short",
++ (ret < 0) ? "failed" : "too short",
+ ret);
+ goto error;
+ }
+- if (desc->bDescriptorType != USB_DT_IRDA) {
++ if (desc->bDescriptorType != USB_DT_CS_IRDA) {
+ dbg("%s - bad class descriptor type", __func__);
+ goto error;
+ }
+-
++
+ irda_usb_dump_class_desc(desc);
+ return desc;
++
+ error:
+ kfree(desc);
+ return NULL;
+@@ -219,64 +202,100 @@ error:
+ static u8 ir_xbof_change(u8 xbof)
+ {
+ u8 result;
++
+ /* reference irda-usb.c */
+- switch(xbof) {
+- case 48: result = 0x10; break;
+- case 28:
+- case 24: result = 0x20; break;
+- default:
+- case 12: result = 0x30; break;
+- case 5:
+- case 6: result = 0x40; break;
+- case 3: result = 0x50; break;
+- case 2: result = 0x60; break;
+- case 1: result = 0x70; break;
+- case 0: result = 0x80; break;
++ switch (xbof) {
++ case 48:
++ result = 0x10;
++ break;
++ case 28:
++ case 24:
++ result = 0x20;
++ break;
++ default:
++ case 12:
++ result = 0x30;
++ break;
++ case 5:
++ case 6:
++ result = 0x40;
++ break;
++ case 3:
++ result = 0x50;
++ break;
++ case 2:
++ result = 0x60;
++ break;
++ case 1:
++ result = 0x70;
++ break;
++ case 0:
++ result = 0x80;
++ break;
+ }
++
+ return(result);
+ }
+
+
+-static int ir_startup (struct usb_serial *serial)
++static int ir_startup(struct usb_serial *serial)
+ {
+- struct irda_class_desc *irda_desc;
++ struct usb_irda_cs_descriptor *irda_desc;
+
+- irda_desc = irda_usb_find_class_desc (serial->dev, 0);
+- if (irda_desc == NULL) {
+- dev_err (&serial->dev->dev, "IRDA class descriptor not found, device not bound\n");
++ irda_desc = irda_usb_find_class_desc(serial->dev, 0);
++ if (!irda_desc) {
++ dev_err(&serial->dev->dev,
++ "IRDA class descriptor not found, device not bound\n");
+ return -ENODEV;
+ }
+
+- dbg ("%s - Baud rates supported:%s%s%s%s%s%s%s%s%s",
++ dbg("%s - Baud rates supported:%s%s%s%s%s%s%s%s%s",
+ __func__,
+- (irda_desc->wBaudRate & 0x0001) ? " 2400" : "",
+- (irda_desc->wBaudRate & 0x0002) ? " 9600" : "",
+- (irda_desc->wBaudRate & 0x0004) ? " 19200" : "",
+- (irda_desc->wBaudRate & 0x0008) ? " 38400" : "",
+- (irda_desc->wBaudRate & 0x0010) ? " 57600" : "",
+- (irda_desc->wBaudRate & 0x0020) ? " 115200" : "",
+- (irda_desc->wBaudRate & 0x0040) ? " 576000" : "",
+- (irda_desc->wBaudRate & 0x0080) ? " 1152000" : "",
+- (irda_desc->wBaudRate & 0x0100) ? " 4000000" : "");
+-
+- switch( irda_desc->bmAdditionalBOFs ) {
+- case 0x01: ir_add_bof = 48; break;
+- case 0x02: ir_add_bof = 24; break;
+- case 0x04: ir_add_bof = 12; break;
+- case 0x08: ir_add_bof = 6; break;
+- case 0x10: ir_add_bof = 3; break;
+- case 0x20: ir_add_bof = 2; break;
+- case 0x40: ir_add_bof = 1; break;
+- case 0x80: ir_add_bof = 0; break;
+- default:;
++ (irda_desc->wBaudRate & USB_IRDA_BR_2400) ? " 2400" : "",
++ (irda_desc->wBaudRate & USB_IRDA_BR_9600) ? " 9600" : "",
++ (irda_desc->wBaudRate & USB_IRDA_BR_19200) ? " 19200" : "",
++ (irda_desc->wBaudRate & USB_IRDA_BR_38400) ? " 38400" : "",
++ (irda_desc->wBaudRate & USB_IRDA_BR_57600) ? " 57600" : "",
++ (irda_desc->wBaudRate & USB_IRDA_BR_115200) ? " 115200" : "",
++ (irda_desc->wBaudRate & USB_IRDA_BR_576000) ? " 576000" : "",
++ (irda_desc->wBaudRate & USB_IRDA_BR_1152000) ? " 1152000" : "",
++ (irda_desc->wBaudRate & USB_IRDA_BR_4000000) ? " 4000000" : "");
++
++ switch (irda_desc->bmAdditionalBOFs) {
++ case USB_IRDA_AB_48:
++ ir_add_bof = 48;
++ break;
++ case USB_IRDA_AB_24:
++ ir_add_bof = 24;
++ break;
++ case USB_IRDA_AB_12:
++ ir_add_bof = 12;
++ break;
++ case USB_IRDA_AB_6:
++ ir_add_bof = 6;
++ break;
++ case USB_IRDA_AB_3:
++ ir_add_bof = 3;
++ break;
++ case USB_IRDA_AB_2:
++ ir_add_bof = 2;
++ break;
++ case USB_IRDA_AB_1:
++ ir_add_bof = 1;
++ break;
++ case USB_IRDA_AB_0:
++ ir_add_bof = 0;
++ break;
++ default:
++ break;
+ }
+
+- kfree (irda_desc);
++ kfree(irda_desc);
+
+- return 0;
++ return 0;
+ }
+
+-static int ir_open (struct usb_serial_port *port, struct file *filp)
++static int ir_open(struct usb_serial_port *port, struct file *filp)
+ {
+ char *buffer;
+ int result = 0;
+@@ -285,51 +304,55 @@ static int ir_open (struct usb_serial_po
+
+ if (buffer_size) {
+ /* override the default buffer sizes */
+- buffer = kmalloc (buffer_size, GFP_KERNEL);
++ buffer = kmalloc(buffer_size, GFP_KERNEL);
+ if (!buffer) {
+- dev_err (&port->dev, "%s - out of memory.\n", __func__);
++ dev_err(&port->dev, "%s - out of memory.\n", __func__);
+ return -ENOMEM;
+ }
+- kfree (port->read_urb->transfer_buffer);
++ kfree(port->read_urb->transfer_buffer);
+ port->read_urb->transfer_buffer = buffer;
+ port->read_urb->transfer_buffer_length = buffer_size;
+
+- buffer = kmalloc (buffer_size, GFP_KERNEL);
++ buffer = kmalloc(buffer_size, GFP_KERNEL);
+ if (!buffer) {
+- dev_err (&port->dev, "%s - out of memory.\n", __func__);
++ dev_err(&port->dev, "%s - out of memory.\n", __func__);
+ return -ENOMEM;
+ }
+- kfree (port->write_urb->transfer_buffer);
++ kfree(port->write_urb->transfer_buffer);
+ port->write_urb->transfer_buffer = buffer;
+ port->write_urb->transfer_buffer_length = buffer_size;
+ port->bulk_out_size = buffer_size;
+ }
+
+ /* Start reading from the device */
+- usb_fill_bulk_urb (
++ usb_fill_bulk_urb(
+ port->read_urb,
+- port->serial->dev,
+- usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress),
++ port->serial->dev,
++ usb_rcvbulkpipe(port->serial->dev,
++ port->bulk_in_endpointAddress),
+ port->read_urb->transfer_buffer,
+ port->read_urb->transfer_buffer_length,
+ ir_read_bulk_callback,
+ port);
+ result = usb_submit_urb(port->read_urb, GFP_KERNEL);
+ if (result)
+- dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __func__, result);
++ dev_err(&port->dev,
++ "%s - failed submitting read urb, error %d\n",
++ __func__, result);
+
+ return result;
+ }
+
+-static void ir_close (struct usb_serial_port *port, struct file * filp)
++static void ir_close(struct usb_serial_port *port, struct file *filp)
+ {
+ dbg("%s - port %d", __func__, port->number);
+-
++
+ /* shutdown our bulk read */
+ usb_kill_urb(port->read_urb);
+ }
+
+-static int ir_write (struct usb_serial_port *port, const unsigned char *buf, int count)
++static int ir_write(struct usb_serial_port *port,
++ const unsigned char *buf, int count)
+ {
+ unsigned char *transfer_buffer;
+ int result;
+@@ -338,7 +361,7 @@ static int ir_write (struct usb_serial_p
+ dbg("%s - port = %d, count = %d", __func__, port->number, count);
+
+ if (!port->tty) {
+- dev_err (&port->dev, "%s - no tty???\n", __func__);
++ dev_err(&port->dev, "%s - no tty???\n", __func__);
+ return 0;
+ }
+
+@@ -359,7 +382,7 @@ static int ir_write (struct usb_serial_p
+
+ /*
+ * The first byte of the packet we send to the device contains an
+- * inband header which indicates an additional number of BOFs and
++ * inbound header which indicates an additional number of BOFs and
+ * a baud rate change.
+ *
+ * See section 5.4.2.2 of the USB IrDA spec.
+@@ -367,9 +390,9 @@ static int ir_write (struct usb_serial_p
+ *transfer_buffer = ir_xbof | ir_baud;
+ ++transfer_buffer;
+
+- memcpy (transfer_buffer, buf, transfer_size);
++ memcpy(transfer_buffer, buf, transfer_size);
+
+- usb_fill_bulk_urb (
++ usb_fill_bulk_urb(
+ port->write_urb,
+ port->serial->dev,
+ usb_sndbulkpipe(port->serial->dev,
+@@ -381,17 +404,19 @@ static int ir_write (struct usb_serial_p
+
+ port->write_urb->transfer_flags = URB_ZERO_PACKET;
+
+- result = usb_submit_urb (port->write_urb, GFP_ATOMIC);
++ result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
+ if (result) {
+ port->write_urb_busy = 0;
+- dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __func__, result);
++ dev_err(&port->dev,
++ "%s - failed submitting write urb, error %d\n",
++ __func__, result);
+ } else
+ result = transfer_size;
+
+ return result;
+ }
+
+-static void ir_write_bulk_callback (struct urb *urb)
++static void ir_write_bulk_callback(struct urb *urb)
+ {
+ struct usb_serial_port *port = urb->context;
+ int status = urb->status;
+@@ -405,7 +430,7 @@ static void ir_write_bulk_callback (stru
+ return;
+ }
+
+- usb_serial_debug_data (
++ usb_serial_debug_data(
+ debug,
+ &port->dev,
+ __func__,
+@@ -415,7 +440,7 @@ static void ir_write_bulk_callback (stru
+ usb_serial_port_softint(port);
+ }
+
+-static void ir_read_bulk_callback (struct urb *urb)
++static void ir_read_bulk_callback(struct urb *urb)
+ {
+ struct usb_serial_port *port = urb->context;
+ struct tty_struct *tty;
+@@ -431,68 +456,69 @@ static void ir_read_bulk_callback (struc
+ }
+
+ switch (status) {
+- case 0: /* Successful */
+-
+- /*
+- * The first byte of the packet we get from the device
+- * contains a busy indicator and baud rate change.
+- * See section 5.4.1.2 of the USB IrDA spec.
+- */
+- if ((*data & 0x0f) > 0)
+- ir_baud = *data & 0x0f;
+-
+- usb_serial_debug_data (
+- debug,
+- &port->dev,
+- __func__,
+- urb->actual_length,
+- data);
+-
+- tty = port->tty;
++ case 0: /* Successful */
+
+- if (tty_buffer_request_room(tty, urb->actual_length - 1)) {
+- tty_insert_flip_string(tty, data+1, urb->actual_length - 1);
+- tty_flip_buffer_push(tty);
+- }
+-
+- /*
+- * No break here.
+- * We want to resubmit the urb so we can read
+- * again.
+- */
+-
+- case -EPROTO: /* taking inspiration from pl2303.c */
+-
+- /* Continue trying to always read */
+- usb_fill_bulk_urb (
+- port->read_urb,
+- port->serial->dev,
+- usb_rcvbulkpipe(port->serial->dev,
+- port->bulk_in_endpointAddress),
+- port->read_urb->transfer_buffer,
+- port->read_urb->transfer_buffer_length,
+- ir_read_bulk_callback,
+- port);
+-
+- result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
+- if (result)
+- dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n",
+- __func__, result);
+-
+- break ;
+-
+- default:
+- dbg("%s - nonzero read bulk status received: %d",
+- __func__,
+- status);
+- break ;
++ /*
++ * The first byte of the packet we get from the device
++ * contains a busy indicator and baud rate change.
++ * See section 5.4.1.2 of the USB IrDA spec.
++ */
++ if ((*data & 0x0f) > 0)
++ ir_baud = *data & 0x0f;
++
++ usb_serial_debug_data(
++ debug,
++ &port->dev,
++ __func__,
++ urb->actual_length,
++ data);
++
++ tty = port->tty;
++
++ if (tty_buffer_request_room(tty, urb->actual_length - 1)) {
++ tty_insert_flip_string(tty, data + 1,
++ urb->actual_length - 1);
++ tty_flip_buffer_push(tty);
++ }
+
++ /*
++ * No break here.
++ * We want to resubmit the urb so we can read
++ * again.
++ */
++
++ case -EPROTO: /* taking inspiration from pl2303.c */
++
++ /* Continue trying to always read */
++ usb_fill_bulk_urb(
++ port->read_urb,
++ port->serial->dev,
++ usb_rcvbulkpipe(port->serial->dev,
++ port->bulk_in_endpointAddress),
++ port->read_urb->transfer_buffer,
++ port->read_urb->transfer_buffer_length,
++ ir_read_bulk_callback,
++ port);
++
++ result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
++ if (result)
++ dev_err(&port->dev,
++ "%s - failed resubmitting read urb, error %d\n",
++ __func__, result);
++ break;
++
++ default:
++ dbg("%s - nonzero read bulk status received: %d",
++ __func__,
++ status);
++ break;
+ }
+
+ return;
+ }
+
+-static void ir_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
++static void ir_set_termios(struct usb_serial_port *port,
++ struct ktermios *old_termios)
+ {
+ unsigned char *transfer_buffer;
+ int result;
+@@ -510,19 +536,36 @@ static void ir_set_termios (struct usb_s
+ */
+
+ switch (baud) {
+- case 2400: ir_baud = SPEED_2400; break;
+- case 9600: ir_baud = SPEED_9600; break;
+- case 19200: ir_baud = SPEED_19200; break;
+- case 38400: ir_baud = SPEED_38400; break;
+- case 57600: ir_baud = SPEED_57600; break;
+- case 115200: ir_baud = SPEED_115200; break;
+- case 576000: ir_baud = SPEED_576000; break;
+- case 1152000: ir_baud = SPEED_1152000; break;
+- case 4000000: ir_baud = SPEED_4000000; break;
+- break;
+- default:
+- ir_baud = SPEED_9600;
+- baud = 9600;
++ case 2400:
++ ir_baud = USB_IRDA_BR_2400;
++ break;
++ case 9600:
++ ir_baud = USB_IRDA_BR_9600;
++ break;
++ case 19200:
++ ir_baud = USB_IRDA_BR_19200;
++ break;
++ case 38400:
++ ir_baud = USB_IRDA_BR_38400;
++ break;
++ case 57600:
++ ir_baud = USB_IRDA_BR_57600;
++ break;
++ case 115200:
++ ir_baud = USB_IRDA_BR_115200;
++ break;
++ case 576000:
++ ir_baud = USB_IRDA_BR_576000;
++ break;
++ case 1152000:
++ ir_baud = USB_IRDA_BR_1152000;
++ break;
++ case 4000000:
++ ir_baud = USB_IRDA_BR_4000000;
++ break;
++ default:
++ ir_baud = USB_IRDA_BR_9600;
++ baud = 9600;
+ }
+
+ if (xbof == -1)
+@@ -538,10 +581,11 @@ static void ir_set_termios (struct usb_s
+ transfer_buffer = port->write_urb->transfer_buffer;
+ *transfer_buffer = ir_xbof | ir_baud;
+
+- usb_fill_bulk_urb (
++ usb_fill_bulk_urb(
+ port->write_urb,
+ port->serial->dev,
+- usb_sndbulkpipe(port->serial->dev, port->bulk_out_endpointAddress),
++ usb_sndbulkpipe(port->serial->dev,
++ port->bulk_out_endpointAddress),
+ port->write_urb->transfer_buffer,
+ 1,
+ ir_write_bulk_callback,
+@@ -549,38 +593,44 @@ static void ir_set_termios (struct usb_s
+
+ port->write_urb->transfer_flags = URB_ZERO_PACKET;
+
+- result = usb_submit_urb (port->write_urb, GFP_KERNEL);
++ result = usb_submit_urb(port->write_urb, GFP_KERNEL);
+ if (result)
+- dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __func__, result);
++ dev_err(&port->dev,
++ "%s - failed submitting write urb, error %d\n",
++ __func__, result);
+
+ /* Only speed changes are supported */
+ tty_termios_copy_hw(port->tty->termios, old_termios);
+ tty_encode_baud_rate(port->tty, baud, baud);
+ }
+
+-
+-static int __init ir_init (void)
++static int __init ir_init(void)
+ {
+ int retval;
++
+ retval = usb_serial_register(&ir_device);
+ if (retval)
+ goto failed_usb_serial_register;
++
+ retval = usb_register(&ir_driver);
+- if (retval)
++ if (retval)
+ goto failed_usb_register;
++
+ info(DRIVER_DESC " " DRIVER_VERSION);
++
+ return 0;
++
+ failed_usb_register:
+ usb_serial_deregister(&ir_device);
++
+ failed_usb_serial_register:
+ return retval;
+ }
+
+-
+-static void __exit ir_exit (void)
++static void __exit ir_exit(void)
+ {
+- usb_deregister (&ir_driver);
+- usb_serial_deregister (&ir_device);
++ usb_deregister(&ir_driver);
++ usb_serial_deregister(&ir_device);
+ }
+
+
+--- /dev/null
++++ b/include/linux/usb/irda.h
+@@ -0,0 +1,151 @@
++/*
++ * USB IrDA Bridge Device Definition
++ */
++
++#ifndef __LINUX_USB_IRDA_H
++#define __LINUX_USB_IRDA_H
++
++/* This device should use Application-specific class */
++
++#define USB_SUBCLASS_IRDA 0x02
++
++/*-------------------------------------------------------------------------*/
++
++/* Class-Specific requests (bRequest field) */
++
++#define USB_REQ_CS_IRDA_RECEIVING 1
++#define USB_REQ_CS_IRDA_CHECK_MEDIA_BUSY 3
++#define USB_REQ_CS_IRDA_RATE_SNIFF 4
++#define USB_REQ_CS_IRDA_UNICAST_LIST 5
++#define USB_REQ_CS_IRDA_GET_CLASS_DESC 6
++
++/*-------------------------------------------------------------------------*/
++
++/* Class-Specific descriptor */
++
++#define USB_DT_CS_IRDA 0x21
++
++/*-------------------------------------------------------------------------*/
++
++/* Data sizes */
++
++#define USB_IRDA_DS_2048 (1 << 5)
++#define USB_IRDA_DS_1024 (1 << 4)
++#define USB_IRDA_DS_512 (1 << 3)
++#define USB_IRDA_DS_256 (1 << 2)
++#define USB_IRDA_DS_128 (1 << 1)
++#define USB_IRDA_DS_64 (1 << 0)
++
++/* Window sizes */
++
++#define USB_IRDA_WS_7 (1 << 6)
++#define USB_IRDA_WS_6 (1 << 5)
++#define USB_IRDA_WS_5 (1 << 4)
++#define USB_IRDA_WS_4 (1 << 3)
++#define USB_IRDA_WS_3 (1 << 2)
++#define USB_IRDA_WS_2 (1 << 1)
++#define USB_IRDA_WS_1 (1 << 0)
++
++/* Min turnaround times in usecs */
++
++#define USB_IRDA_MTT_0 (1 << 7)
++#define USB_IRDA_MTT_10 (1 << 6)
++#define USB_IRDA_MTT_50 (1 << 5)
++#define USB_IRDA_MTT_100 (1 << 4)
++#define USB_IRDA_MTT_500 (1 << 3)
++#define USB_IRDA_MTT_1000 (1 << 2)
++#define USB_IRDA_MTT_5000 (1 << 1)
++#define USB_IRDA_MTT_10000 (1 << 0)
++
++/* Baud rates */
++
++#define USB_IRDA_BR_4000000 (1 << 8)
++#define USB_IRDA_BR_1152000 (1 << 7)
++#define USB_IRDA_BR_576000 (1 << 6)
++#define USB_IRDA_BR_115200 (1 << 5)
++#define USB_IRDA_BR_57600 (1 << 4)
++#define USB_IRDA_BR_38400 (1 << 3)
++#define USB_IRDA_BR_19200 (1 << 2)
++#define USB_IRDA_BR_9600 (1 << 1)
++#define USB_IRDA_BR_2400 (1 << 0)
++
++/* Additional BOFs */
++
++#define USB_IRDA_AB_0 (1 << 7)
++#define USB_IRDA_AB_1 (1 << 6)
++#define USB_IRDA_AB_2 (1 << 5)
++#define USB_IRDA_AB_3 (1 << 4)
++#define USB_IRDA_AB_6 (1 << 3)
++#define USB_IRDA_AB_12 (1 << 2)
++#define USB_IRDA_AB_24 (1 << 1)
++#define USB_IRDA_AB_48 (1 << 0)
++
++/* IRDA Rate Sniff */
++
++#define USB_IRDA_RATE_SNIFF 1
++
++/*-------------------------------------------------------------------------*/
++
++struct usb_irda_cs_descriptor {
++ __u8 bLength;
++ __u8 bDescriptorType;
++
++ __le16 bcdSpecRevision;
++ __u8 bmDataSize;
++ __u8 bmWindowSize;
++ __u8 bmMinTurnaroundTime;
++ __le16 wBaudRate;
++ __u8 bmAdditionalBOFs;
++ __u8 bIrdaRateSniff;
++ __u8 bMaxUnicastList;
++} __attribute__ ((packed));
++
++/*-------------------------------------------------------------------------*/
++
++/* Data Format */
++
++#define USB_IRDA_STATUS_MEDIA_BUSY (1 << 7)
++
++/* The following is a 4-bit value used for both
++ * inbound and outbound headers:
++ *
++ * 0 - speed ignored
++ * 1 - 2400 bps
++ * 2 - 9600 bps
++ * 3 - 19200 bps
++ * 4 - 38400 bps
++ * 5 - 57600 bps
++ * 6 - 115200 bps
++ * 7 - 576000 bps
++ * 8 - 1.152 Mbps
++ * 9 - 5 mbps
++ * 10..15 - Reserved
++ */
++#define USB_IRDA_STATUS_LINK_SPEED 0x0f
++
++/* The following is a 4-bit value used only for
++ * outbound header:
++ *
++ * 0 - No change (BOF ignored)
++ * 1 - 48 BOFs
++ * 2 - 24 BOFs
++ * 3 - 12 BOFs
++ * 4 - 6 BOFs
++ * 5 - 3 BOFs
++ * 6 - 2 BOFs
++ * 7 - 1 BOFs
++ * 8 - 0 BOFs
++ * 9..15 - Reserved
++ */
++#define USB_IRDA_EXTRA_BOFS 0xf0
++
++struct usb_irda_inbound_header {
++ __u8 bmStatus;
++};
++
++struct usb_irda_outbound_header {
++ __u8 bmChange;
++};
++
++#endif /* __LINUX_USB_IRDA_H */
++
diff --git a/usb/usb-uhci-mark-root_hub_hub_des-as-const.patch b/usb/usb-uhci-mark-root_hub_hub_des-as-const.patch
new file mode 100644
index 00000000000000..b5bddd10ab9fa4
--- /dev/null
+++ b/usb/usb-uhci-mark-root_hub_hub_des-as-const.patch
@@ -0,0 +1,32 @@
+From tom.leiming@gmail.com Fri Jun 13 17:38:43 2008
+From: Ming Lei <tom.leiming@gmail.com>
+Date: Sun, 8 Jun 2008 16:44:40 +0800
+Subject: USB: uhci: mark root_hub_hub_des[] as const
+To: stern@rowland.harvard.edu, greg@kroah.com
+Cc: linux-usb@vger.kernel.org, Ming Lei <tom.leiming@gmail.com>
+Message-ID: <1212914680-7990-1-git-send-email-tom.leiming@gmail.com>
+
+
+From: Ming Lei <tom.leiming@gmail.com>
+
+mark this array as const because it is read-only
+
+Signed-off-by: Ming Lei <tom.leiming@gmail.com>
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/host/uhci-hub.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/host/uhci-hub.c
++++ b/drivers/usb/host/uhci-hub.c
+@@ -12,7 +12,7 @@
+ * (C) Copyright 2004 Alan Stern, stern@rowland.harvard.edu
+ */
+
+-static __u8 root_hub_hub_des[] =
++static const __u8 root_hub_hub_des[] =
+ {
+ 0x09, /* __u8 bLength; */
+ 0x29, /* __u8 bDescriptorType; Hub-descriptor */
diff --git a/usb/usb-usbmon-use-simple_read_from_buffer.patch b/usb/usb-usbmon-use-simple_read_from_buffer.patch
new file mode 100644
index 00000000000000..6027587735b8d2
--- /dev/null
+++ b/usb/usb-usbmon-use-simple_read_from_buffer.patch
@@ -0,0 +1,51 @@
+From akpm@linux-foundation.org Fri Jun 13 17:41:09 2008
+From: Akinobu Mita <akinobu.mita@gmail.com>
+Date: Mon, 09 Jun 2008 16:39:57 -0700
+Subject: USB: usbmon: use simple_read_from_buffer()
+To: greg@kroah.com
+Cc: linux-usb@vger.kernel.org, akpm@linux-foundation.org, akinobu.mita@gmail.com, zaitcev@redhat.com
+Message-ID: <200806092339.m59NdvFv015022@imap1.linux-foundation.org>
+
+
+From: Akinobu Mita <akinobu.mita@gmail.com>
+
+Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
+Acked-by: Pete Zaitcev <zaitcev@redhat.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/mon/mon_stat.c | 14 ++------------
+ 1 file changed, 2 insertions(+), 12 deletions(-)
+
+--- a/drivers/usb/mon/mon_stat.c
++++ b/drivers/usb/mon/mon_stat.c
+@@ -9,6 +9,7 @@
+
+ #include <linux/kernel.h>
+ #include <linux/usb.h>
++#include <linux/fs.h>
+ #include <asm/uaccess.h>
+
+ #include "usb_mon.h"
+@@ -42,19 +43,8 @@ static ssize_t mon_stat_read(struct file
+ size_t nbytes, loff_t *ppos)
+ {
+ struct snap *sp = file->private_data;
+- loff_t pos = *ppos;
+- int cnt;
+
+- if (pos < 0 || pos >= sp->slen)
+- return 0;
+- if (nbytes == 0)
+- return 0;
+- if ((cnt = sp->slen - pos) > nbytes)
+- cnt = nbytes;
+- if (copy_to_user(buf, sp->str + pos, cnt))
+- return -EFAULT;
+- *ppos = pos + cnt;
+- return cnt;
++ return simple_read_from_buffer(buf, nbytes, ppos, sp->str, sp->slen);
+ }
+
+ static int mon_stat_release(struct inode *inode, struct file *file)