aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/configs/omap1_defconfig1
-rw-r--r--arch/arm/configs/omap2plus_defconfig1
-rw-r--r--arch/mips/configs/db1000_defconfig1
-rw-r--r--arch/mips/configs/db1235_defconfig1
-rw-r--r--arch/mips/configs/lemote2f_defconfig1
-rw-r--r--arch/powerpc/configs/ps3_defconfig1
-rw-r--r--drivers/net/usb/usbnet.c2
-rw-r--r--drivers/staging/dwc2/Kconfig1
-rw-r--r--drivers/staging/gdm72xx/Kconfig2
-rw-r--r--drivers/usb/atm/cxacru.c3
-rw-r--r--drivers/usb/chipidea/Kconfig2
-rw-r--r--drivers/usb/chipidea/ci13xxx_imx.c15
-rw-r--r--drivers/usb/core/Kconfig2
-rw-r--r--drivers/usb/core/quirks.c3
-rw-r--r--drivers/usb/dwc3/Kconfig6
-rw-r--r--drivers/usb/dwc3/dwc3-exynos.c6
-rw-r--r--drivers/usb/gadget/Kconfig1
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c2
-rw-r--r--drivers/usb/gadget/bcm63xx_udc.c1
-rw-r--r--drivers/usb/gadget/configfs.c8
-rw-r--r--drivers/usb/gadget/dummy_hcd.c5
-rw-r--r--drivers/usb/gadget/f_ecm.c1
-rw-r--r--drivers/usb/gadget/f_subset.c1
-rw-r--r--drivers/usb/gadget/f_uac2.c2
-rw-r--r--drivers/usb/gadget/fusb300_udc.c4
-rw-r--r--drivers/usb/gadget/imx_udc.c2
-rw-r--r--drivers/usb/gadget/m66592-udc.c4
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c1
-rw-r--r--drivers/usb/gadget/r8a66597-udc.c4
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c2
-rw-r--r--drivers/usb/gadget/s3c2410_udc.c3
-rw-r--r--drivers/usb/gadget/zero.c8
-rw-r--r--drivers/usb/host/Kconfig17
-rw-r--r--drivers/usb/host/ehci-atmel.c6
-rw-r--r--drivers/usb/host/ehci-hcd.c17
-rw-r--r--drivers/usb/host/ehci-omap.c8
-rw-r--r--drivers/usb/host/ehci-orion.c6
-rw-r--r--drivers/usb/host/ehci-s5p.c5
-rw-r--r--drivers/usb/host/ehci-spear.c6
-rw-r--r--drivers/usb/host/ehci-tegra.c6
-rw-r--r--drivers/usb/host/isp1760-hcd.c2
-rw-r--r--drivers/usb/host/isp1760-if.c4
-rw-r--r--drivers/usb/host/ohci-at91.c6
-rw-r--r--drivers/usb/host/ohci-exynos.c4
-rw-r--r--drivers/usb/host/ohci-hcd.c34
-rw-r--r--drivers/usb/host/ohci-nxp.c44
-rw-r--r--drivers/usb/host/ohci-omap3.c8
-rw-r--r--drivers/usb/host/ohci-pxa27x.c6
-rw-r--r--drivers/usb/host/ohci-spear.c6
-rw-r--r--drivers/usb/host/oxu210hp-hcd.c2
-rw-r--r--drivers/usb/host/sl811-hcd.c2
-rw-r--r--drivers/usb/host/uhci-hub.c3
-rw-r--r--drivers/usb/host/uhci-platform.c6
-rw-r--r--drivers/usb/host/uhci-q.c2
-rw-r--r--drivers/usb/host/xhci-mem.c17
-rw-r--r--drivers/usb/musb/musb_dsps.c1
-rw-r--r--drivers/usb/musb/omap2430.c3
-rw-r--r--drivers/usb/phy/Kconfig5
-rw-r--r--drivers/usb/phy/phy-ab8500-usb.c2
-rw-r--r--drivers/usb/phy/phy-fsl-usb.c1
-rw-r--r--drivers/usb/phy/phy-gpio-vbus-usb.c3
-rw-r--r--drivers/usb/phy/phy-isp1301.c1
-rw-r--r--drivers/usb/phy/phy-mv-usb.c3
-rw-r--r--drivers/usb/phy/phy-mxs-usb.c3
-rw-r--r--drivers/usb/phy/phy-nop.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.c30
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h2
-rw-r--r--drivers/usb/serial/generic.c31
-rw-r--r--drivers/usb/serial/io_ti.c22
-rw-r--r--drivers/usb/serial/option.c13
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c23
-rw-r--r--drivers/usb/serial/usb-serial.c30
-rw-r--r--drivers/usb/storage/realtek_cr.c8
-rw-r--r--include/linux/usb/gadget.h5
-rw-r--r--include/linux/usb/serial.h4
75 files changed, 268 insertions, 238 deletions
diff --git a/arch/arm/configs/omap1_defconfig b/arch/arm/configs/omap1_defconfig
index 7e0ebb64a7f9..9940f7b4e438 100644
--- a/arch/arm/configs/omap1_defconfig
+++ b/arch/arm/configs/omap1_defconfig
@@ -199,7 +199,6 @@ CONFIG_USB_PHY=y
199CONFIG_USB_DEBUG=y 199CONFIG_USB_DEBUG=y
200CONFIG_USB_DEVICEFS=y 200CONFIG_USB_DEVICEFS=y
201# CONFIG_USB_DEVICE_CLASS is not set 201# CONFIG_USB_DEVICE_CLASS is not set
202CONFIG_USB_SUSPEND=y
203CONFIG_USB_MON=y 202CONFIG_USB_MON=y
204CONFIG_USB_OHCI_HCD=y 203CONFIG_USB_OHCI_HCD=y
205CONFIG_USB_STORAGE=y 204CONFIG_USB_STORAGE=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index c1ef64bc5abd..435d69b83e32 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -204,7 +204,6 @@ CONFIG_USB=y
204CONFIG_USB_DEBUG=y 204CONFIG_USB_DEBUG=y
205CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 205CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
206CONFIG_USB_DEVICEFS=y 206CONFIG_USB_DEVICEFS=y
207CONFIG_USB_SUSPEND=y
208CONFIG_USB_MON=y 207CONFIG_USB_MON=y
209CONFIG_USB_WDM=y 208CONFIG_USB_WDM=y
210CONFIG_USB_STORAGE=y 209CONFIG_USB_STORAGE=y
diff --git a/arch/mips/configs/db1000_defconfig b/arch/mips/configs/db1000_defconfig
index face9d26e6d5..bac26b971c5e 100644
--- a/arch/mips/configs/db1000_defconfig
+++ b/arch/mips/configs/db1000_defconfig
@@ -228,7 +228,6 @@ CONFIG_HIDRAW=y
228CONFIG_USB_HID=y 228CONFIG_USB_HID=y
229CONFIG_USB_SUPPORT=y 229CONFIG_USB_SUPPORT=y
230CONFIG_USB=y 230CONFIG_USB=y
231CONFIG_USB_SUSPEND=y
232CONFIG_USB_EHCI_HCD=y 231CONFIG_USB_EHCI_HCD=y
233CONFIG_USB_EHCI_ROOT_HUB_TT=y 232CONFIG_USB_EHCI_ROOT_HUB_TT=y
234CONFIG_USB_EHCI_TT_NEWSCHED=y 233CONFIG_USB_EHCI_TT_NEWSCHED=y
diff --git a/arch/mips/configs/db1235_defconfig b/arch/mips/configs/db1235_defconfig
index 14752dde7540..e2b4ad55462f 100644
--- a/arch/mips/configs/db1235_defconfig
+++ b/arch/mips/configs/db1235_defconfig
@@ -344,7 +344,6 @@ CONFIG_UHID=y
344CONFIG_USB_HIDDEV=y 344CONFIG_USB_HIDDEV=y
345CONFIG_USB=y 345CONFIG_USB=y
346CONFIG_USB_DYNAMIC_MINORS=y 346CONFIG_USB_DYNAMIC_MINORS=y
347CONFIG_USB_SUSPEND=y
348CONFIG_USB_EHCI_HCD=y 347CONFIG_USB_EHCI_HCD=y
349CONFIG_USB_EHCI_HCD_PLATFORM=y 348CONFIG_USB_EHCI_HCD_PLATFORM=y
350CONFIG_USB_EHCI_ROOT_HUB_TT=y 349CONFIG_USB_EHCI_ROOT_HUB_TT=y
diff --git a/arch/mips/configs/lemote2f_defconfig b/arch/mips/configs/lemote2f_defconfig
index b6acd2f256b6..343bebc4b63b 100644
--- a/arch/mips/configs/lemote2f_defconfig
+++ b/arch/mips/configs/lemote2f_defconfig
@@ -300,7 +300,6 @@ CONFIG_USB=y
300CONFIG_USB_DEVICEFS=y 300CONFIG_USB_DEVICEFS=y
301# CONFIG_USB_DEVICE_CLASS is not set 301# CONFIG_USB_DEVICE_CLASS is not set
302CONFIG_USB_DYNAMIC_MINORS=y 302CONFIG_USB_DYNAMIC_MINORS=y
303CONFIG_USB_SUSPEND=y
304CONFIG_USB_OTG_WHITELIST=y 303CONFIG_USB_OTG_WHITELIST=y
305CONFIG_USB_MON=y 304CONFIG_USB_MON=y
306CONFIG_USB_EHCI_HCD=y 305CONFIG_USB_EHCI_HCD=y
diff --git a/arch/powerpc/configs/ps3_defconfig b/arch/powerpc/configs/ps3_defconfig
index f79196232917..139a8308070c 100644
--- a/arch/powerpc/configs/ps3_defconfig
+++ b/arch/powerpc/configs/ps3_defconfig
@@ -136,7 +136,6 @@ CONFIG_HID_SMARTJOYPLUS=m
136CONFIG_USB_HIDDEV=y 136CONFIG_USB_HIDDEV=y
137CONFIG_USB=m 137CONFIG_USB=m
138CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 138CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
139CONFIG_USB_SUSPEND=y
140CONFIG_USB_MON=m 139CONFIG_USB_MON=m
141CONFIG_USB_EHCI_HCD=m 140CONFIG_USB_EHCI_HCD=m
142# CONFIG_USB_EHCI_HCD_PPC_OF is not set 141# CONFIG_USB_EHCI_HCD_PPC_OF is not set
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index f95cb032394b..06ee82f557d4 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1477,7 +1477,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1477 1477
1478 /* usbnet already took usb runtime pm, so have to enable the feature 1478 /* usbnet already took usb runtime pm, so have to enable the feature
1479 * for usb interface, otherwise usb_autopm_get_interface may return 1479 * for usb interface, otherwise usb_autopm_get_interface may return
1480 * failure if USB_SUSPEND(RUNTIME_PM) is enabled. 1480 * failure if RUNTIME_PM is enabled.
1481 */ 1481 */
1482 if (!driver->supports_autosuspend) { 1482 if (!driver->supports_autosuspend) {
1483 driver->supports_autosuspend = 1; 1483 driver->supports_autosuspend = 1;
diff --git a/drivers/staging/dwc2/Kconfig b/drivers/staging/dwc2/Kconfig
index f0b4739c65a1..bbee1775d49e 100644
--- a/drivers/staging/dwc2/Kconfig
+++ b/drivers/staging/dwc2/Kconfig
@@ -2,7 +2,6 @@ config USB_DWC2
2 tristate "DesignWare USB2 DRD Core Support" 2 tristate "DesignWare USB2 DRD Core Support"
3 depends on USB 3 depends on USB
4 depends on VIRT_TO_BUS 4 depends on VIRT_TO_BUS
5 select USB_OTG_UTILS
6 help 5 help
7 Say Y or M here if your system has a Dual Role HighSpeed 6 Say Y or M here if your system has a Dual Role HighSpeed
8 USB controller based on the DesignWare HSOTG IP Core. 7 USB controller based on the DesignWare HSOTG IP Core.
diff --git a/drivers/staging/gdm72xx/Kconfig b/drivers/staging/gdm72xx/Kconfig
index 3c18efe31365..69059138de4a 100644
--- a/drivers/staging/gdm72xx/Kconfig
+++ b/drivers/staging/gdm72xx/Kconfig
@@ -39,7 +39,7 @@ if WIMAX_GDM72XX_USB
39 39
40config WIMAX_GDM72XX_USB_PM 40config WIMAX_GDM72XX_USB_PM
41 bool "Enable power managerment support" 41 bool "Enable power managerment support"
42 depends on USB_SUSPEND 42 depends on PM_RUNTIME
43 43
44endif # WIMAX_GDM72XX_USB 44endif # WIMAX_GDM72XX_USB
45 45
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index b7eb86ad6bf2..8a7eb77233b4 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -686,7 +686,8 @@ static int cxacru_cm_get_array(struct cxacru_data *instance, enum cxacru_cm_requ
686{ 686{
687 int ret, len; 687 int ret, len;
688 __le32 *buf; 688 __le32 *buf;
689 int offb, offd; 689 int offb;
690 unsigned int offd;
690 const int stride = CMD_PACKET_SIZE / (4 * 2) - 1; 691 const int stride = CMD_PACKET_SIZE / (4 * 2) - 1;
691 int buflen = ((size - 1) / stride + 1 + size * 2) * 4; 692 int buflen = ((size - 1) / stride + 1 + size * 2) * 4;
692 693
diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig
index 608a2aeb400c..b2df442eb3e5 100644
--- a/drivers/usb/chipidea/Kconfig
+++ b/drivers/usb/chipidea/Kconfig
@@ -20,7 +20,7 @@ config USB_CHIPIDEA_UDC
20config USB_CHIPIDEA_HOST 20config USB_CHIPIDEA_HOST
21 bool "ChipIdea host controller" 21 bool "ChipIdea host controller"
22 depends on USB=y || USB=USB_CHIPIDEA 22 depends on USB=y || USB=USB_CHIPIDEA
23 depends on USB_EHCI_HCD 23 depends on USB_EHCI_HCD=y
24 select USB_EHCI_ROOT_HUB_TT 24 select USB_EHCI_ROOT_HUB_TT
25 help 25 help
26 Say Y here to enable host controller functionality of the 26 Say Y here to enable host controller functionality of the
diff --git a/drivers/usb/chipidea/ci13xxx_imx.c b/drivers/usb/chipidea/ci13xxx_imx.c
index 8faec9dbbb84..73f9d5f15adb 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c
@@ -173,17 +173,10 @@ static int ci13xxx_imx_probe(struct platform_device *pdev)
173 173
174 ci13xxx_imx_platdata.phy = data->phy; 174 ci13xxx_imx_platdata.phy = data->phy;
175 175
176 if (!pdev->dev.dma_mask) { 176 if (!pdev->dev.dma_mask)
177 pdev->dev.dma_mask = devm_kzalloc(&pdev->dev, 177 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
178 sizeof(*pdev->dev.dma_mask), GFP_KERNEL); 178 if (!pdev->dev.coherent_dma_mask)
179 if (!pdev->dev.dma_mask) { 179 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
180 ret = -ENOMEM;
181 dev_err(&pdev->dev, "Failed to alloc dma_mask!\n");
182 goto err;
183 }
184 *pdev->dev.dma_mask = DMA_BIT_MASK(32);
185 dma_set_coherent_mask(&pdev->dev, *pdev->dev.dma_mask);
186 }
187 180
188 if (usbmisc_ops && usbmisc_ops->init) { 181 if (usbmisc_ops && usbmisc_ops->init) {
189 ret = usbmisc_ops->init(&pdev->dev); 182 ret = usbmisc_ops->init(&pdev->dev);
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index 8772b3659296..db535b0aa172 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -51,7 +51,7 @@ config USB_DYNAMIC_MINORS
51 51
52config USB_OTG 52config USB_OTG
53 bool "OTG support" 53 bool "OTG support"
54 depends on USB_SUSPEND 54 depends on PM_RUNTIME
55 default n 55 default n
56 help 56 help
57 The most notable feature of USB OTG is support for a 57 The most notable feature of USB OTG is support for a
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index ab5638d9c707..a63598895077 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -88,6 +88,9 @@ static const struct usb_device_id usb_quirk_list[] = {
88 /* Edirol SD-20 */ 88 /* Edirol SD-20 */
89 { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME }, 89 { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME },
90 90
91 /* Alcor Micro Corp. Hub */
92 { USB_DEVICE(0x058f, 0x9254), .driver_info = USB_QUIRK_RESET_RESUME },
93
91 /* appletouch */ 94 /* appletouch */
92 { USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME }, 95 { USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME },
93 96
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index ea5ee9c21c35..757aa18027d0 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -19,21 +19,21 @@ choice
19 19
20config USB_DWC3_HOST 20config USB_DWC3_HOST
21 bool "Host only mode" 21 bool "Host only mode"
22 depends on USB 22 depends on USB=y || USB=USB_DWC3
23 help 23 help
24 Select this when you want to use DWC3 in host mode only, 24 Select this when you want to use DWC3 in host mode only,
25 thereby the gadget feature will be regressed. 25 thereby the gadget feature will be regressed.
26 26
27config USB_DWC3_GADGET 27config USB_DWC3_GADGET
28 bool "Gadget only mode" 28 bool "Gadget only mode"
29 depends on USB_GADGET 29 depends on USB_GADGET=y || USB_GADGET=USB_DWC3
30 help 30 help
31 Select this when you want to use DWC3 in gadget mode only, 31 Select this when you want to use DWC3 in gadget mode only,
32 thereby the host feature will be regressed. 32 thereby the host feature will be regressed.
33 33
34config USB_DWC3_DUAL_ROLE 34config USB_DWC3_DUAL_ROLE
35 bool "Dual Role mode" 35 bool "Dual Role mode"
36 depends on (USB && USB_GADGET) 36 depends on ((USB=y || USB=USB_DWC3) && (USB_GADGET=y || USB_GADGET=USB_DWC3))
37 help 37 help
38 This is the default mode of working of DWC3 controller where 38 This is the default mode of working of DWC3 controller where
39 both host and gadget features are enabled. 39 both host and gadget features are enabled.
diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
index a8afe6e26621..929e7dd6e58b 100644
--- a/drivers/usb/dwc3/dwc3-exynos.c
+++ b/drivers/usb/dwc3/dwc3-exynos.c
@@ -95,8 +95,6 @@ static int dwc3_exynos_remove_child(struct device *dev, void *unused)
95 return 0; 95 return 0;
96} 96}
97 97
98static u64 dwc3_exynos_dma_mask = DMA_BIT_MASK(32);
99
100static int dwc3_exynos_probe(struct platform_device *pdev) 98static int dwc3_exynos_probe(struct platform_device *pdev)
101{ 99{
102 struct dwc3_exynos *exynos; 100 struct dwc3_exynos *exynos;
@@ -118,7 +116,9 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
118 * Once we move to full device tree support this will vanish off. 116 * Once we move to full device tree support this will vanish off.
119 */ 117 */
120 if (!dev->dma_mask) 118 if (!dev->dma_mask)
121 dev->dma_mask = &dwc3_exynos_dma_mask; 119 dev->dma_mask = &dev->coherent_dma_mask;
120 if (!dev->coherent_dma_mask)
121 dev->coherent_dma_mask = DMA_BIT_MASK(32);
122 122
123 platform_set_drvdata(pdev, exynos); 123 platform_set_drvdata(pdev, exynos);
124 124
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 83300d94a893..f41aa0d0c414 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -146,7 +146,6 @@ config USB_LPC32XX
146 depends on ARCH_LPC32XX 146 depends on ARCH_LPC32XX
147 depends on USB_PHY 147 depends on USB_PHY
148 select USB_ISP1301 148 select USB_ISP1301
149 select USB_OTG_UTILS
150 help 149 help
151 This option selects the USB device controller in the LPC32xx SoC. 150 This option selects the USB device controller in the LPC32xx SoC.
152 151
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index f2a970f75bfa..5a5128a226f7 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1992,8 +1992,6 @@ err_map_regs:
1992err_get_hclk: 1992err_get_hclk:
1993 clk_put(pclk); 1993 clk_put(pclk);
1994 1994
1995 platform_set_drvdata(pdev, NULL);
1996
1997 return ret; 1995 return ret;
1998} 1996}
1999 1997
diff --git a/drivers/usb/gadget/bcm63xx_udc.c b/drivers/usb/gadget/bcm63xx_udc.c
index 792297798147..fd24cb4540a4 100644
--- a/drivers/usb/gadget/bcm63xx_udc.c
+++ b/drivers/usb/gadget/bcm63xx_udc.c
@@ -2410,7 +2410,6 @@ static int bcm63xx_udc_remove(struct platform_device *pdev)
2410 usb_del_gadget_udc(&udc->gadget); 2410 usb_del_gadget_udc(&udc->gadget);
2411 BUG_ON(udc->driver); 2411 BUG_ON(udc->driver);
2412 2412
2413 platform_set_drvdata(pdev, NULL);
2414 bcm63xx_uninit_udc_hw(udc); 2413 bcm63xx_uninit_udc_hw(udc);
2415 2414
2416 return 0; 2415 return 0;
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 3d5cfc9c2c78..80e7f75a56c7 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -821,8 +821,10 @@ static int configfs_composite_bind(struct usb_gadget *gadget,
821 gi->gstrings[i] = NULL; 821 gi->gstrings[i] = NULL;
822 s = usb_gstrings_attach(&gi->cdev, gi->gstrings, 822 s = usb_gstrings_attach(&gi->cdev, gi->gstrings,
823 USB_GADGET_FIRST_AVAIL_IDX); 823 USB_GADGET_FIRST_AVAIL_IDX);
824 if (IS_ERR(s)) 824 if (IS_ERR(s)) {
825 ret = PTR_ERR(s);
825 goto err_comp_cleanup; 826 goto err_comp_cleanup;
827 }
826 828
827 gi->cdev.desc.iManufacturer = s[USB_GADGET_MANUFACTURER_IDX].id; 829 gi->cdev.desc.iManufacturer = s[USB_GADGET_MANUFACTURER_IDX].id;
828 gi->cdev.desc.iProduct = s[USB_GADGET_PRODUCT_IDX].id; 830 gi->cdev.desc.iProduct = s[USB_GADGET_PRODUCT_IDX].id;
@@ -847,8 +849,10 @@ static int configfs_composite_bind(struct usb_gadget *gadget,
847 } 849 }
848 cfg->gstrings[i] = NULL; 850 cfg->gstrings[i] = NULL;
849 s = usb_gstrings_attach(&gi->cdev, cfg->gstrings, 1); 851 s = usb_gstrings_attach(&gi->cdev, cfg->gstrings, 1);
850 if (IS_ERR(s)) 852 if (IS_ERR(s)) {
853 ret = PTR_ERR(s);
851 goto err_comp_cleanup; 854 goto err_comp_cleanup;
855 }
852 c->iConfiguration = s[0].id; 856 c->iConfiguration = s[0].id;
853 } 857 }
854 858
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index a792e322f4f1..c588e8e486e5 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -1001,7 +1001,6 @@ static int dummy_udc_remove(struct platform_device *pdev)
1001 struct dummy *dum = platform_get_drvdata(pdev); 1001 struct dummy *dum = platform_get_drvdata(pdev);
1002 1002
1003 usb_del_gadget_udc(&dum->gadget); 1003 usb_del_gadget_udc(&dum->gadget);
1004 platform_set_drvdata(pdev, NULL);
1005 device_remove_file(&dum->gadget.dev, &dev_attr_function); 1004 device_remove_file(&dum->gadget.dev, &dev_attr_function);
1006 return 0; 1005 return 0;
1007} 1006}
@@ -2661,8 +2660,10 @@ static int __init init(void)
2661 } 2660 }
2662 for (i = 0; i < mod_data.num; i++) { 2661 for (i = 0; i < mod_data.num; i++) {
2663 dum[i] = kzalloc(sizeof(struct dummy), GFP_KERNEL); 2662 dum[i] = kzalloc(sizeof(struct dummy), GFP_KERNEL);
2664 if (!dum[i]) 2663 if (!dum[i]) {
2664 retval = -ENOMEM;
2665 goto err_add_pdata; 2665 goto err_add_pdata;
2666 }
2666 retval = platform_device_add_data(the_hcd_pdev[i], &dum[i], 2667 retval = platform_device_add_data(the_hcd_pdev[i], &dum[i],
2667 sizeof(void *)); 2668 sizeof(void *));
2668 if (retval) 2669 if (retval)
diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c
index d893d6929079..abf8a31ae146 100644
--- a/drivers/usb/gadget/f_ecm.c
+++ b/drivers/usb/gadget/f_ecm.c
@@ -816,6 +816,7 @@ ecm_unbind(struct usb_configuration *c, struct usb_function *f)
816 * @c: the configuration to support the network link 816 * @c: the configuration to support the network link
817 * @ethaddr: a buffer in which the ethernet address of the host side 817 * @ethaddr: a buffer in which the ethernet address of the host side
818 * side of the link was recorded 818 * side of the link was recorded
819 * @dev: eth_dev structure
819 * Context: single threaded during gadget setup 820 * Context: single threaded during gadget setup
820 * 821 *
821 * Returns zero on success, else negative errno. 822 * Returns zero on success, else negative errno.
diff --git a/drivers/usb/gadget/f_subset.c b/drivers/usb/gadget/f_subset.c
index 185d6f5e4e4d..7be04b342494 100644
--- a/drivers/usb/gadget/f_subset.c
+++ b/drivers/usb/gadget/f_subset.c
@@ -373,6 +373,7 @@ geth_unbind(struct usb_configuration *c, struct usb_function *f)
373 * @c: the configuration to support the network link 373 * @c: the configuration to support the network link
374 * @ethaddr: a buffer in which the ethernet address of the host side 374 * @ethaddr: a buffer in which the ethernet address of the host side
375 * side of the link was recorded 375 * side of the link was recorded
376 * @dev: eth_dev structure
376 * Context: single threaded during gadget setup 377 * Context: single threaded during gadget setup
377 * 378 *
378 * Returns zero on success, else negative errno. 379 * Returns zero on success, else negative errno.
diff --git a/drivers/usb/gadget/f_uac2.c b/drivers/usb/gadget/f_uac2.c
index c7468b6c07b0..03c1fb686644 100644
--- a/drivers/usb/gadget/f_uac2.c
+++ b/drivers/usb/gadget/f_uac2.c
@@ -456,8 +456,6 @@ static int snd_uac2_remove(struct platform_device *pdev)
456{ 456{
457 struct snd_card *card = platform_get_drvdata(pdev); 457 struct snd_card *card = platform_get_drvdata(pdev);
458 458
459 platform_set_drvdata(pdev, NULL);
460
461 if (card) 459 if (card)
462 return snd_card_free(card); 460 return snd_card_free(card);
463 461
diff --git a/drivers/usb/gadget/fusb300_udc.c b/drivers/usb/gadget/fusb300_udc.c
index cec8871b77f9..b8632d40f8bf 100644
--- a/drivers/usb/gadget/fusb300_udc.c
+++ b/drivers/usb/gadget/fusb300_udc.c
@@ -1461,8 +1461,10 @@ static int __init fusb300_probe(struct platform_device *pdev)
1461 1461
1462 fusb300->ep0_req = fusb300_alloc_request(&fusb300->ep[0]->ep, 1462 fusb300->ep0_req = fusb300_alloc_request(&fusb300->ep[0]->ep,
1463 GFP_KERNEL); 1463 GFP_KERNEL);
1464 if (fusb300->ep0_req == NULL) 1464 if (fusb300->ep0_req == NULL) {
1465 ret = -ENOMEM;
1465 goto clean_up3; 1466 goto clean_up3;
1467 }
1466 1468
1467 init_controller(fusb300); 1469 init_controller(fusb300);
1468 ret = usb_add_gadget_udc(&pdev->dev, &fusb300->gadget); 1470 ret = usb_add_gadget_udc(&pdev->dev, &fusb300->gadget);
diff --git a/drivers/usb/gadget/imx_udc.c b/drivers/usb/gadget/imx_udc.c
index b5cebd6b0d7a..9b2d24e4c95f 100644
--- a/drivers/usb/gadget/imx_udc.c
+++ b/drivers/usb/gadget/imx_udc.c
@@ -1511,8 +1511,6 @@ static int __exit imx_udc_remove(struct platform_device *pdev)
1511 if (pdata->exit) 1511 if (pdata->exit)
1512 pdata->exit(&pdev->dev); 1512 pdata->exit(&pdev->dev);
1513 1513
1514 platform_set_drvdata(pdev, NULL);
1515
1516 return 0; 1514 return 0;
1517} 1515}
1518 1516
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index 866ef0999247..51cfe72da5bb 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -1660,8 +1660,10 @@ static int __init m66592_probe(struct platform_device *pdev)
1660 m66592->epaddr2ep[0] = &m66592->ep[0]; 1660 m66592->epaddr2ep[0] = &m66592->ep[0];
1661 1661
1662 m66592->ep0_req = m66592_alloc_request(&m66592->ep[0].ep, GFP_KERNEL); 1662 m66592->ep0_req = m66592_alloc_request(&m66592->ep[0].ep, GFP_KERNEL);
1663 if (m66592->ep0_req == NULL) 1663 if (m66592->ep0_req == NULL) {
1664 ret = -ENOMEM;
1664 goto clean_up3; 1665 goto clean_up3;
1666 }
1665 m66592->ep0_req->complete = nop_completion; 1667 m66592->ep0_req->complete = nop_completion;
1666 1668
1667 init_controller(m66592); 1669 init_controller(m66592);
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index ef47495dec8f..95c531d5aa4f 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -2236,7 +2236,6 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev)
2236 dev->transceiver = NULL; 2236 dev->transceiver = NULL;
2237 } 2237 }
2238 2238
2239 platform_set_drvdata(pdev, NULL);
2240 the_controller = NULL; 2239 the_controller = NULL;
2241 return 0; 2240 return 0;
2242} 2241}
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index 0b742d171843..7ff7d9cf2061 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -1977,8 +1977,10 @@ static int __init r8a66597_probe(struct platform_device *pdev)
1977 1977
1978 r8a66597->ep0_req = r8a66597_alloc_request(&r8a66597->ep[0].ep, 1978 r8a66597->ep0_req = r8a66597_alloc_request(&r8a66597->ep[0].ep,
1979 GFP_KERNEL); 1979 GFP_KERNEL);
1980 if (r8a66597->ep0_req == NULL) 1980 if (r8a66597->ep0_req == NULL) {
1981 ret = -ENOMEM;
1981 goto clean_up3; 1982 goto clean_up3;
1983 }
1982 r8a66597->ep0_req->complete = nop_completion; 1984 r8a66597->ep0_req->complete = nop_completion;
1983 1985
1984 ret = usb_add_gadget_udc(&pdev->dev, &r8a66597->gadget); 1986 ret = usb_add_gadget_udc(&pdev->dev, &r8a66597->gadget);
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index a3cdc32115d5..af22f24046b2 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -437,7 +437,7 @@ static void s3c_hsotg_unmap_dma(struct s3c_hsotg *hsotg,
437 if (hs_req->req.length == 0) 437 if (hs_req->req.length == 0)
438 return; 438 return;
439 439
440 usb_gadget_unmap_request(&hsotg->gadget, hs_req, hs_ep->dir_in); 440 usb_gadget_unmap_request(&hsotg->gadget, req, hs_ep->dir_in);
441} 441}
442 442
443/** 443/**
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index d0e75e1b3ccb..09c4f70c93c4 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -1851,6 +1851,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
1851 irq = gpio_to_irq(udc_info->vbus_pin); 1851 irq = gpio_to_irq(udc_info->vbus_pin);
1852 if (irq < 0) { 1852 if (irq < 0) {
1853 dev_err(dev, "no irq for gpio vbus pin\n"); 1853 dev_err(dev, "no irq for gpio vbus pin\n");
1854 retval = irq;
1854 goto err_gpio_claim; 1855 goto err_gpio_claim;
1855 } 1856 }
1856 1857
@@ -1948,8 +1949,6 @@ static int s3c2410_udc_remove(struct platform_device *pdev)
1948 iounmap(base_addr); 1949 iounmap(base_addr);
1949 release_mem_region(rsrc_start, rsrc_len); 1950 release_mem_region(rsrc_start, rsrc_len);
1950 1951
1951 platform_set_drvdata(pdev, NULL);
1952
1953 if (!IS_ERR(udc_clock) && udc_clock != NULL) { 1952 if (!IS_ERR(udc_clock) && udc_clock != NULL) {
1954 clk_disable(udc_clock); 1953 clk_disable(udc_clock);
1955 clk_put(udc_clock); 1954 clk_put(udc_clock);
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index 2cd6262e8b71..0deb9d6cde26 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -284,12 +284,16 @@ static int __init zero_bind(struct usb_composite_dev *cdev)
284 ss_opts->bulk_buflen = gzero_options.bulk_buflen; 284 ss_opts->bulk_buflen = gzero_options.bulk_buflen;
285 285
286 func_ss = usb_get_function(func_inst_ss); 286 func_ss = usb_get_function(func_inst_ss);
287 if (IS_ERR(func_ss)) 287 if (IS_ERR(func_ss)) {
288 status = PTR_ERR(func_ss);
288 goto err_put_func_inst_ss; 289 goto err_put_func_inst_ss;
290 }
289 291
290 func_inst_lb = usb_get_function_instance("Loopback"); 292 func_inst_lb = usb_get_function_instance("Loopback");
291 if (IS_ERR(func_inst_lb)) 293 if (IS_ERR(func_inst_lb)) {
294 status = PTR_ERR(func_inst_lb);
292 goto err_put_func_ss; 295 goto err_put_func_ss;
296 }
293 297
294 lb_opts = container_of(func_inst_lb, struct f_lb_opts, func_inst); 298 lb_opts = container_of(func_inst_lb, struct f_lb_opts, func_inst);
295 lb_opts->bulk_buflen = gzero_options.bulk_buflen; 299 lb_opts->bulk_buflen = gzero_options.bulk_buflen;
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index de94f2699063..344d5e2f87d7 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -507,7 +507,7 @@ endif # USB_OHCI_HCD
507 507
508config USB_UHCI_HCD 508config USB_UHCI_HCD
509 tristate "UHCI HCD (most Intel and VIA) support" 509 tristate "UHCI HCD (most Intel and VIA) support"
510 depends on PCI || SPARC_LEON || ARCH_VT8500 510 depends on PCI || USB_UHCI_SUPPORT_NON_PCI_HC
511 ---help--- 511 ---help---
512 The Universal Host Controller Interface is a standard by Intel for 512 The Universal Host Controller Interface is a standard by Intel for
513 accessing the USB hardware in the PC (which is also called the USB 513 accessing the USB hardware in the PC (which is also called the USB
@@ -524,26 +524,19 @@ config USB_UHCI_HCD
524 524
525config USB_UHCI_SUPPORT_NON_PCI_HC 525config USB_UHCI_SUPPORT_NON_PCI_HC
526 bool 526 bool
527 depends on USB_UHCI_HCD 527 default y if (SPARC_LEON || USB_UHCI_PLATFORM)
528 default y if (SPARC_LEON || ARCH_VT8500)
529 528
530config USB_UHCI_PLATFORM 529config USB_UHCI_PLATFORM
531 bool "Generic UHCI Platform Driver support" 530 bool
532 depends on USB_UHCI_SUPPORT_NON_PCI_HC
533 default y if ARCH_VT8500 531 default y if ARCH_VT8500
534 ---help---
535 Enable support for generic UHCI platform devices that require no
536 additional configuration.
537 532
538config USB_UHCI_BIG_ENDIAN_MMIO 533config USB_UHCI_BIG_ENDIAN_MMIO
539 bool 534 bool
540 depends on USB_UHCI_SUPPORT_NON_PCI_HC && SPARC_LEON 535 default y if SPARC_LEON
541 default y
542 536
543config USB_UHCI_BIG_ENDIAN_DESC 537config USB_UHCI_BIG_ENDIAN_DESC
544 bool 538 bool
545 depends on USB_UHCI_SUPPORT_NON_PCI_HC && SPARC_LEON 539 default y if SPARC_LEON
546 default y
547 540
548config USB_FHCI_HCD 541config USB_FHCI_HCD
549 tristate "Freescale QE USB Host Controller support" 542 tristate "Freescale QE USB Host Controller support"
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index 66420097c242..02f4611faa62 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -63,8 +63,6 @@ static void atmel_stop_ehci(struct platform_device *pdev)
63 63
64/*-------------------------------------------------------------------------*/ 64/*-------------------------------------------------------------------------*/
65 65
66static u64 at91_ehci_dma_mask = DMA_BIT_MASK(32);
67
68static int ehci_atmel_drv_probe(struct platform_device *pdev) 66static int ehci_atmel_drv_probe(struct platform_device *pdev)
69{ 67{
70 struct usb_hcd *hcd; 68 struct usb_hcd *hcd;
@@ -93,7 +91,9 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev)
93 * Once we have dma capability bindings this can go away. 91 * Once we have dma capability bindings this can go away.
94 */ 92 */
95 if (!pdev->dev.dma_mask) 93 if (!pdev->dev.dma_mask)
96 pdev->dev.dma_mask = &at91_ehci_dma_mask; 94 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
95 if (!pdev->dev.coherent_dma_mask)
96 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
97 97
98 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); 98 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
99 if (!hcd) { 99 if (!hcd) {
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 312fc10da3c7..246e124e6ac5 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1286,23 +1286,6 @@ MODULE_LICENSE ("GPL");
1286#define PLATFORM_DRIVER ehci_hcd_sead3_driver 1286#define PLATFORM_DRIVER ehci_hcd_sead3_driver
1287#endif 1287#endif
1288 1288
1289#if !IS_ENABLED(CONFIG_USB_EHCI_PCI) && \
1290 !IS_ENABLED(CONFIG_USB_EHCI_HCD_PLATFORM) && \
1291 !IS_ENABLED(CONFIG_USB_CHIPIDEA_HOST) && \
1292 !IS_ENABLED(CONFIG_USB_EHCI_MXC) && \
1293 !IS_ENABLED(CONFIG_USB_EHCI_HCD_OMAP) && \
1294 !IS_ENABLED(CONFIG_USB_EHCI_HCD_ORION) && \
1295 !IS_ENABLED(CONFIG_USB_EHCI_HCD_SPEAR) && \
1296 !IS_ENABLED(CONFIG_USB_EHCI_S5P) && \
1297 !IS_ENABLED(CONFIG_USB_EHCI_HCD_AT91) && \
1298 !IS_ENABLED(CONFIG_USB_EHCI_MSM) && \
1299 !defined(PLATFORM_DRIVER) && \
1300 !defined(PS3_SYSTEM_BUS_DRIVER) && \
1301 !defined(OF_PLATFORM_DRIVER) && \
1302 !defined(XILINX_OF_PLATFORM_DRIVER)
1303#error "missing bus glue for ehci-hcd"
1304#endif
1305
1306static int __init ehci_hcd_init(void) 1289static int __init ehci_hcd_init(void)
1307{ 1290{
1308 int retval = 0; 1291 int retval = 0;
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 3d1491b5f360..16d7150e8557 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -90,8 +90,6 @@ static const struct ehci_driver_overrides ehci_omap_overrides __initdata = {
90 .extra_priv_size = sizeof(struct omap_hcd), 90 .extra_priv_size = sizeof(struct omap_hcd),
91}; 91};
92 92
93static u64 omap_ehci_dma_mask = DMA_BIT_MASK(32);
94
95/** 93/**
96 * ehci_hcd_omap_probe - initialize TI-based HCDs 94 * ehci_hcd_omap_probe - initialize TI-based HCDs
97 * 95 *
@@ -146,8 +144,10 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
146 * Since shared usb code relies on it, set it here for now. 144 * Since shared usb code relies on it, set it here for now.
147 * Once we have dma capability bindings this can go away. 145 * Once we have dma capability bindings this can go away.
148 */ 146 */
149 if (!pdev->dev.dma_mask) 147 if (!dev->dma_mask)
150 pdev->dev.dma_mask = &omap_ehci_dma_mask; 148 dev->dma_mask = &dev->coherent_dma_mask;
149 if (!dev->coherent_dma_mask)
150 dev->coherent_dma_mask = DMA_BIT_MASK(32);
151 151
152 hcd = usb_create_hcd(&ehci_omap_hc_driver, dev, 152 hcd = usb_create_hcd(&ehci_omap_hc_driver, dev,
153 dev_name(dev)); 153 dev_name(dev));
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index 54c579485150..efbc588b48c5 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -137,8 +137,6 @@ ehci_orion_conf_mbus_windows(struct usb_hcd *hcd,
137 } 137 }
138} 138}
139 139
140static u64 ehci_orion_dma_mask = DMA_BIT_MASK(32);
141
142static int ehci_orion_drv_probe(struct platform_device *pdev) 140static int ehci_orion_drv_probe(struct platform_device *pdev)
143{ 141{
144 struct orion_ehci_data *pd = pdev->dev.platform_data; 142 struct orion_ehci_data *pd = pdev->dev.platform_data;
@@ -183,7 +181,9 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)
183 * now. Once we have dma capability bindings this can go away. 181 * now. Once we have dma capability bindings this can go away.
184 */ 182 */
185 if (!pdev->dev.dma_mask) 183 if (!pdev->dev.dma_mask)
186 pdev->dev.dma_mask = &ehci_orion_dma_mask; 184 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
185 if (!pdev->dev.coherent_dma_mask)
186 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
187 187
188 if (!request_mem_region(res->start, resource_size(res), 188 if (!request_mem_region(res->start, resource_size(res),
189 ehci_orion_hc_driver.description)) { 189 ehci_orion_hc_driver.description)) {
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 635775278c7f..379037f51a2f 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -71,8 +71,6 @@ static void s5p_setup_vbus_gpio(struct platform_device *pdev)
71 dev_err(dev, "can't request ehci vbus gpio %d", gpio); 71 dev_err(dev, "can't request ehci vbus gpio %d", gpio);
72} 72}
73 73
74static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32);
75
76static int s5p_ehci_probe(struct platform_device *pdev) 74static int s5p_ehci_probe(struct platform_device *pdev)
77{ 75{
78 struct s5p_ehci_platdata *pdata = pdev->dev.platform_data; 76 struct s5p_ehci_platdata *pdata = pdev->dev.platform_data;
@@ -90,7 +88,7 @@ static int s5p_ehci_probe(struct platform_device *pdev)
90 * Once we move to full device tree support this will vanish off. 88 * Once we move to full device tree support this will vanish off.
91 */ 89 */
92 if (!pdev->dev.dma_mask) 90 if (!pdev->dev.dma_mask)
93 pdev->dev.dma_mask = &ehci_s5p_dma_mask; 91 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
94 if (!pdev->dev.coherent_dma_mask) 92 if (!pdev->dev.coherent_dma_mask)
95 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 93 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
96 94
@@ -107,6 +105,7 @@ static int s5p_ehci_probe(struct platform_device *pdev)
107 if (IS_ERR(phy)) { 105 if (IS_ERR(phy)) {
108 /* Fallback to pdata */ 106 /* Fallback to pdata */
109 if (!pdata) { 107 if (!pdata) {
108 usb_put_hcd(hcd);
110 dev_warn(&pdev->dev, "no platform data or transceiver defined\n"); 109 dev_warn(&pdev->dev, "no platform data or transceiver defined\n");
111 return -EPROBE_DEFER; 110 return -EPROBE_DEFER;
112 } else { 111 } else {
diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c
index 61ecfb3d52f5..bd3e5cbc6240 100644
--- a/drivers/usb/host/ehci-spear.c
+++ b/drivers/usb/host/ehci-spear.c
@@ -58,8 +58,6 @@ static int ehci_spear_drv_resume(struct device *dev)
58static SIMPLE_DEV_PM_OPS(ehci_spear_pm_ops, ehci_spear_drv_suspend, 58static SIMPLE_DEV_PM_OPS(ehci_spear_pm_ops, ehci_spear_drv_suspend,
59 ehci_spear_drv_resume); 59 ehci_spear_drv_resume);
60 60
61static u64 spear_ehci_dma_mask = DMA_BIT_MASK(32);
62
63static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) 61static int spear_ehci_hcd_drv_probe(struct platform_device *pdev)
64{ 62{
65 struct usb_hcd *hcd ; 63 struct usb_hcd *hcd ;
@@ -84,7 +82,9 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev)
84 * Once we have dma capability bindings this can go away. 82 * Once we have dma capability bindings this can go away.
85 */ 83 */
86 if (!pdev->dev.dma_mask) 84 if (!pdev->dev.dma_mask)
87 pdev->dev.dma_mask = &spear_ehci_dma_mask; 85 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
86 if (!pdev->dev.coherent_dma_mask)
87 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
88 88
89 usbh_clk = devm_clk_get(&pdev->dev, NULL); 89 usbh_clk = devm_clk_get(&pdev->dev, NULL);
90 if (IS_ERR(usbh_clk)) { 90 if (IS_ERR(usbh_clk)) {
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index e3eddc31ac83..59d111bf44a9 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -637,8 +637,6 @@ static void tegra_ehci_set_phcd(struct usb_phy *x, bool enable)
637 writel(val, base + TEGRA_USB_PORTSC1); 637 writel(val, base + TEGRA_USB_PORTSC1);
638} 638}
639 639
640static u64 tegra_ehci_dma_mask = DMA_BIT_MASK(32);
641
642static int tegra_ehci_probe(struct platform_device *pdev) 640static int tegra_ehci_probe(struct platform_device *pdev)
643{ 641{
644 struct resource *res; 642 struct resource *res;
@@ -661,7 +659,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
661 * Once we have dma capability bindings this can go away. 659 * Once we have dma capability bindings this can go away.
662 */ 660 */
663 if (!pdev->dev.dma_mask) 661 if (!pdev->dev.dma_mask)
664 pdev->dev.dma_mask = &tegra_ehci_dma_mask; 662 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
663 if (!pdev->dev.coherent_dma_mask)
664 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
665 665
666 setup_vbus_gpio(pdev, pdata); 666 setup_vbus_gpio(pdev, pdata);
667 667
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index 125e261f5bfc..2facee53eab1 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -1739,7 +1739,7 @@ static int isp1760_hub_status_data(struct usb_hcd *hcd, char *buf)
1739 int retval = 1; 1739 int retval = 1;
1740 unsigned long flags; 1740 unsigned long flags;
1741 1741
1742 /* if !USB_SUSPEND, root hub timers won't get shut down ... */ 1742 /* if !PM_RUNTIME, root hub timers won't get shut down ... */
1743 if (!HC_IS_RUNNING(hcd->state)) 1743 if (!HC_IS_RUNNING(hcd->state))
1744 return 0; 1744 return 0;
1745 1745
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
index bbb791bd7617..a13709ee4e5d 100644
--- a/drivers/usb/host/isp1760-if.c
+++ b/drivers/usb/host/isp1760-if.c
@@ -373,8 +373,10 @@ static int isp1760_plat_probe(struct platform_device *pdev)
373 irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 373 irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
374 if (!irq_res) { 374 if (!irq_res) {
375 pr_warning("isp1760: IRQ resource not available\n"); 375 pr_warning("isp1760: IRQ resource not available\n");
376 return -ENODEV; 376 ret = -ENODEV;
377 goto cleanup;
377 } 378 }
379
378 irqflags |= irq_res->flags & IRQF_TRIGGER_MASK; 380 irqflags |= irq_res->flags & IRQF_TRIGGER_MASK;
379 381
380 if (priv) { 382 if (priv) {
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index a0cb44f0e724..2ee1496dbc1d 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -504,8 +504,6 @@ static const struct of_device_id at91_ohci_dt_ids[] = {
504 504
505MODULE_DEVICE_TABLE(of, at91_ohci_dt_ids); 505MODULE_DEVICE_TABLE(of, at91_ohci_dt_ids);
506 506
507static u64 at91_ohci_dma_mask = DMA_BIT_MASK(32);
508
509static int ohci_at91_of_init(struct platform_device *pdev) 507static int ohci_at91_of_init(struct platform_device *pdev)
510{ 508{
511 struct device_node *np = pdev->dev.of_node; 509 struct device_node *np = pdev->dev.of_node;
@@ -522,7 +520,9 @@ static int ohci_at91_of_init(struct platform_device *pdev)
522 * Once we have dma capability bindings this can go away. 520 * Once we have dma capability bindings this can go away.
523 */ 521 */
524 if (!pdev->dev.dma_mask) 522 if (!pdev->dev.dma_mask)
525 pdev->dev.dma_mask = &at91_ohci_dma_mask; 523 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
524 if (!pdev->dev.coherent_dma_mask)
525 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
526 526
527 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 527 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
528 if (!pdata) 528 if (!pdata)
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index 07592c00af26..b0b542c14e31 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -98,8 +98,6 @@ static const struct hc_driver exynos_ohci_hc_driver = {
98 .start_port_reset = ohci_start_port_reset, 98 .start_port_reset = ohci_start_port_reset,
99}; 99};
100 100
101static u64 ohci_exynos_dma_mask = DMA_BIT_MASK(32);
102
103static int exynos_ohci_probe(struct platform_device *pdev) 101static int exynos_ohci_probe(struct platform_device *pdev)
104{ 102{
105 struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data; 103 struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data;
@@ -117,7 +115,7 @@ static int exynos_ohci_probe(struct platform_device *pdev)
117 * Once we move to full device tree support this will vanish off. 115 * Once we move to full device tree support this will vanish off.
118 */ 116 */
119 if (!pdev->dev.dma_mask) 117 if (!pdev->dev.dma_mask)
120 pdev->dev.dma_mask = &ohci_exynos_dma_mask; 118 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
121 if (!pdev->dev.coherent_dma_mask) 119 if (!pdev->dev.coherent_dma_mask)
122 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 120 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
123 121
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 9e6de9586ae4..fc627fd54116 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -233,14 +233,14 @@ static int ohci_urb_enqueue (
233 urb->start_frame = frame; 233 urb->start_frame = frame;
234 } 234 }
235 } else if (ed->type == PIPE_ISOCHRONOUS) { 235 } else if (ed->type == PIPE_ISOCHRONOUS) {
236 u16 next = ohci_frame_no(ohci) + 2; 236 u16 next = ohci_frame_no(ohci) + 1;
237 u16 frame = ed->last_iso + ed->interval; 237 u16 frame = ed->last_iso + ed->interval;
238 238
239 /* Behind the scheduling threshold? */ 239 /* Behind the scheduling threshold? */
240 if (unlikely(tick_before(frame, next))) { 240 if (unlikely(tick_before(frame, next))) {
241 241
242 /* USB_ISO_ASAP: Round up to the first available slot */ 242 /* USB_ISO_ASAP: Round up to the first available slot */
243 if (urb->transfer_flags & URB_ISO_ASAP) 243 if (urb->transfer_flags & URB_ISO_ASAP) {
244 frame += (next - frame + ed->interval - 1) & 244 frame += (next - frame + ed->interval - 1) &
245 -ed->interval; 245 -ed->interval;
246 246
@@ -248,21 +248,25 @@ static int ohci_urb_enqueue (
248 * Not ASAP: Use the next slot in the stream. If 248 * Not ASAP: Use the next slot in the stream. If
249 * the entire URB falls before the threshold, fail. 249 * the entire URB falls before the threshold, fail.
250 */ 250 */
251 else if (tick_before(frame + ed->interval * 251 } else {
252 if (tick_before(frame + ed->interval *
252 (urb->number_of_packets - 1), next)) { 253 (urb->number_of_packets - 1), next)) {
253 retval = -EXDEV; 254 retval = -EXDEV;
254 usb_hcd_unlink_urb_from_ep(hcd, urb); 255 usb_hcd_unlink_urb_from_ep(hcd, urb);
255 goto fail; 256 goto fail;
256 } 257 }
257 258
258 /* 259 /*
259 * Some OHCI hardware doesn't handle late TDs 260 * Some OHCI hardware doesn't handle late TDs
260 * correctly. After retiring them it proceeds to 261 * correctly. After retiring them it proceeds
261 * the next ED instead of the next TD. Therefore 262 * to the next ED instead of the next TD.
262 * we have to omit the late TDs entirely. 263 * Therefore we have to omit the late TDs
263 */ 264 * entirely.
264 urb_priv->td_cnt = DIV_ROUND_UP(next - frame, 265 */
265 ed->interval); 266 urb_priv->td_cnt = DIV_ROUND_UP(
267 (u16) (next - frame),
268 ed->interval);
269 }
266 } 270 }
267 urb->start_frame = frame; 271 urb->start_frame = frame;
268 } 272 }
diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
index f303cb04c2dd..5d7eb72c5064 100644
--- a/drivers/usb/host/ohci-nxp.c
+++ b/drivers/usb/host/ohci-nxp.c
@@ -223,8 +223,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
223 223
224 isp1301_i2c_client = isp1301_get_client(isp1301_node); 224 isp1301_i2c_client = isp1301_get_client(isp1301_node);
225 if (!isp1301_i2c_client) { 225 if (!isp1301_i2c_client) {
226 ret = -EPROBE_DEFER; 226 return -EPROBE_DEFER;
227 goto out;
228 } 227 }
229 228
230 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 229 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
@@ -234,7 +233,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
234 if (usb_disabled()) { 233 if (usb_disabled()) {
235 dev_err(&pdev->dev, "USB is disabled\n"); 234 dev_err(&pdev->dev, "USB is disabled\n");
236 ret = -ENODEV; 235 ret = -ENODEV;
237 goto out; 236 goto fail_disable;
238 } 237 }
239 238
240 /* Enable AHB slave USB clock, needed for further USB clock control */ 239 /* Enable AHB slave USB clock, needed for further USB clock control */
@@ -245,19 +244,19 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
245 if (IS_ERR(usb_pll_clk)) { 244 if (IS_ERR(usb_pll_clk)) {
246 dev_err(&pdev->dev, "failed to acquire USB PLL\n"); 245 dev_err(&pdev->dev, "failed to acquire USB PLL\n");
247 ret = PTR_ERR(usb_pll_clk); 246 ret = PTR_ERR(usb_pll_clk);
248 goto out1; 247 goto fail_pll;
249 } 248 }
250 249
251 ret = clk_enable(usb_pll_clk); 250 ret = clk_enable(usb_pll_clk);
252 if (ret < 0) { 251 if (ret < 0) {
253 dev_err(&pdev->dev, "failed to start USB PLL\n"); 252 dev_err(&pdev->dev, "failed to start USB PLL\n");
254 goto out2; 253 goto fail_pllen;
255 } 254 }
256 255
257 ret = clk_set_rate(usb_pll_clk, 48000); 256 ret = clk_set_rate(usb_pll_clk, 48000);
258 if (ret < 0) { 257 if (ret < 0) {
259 dev_err(&pdev->dev, "failed to set USB clock rate\n"); 258 dev_err(&pdev->dev, "failed to set USB clock rate\n");
260 goto out3; 259 goto fail_rate;
261 } 260 }
262 261
263 /* Enable USB device clock */ 262 /* Enable USB device clock */
@@ -265,13 +264,13 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
265 if (IS_ERR(usb_dev_clk)) { 264 if (IS_ERR(usb_dev_clk)) {
266 dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n"); 265 dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n");
267 ret = PTR_ERR(usb_dev_clk); 266 ret = PTR_ERR(usb_dev_clk);
268 goto out4; 267 goto fail_dev;
269 } 268 }
270 269
271 ret = clk_enable(usb_dev_clk); 270 ret = clk_enable(usb_dev_clk);
272 if (ret < 0) { 271 if (ret < 0) {
273 dev_err(&pdev->dev, "failed to start USB DEV Clock\n"); 272 dev_err(&pdev->dev, "failed to start USB DEV Clock\n");
274 goto out5; 273 goto fail_deven;
275 } 274 }
276 275
277 /* Enable USB otg clocks */ 276 /* Enable USB otg clocks */
@@ -279,7 +278,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
279 if (IS_ERR(usb_otg_clk)) { 278 if (IS_ERR(usb_otg_clk)) {
280 dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n"); 279 dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n");
281 ret = PTR_ERR(usb_otg_clk); 280 ret = PTR_ERR(usb_otg_clk);
282 goto out6; 281 goto fail_otg;
283 } 282 }
284 283
285 __raw_writel(__raw_readl(USB_CTRL) | USB_HOST_NEED_CLK_EN, USB_CTRL); 284 __raw_writel(__raw_readl(USB_CTRL) | USB_HOST_NEED_CLK_EN, USB_CTRL);
@@ -287,7 +286,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
287 ret = clk_enable(usb_otg_clk); 286 ret = clk_enable(usb_otg_clk);
288 if (ret < 0) { 287 if (ret < 0) {
289 dev_err(&pdev->dev, "failed to start USB DEV Clock\n"); 288 dev_err(&pdev->dev, "failed to start USB DEV Clock\n");
290 goto out7; 289 goto fail_otgen;
291 } 290 }
292 291
293 isp1301_configure(); 292 isp1301_configure();
@@ -296,14 +295,14 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
296 if (!hcd) { 295 if (!hcd) {
297 dev_err(&pdev->dev, "Failed to allocate HC buffer\n"); 296 dev_err(&pdev->dev, "Failed to allocate HC buffer\n");
298 ret = -ENOMEM; 297 ret = -ENOMEM;
299 goto out8; 298 goto fail_hcd;
300 } 299 }
301 300
302 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 301 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
303 hcd->regs = devm_ioremap_resource(&pdev->dev, res); 302 hcd->regs = devm_ioremap_resource(&pdev->dev, res);
304 if (IS_ERR(hcd->regs)) { 303 if (IS_ERR(hcd->regs)) {
305 ret = PTR_ERR(hcd->regs); 304 ret = PTR_ERR(hcd->regs);
306 goto out8; 305 goto fail_resource;
307 } 306 }
308 hcd->rsrc_start = res->start; 307 hcd->rsrc_start = res->start;
309 hcd->rsrc_len = resource_size(res); 308 hcd->rsrc_len = resource_size(res);
@@ -311,7 +310,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
311 irq = platform_get_irq(pdev, 0); 310 irq = platform_get_irq(pdev, 0);
312 if (irq < 0) { 311 if (irq < 0) {
313 ret = -ENXIO; 312 ret = -ENXIO;
314 goto out8; 313 goto fail_resource;
315 } 314 }
316 315
317 nxp_start_hc(); 316 nxp_start_hc();
@@ -325,23 +324,24 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
325 return ret; 324 return ret;
326 325
327 nxp_stop_hc(); 326 nxp_stop_hc();
328out8: 327fail_resource:
329 usb_put_hcd(hcd); 328 usb_put_hcd(hcd);
330out7: 329fail_hcd:
331 clk_disable(usb_otg_clk); 330 clk_disable(usb_otg_clk);
332out6: 331fail_otgen:
333 clk_put(usb_otg_clk); 332 clk_put(usb_otg_clk);
334out5: 333fail_otg:
335 clk_disable(usb_dev_clk); 334 clk_disable(usb_dev_clk);
336out4: 335fail_deven:
337 clk_put(usb_dev_clk); 336 clk_put(usb_dev_clk);
338out3: 337fail_dev:
338fail_rate:
339 clk_disable(usb_pll_clk); 339 clk_disable(usb_pll_clk);
340out2: 340fail_pllen:
341 clk_put(usb_pll_clk); 341 clk_put(usb_pll_clk);
342out1: 342fail_pll:
343fail_disable:
343 isp1301_i2c_client = NULL; 344 isp1301_i2c_client = NULL;
344out:
345 return ret; 345 return ret;
346} 346}
347 347
diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c
index ddfc31427bc0..8663851c8d8e 100644
--- a/drivers/usb/host/ohci-omap3.c
+++ b/drivers/usb/host/ohci-omap3.c
@@ -114,8 +114,6 @@ static const struct hc_driver ohci_omap3_hc_driver = {
114 114
115/*-------------------------------------------------------------------------*/ 115/*-------------------------------------------------------------------------*/
116 116
117static u64 omap_ohci_dma_mask = DMA_BIT_MASK(32);
118
119/* 117/*
120 * configure so an HC device and id are always provided 118 * configure so an HC device and id are always provided
121 * always called with process context; sleeping is OK 119 * always called with process context; sleeping is OK
@@ -168,8 +166,10 @@ static int ohci_hcd_omap3_probe(struct platform_device *pdev)
168 * Since shared usb code relies on it, set it here for now. 166 * Since shared usb code relies on it, set it here for now.
169 * Once we have dma capability bindings this can go away. 167 * Once we have dma capability bindings this can go away.
170 */ 168 */
171 if (!pdev->dev.dma_mask) 169 if (!dev->dma_mask)
172 pdev->dev.dma_mask = &omap_ohci_dma_mask; 170 dev->dma_mask = &dev->coherent_dma_mask;
171 if (!dev->coherent_dma_mask)
172 dev->coherent_dma_mask = DMA_BIT_MASK(32);
173 173
174 hcd = usb_create_hcd(&ohci_omap3_hc_driver, dev, 174 hcd = usb_create_hcd(&ohci_omap3_hc_driver, dev,
175 dev_name(dev)); 175 dev_name(dev));
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index efe71f3ca477..279b2ef17411 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -282,8 +282,6 @@ static const struct of_device_id pxa_ohci_dt_ids[] = {
282 282
283MODULE_DEVICE_TABLE(of, pxa_ohci_dt_ids); 283MODULE_DEVICE_TABLE(of, pxa_ohci_dt_ids);
284 284
285static u64 pxa_ohci_dma_mask = DMA_BIT_MASK(32);
286
287static int ohci_pxa_of_init(struct platform_device *pdev) 285static int ohci_pxa_of_init(struct platform_device *pdev)
288{ 286{
289 struct device_node *np = pdev->dev.of_node; 287 struct device_node *np = pdev->dev.of_node;
@@ -298,7 +296,9 @@ static int ohci_pxa_of_init(struct platform_device *pdev)
298 * Once we have dma capability bindings this can go away. 296 * Once we have dma capability bindings this can go away.
299 */ 297 */
300 if (!pdev->dev.dma_mask) 298 if (!pdev->dev.dma_mask)
301 pdev->dev.dma_mask = &pxa_ohci_dma_mask; 299 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
300 if (!pdev->dev.coherent_dma_mask)
301 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
302 302
303 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 303 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
304 if (!pdata) 304 if (!pdata)
diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
index 9020bf0e2eca..3e19e0170d11 100644
--- a/drivers/usb/host/ohci-spear.c
+++ b/drivers/usb/host/ohci-spear.c
@@ -91,8 +91,6 @@ static const struct hc_driver ohci_spear_hc_driver = {
91 .start_port_reset = ohci_start_port_reset, 91 .start_port_reset = ohci_start_port_reset,
92}; 92};
93 93
94static u64 spear_ohci_dma_mask = DMA_BIT_MASK(32);
95
96static int spear_ohci_hcd_drv_probe(struct platform_device *pdev) 94static int spear_ohci_hcd_drv_probe(struct platform_device *pdev)
97{ 95{
98 const struct hc_driver *driver = &ohci_spear_hc_driver; 96 const struct hc_driver *driver = &ohci_spear_hc_driver;
@@ -114,7 +112,9 @@ static int spear_ohci_hcd_drv_probe(struct platform_device *pdev)
114 * Once we have dma capability bindings this can go away. 112 * Once we have dma capability bindings this can go away.
115 */ 113 */
116 if (!pdev->dev.dma_mask) 114 if (!pdev->dev.dma_mask)
117 pdev->dev.dma_mask = &spear_ohci_dma_mask; 115 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
116 if (!pdev->dev.coherent_dma_mask)
117 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
118 118
119 usbh_clk = devm_clk_get(&pdev->dev, NULL); 119 usbh_clk = devm_clk_get(&pdev->dev, NULL);
120 if (IS_ERR(usbh_clk)) { 120 if (IS_ERR(usbh_clk)) {
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
index 4f0f0339532f..0f401dbfaf07 100644
--- a/drivers/usb/host/oxu210hp-hcd.c
+++ b/drivers/usb/host/oxu210hp-hcd.c
@@ -3084,7 +3084,7 @@ static int oxu_hub_status_data(struct usb_hcd *hcd, char *buf)
3084 int ports, i, retval = 1; 3084 int ports, i, retval = 1;
3085 unsigned long flags; 3085 unsigned long flags;
3086 3086
3087 /* if !USB_SUSPEND, root hub timers won't get shut down ... */ 3087 /* if !PM_RUNTIME, root hub timers won't get shut down ... */
3088 if (!HC_IS_RUNNING(hcd->state)) 3088 if (!HC_IS_RUNNING(hcd->state))
3089 return 0; 3089 return 0;
3090 3090
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index ad4483efb6d6..b2ec7fe758dd 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -22,7 +22,7 @@
22 * and usb-storage. 22 * and usb-storage.
23 * 23 *
24 * TODO: 24 * TODO:
25 * - usb suspend/resume triggered by sl811 (with USB_SUSPEND) 25 * - usb suspend/resume triggered by sl811 (with PM_RUNTIME)
26 * - various issues noted in the code 26 * - various issues noted in the code
27 * - performance work; use both register banks; ... 27 * - performance work; use both register banks; ...
28 * - use urb->iso_frame_desc[] with ISO transfers 28 * - use urb->iso_frame_desc[] with ISO transfers
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c
index f87bee6d2789..9189bc984c98 100644
--- a/drivers/usb/host/uhci-hub.c
+++ b/drivers/usb/host/uhci-hub.c
@@ -225,7 +225,8 @@ static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf)
225 /* auto-stop if nothing connected for 1 second */ 225 /* auto-stop if nothing connected for 1 second */
226 if (any_ports_active(uhci)) 226 if (any_ports_active(uhci))
227 uhci->rh_state = UHCI_RH_RUNNING; 227 uhci->rh_state = UHCI_RH_RUNNING;
228 else if (time_after_eq(jiffies, uhci->auto_stop_time)) 228 else if (time_after_eq(jiffies, uhci->auto_stop_time) &&
229 !uhci->wait_for_hp)
229 suspend_rh(uhci, UHCI_RH_AUTO_STOPPED); 230 suspend_rh(uhci, UHCI_RH_AUTO_STOPPED);
230 break; 231 break;
231 232
diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c
index 8c4dace4b14a..f1db61ada6a8 100644
--- a/drivers/usb/host/uhci-platform.c
+++ b/drivers/usb/host/uhci-platform.c
@@ -60,8 +60,6 @@ static const struct hc_driver uhci_platform_hc_driver = {
60 .hub_control = uhci_hub_control, 60 .hub_control = uhci_hub_control,
61}; 61};
62 62
63static u64 platform_uhci_dma_mask = DMA_BIT_MASK(32);
64
65static int uhci_hcd_platform_probe(struct platform_device *pdev) 63static int uhci_hcd_platform_probe(struct platform_device *pdev)
66{ 64{
67 struct usb_hcd *hcd; 65 struct usb_hcd *hcd;
@@ -78,7 +76,9 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev)
78 * Once we have dma capability bindings this can go away. 76 * Once we have dma capability bindings this can go away.
79 */ 77 */
80 if (!pdev->dev.dma_mask) 78 if (!pdev->dev.dma_mask)
81 pdev->dev.dma_mask = &platform_uhci_dma_mask; 79 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
80 if (!pdev->dev.coherent_dma_mask)
81 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
82 82
83 hcd = usb_create_hcd(&uhci_platform_hc_driver, &pdev->dev, 83 hcd = usb_create_hcd(&uhci_platform_hc_driver, &pdev->dev,
84 pdev->name); 84 pdev->name);
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index f0976d8190bc..041c6ddb695c 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -1287,7 +1287,7 @@ static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb,
1287 return -EINVAL; /* Can't change the period */ 1287 return -EINVAL; /* Can't change the period */
1288 1288
1289 } else { 1289 } else {
1290 next = uhci->frame_number + 2; 1290 next = uhci->frame_number + 1;
1291 1291
1292 /* Find the next unused frame */ 1292 /* Find the next unused frame */
1293 if (list_empty(&qh->queue)) { 1293 if (list_empty(&qh->queue)) {
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 965b539bc474..2cfc465925bd 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1423,15 +1423,17 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
1423 ep_ctx->ep_info2 |= cpu_to_le32(xhci_get_endpoint_type(udev, ep)); 1423 ep_ctx->ep_info2 |= cpu_to_le32(xhci_get_endpoint_type(udev, ep));
1424 1424
1425 /* Set the max packet size and max burst */ 1425 /* Set the max packet size and max burst */
1426 max_packet = GET_MAX_PACKET(usb_endpoint_maxp(&ep->desc));
1427 max_burst = 0;
1426 switch (udev->speed) { 1428 switch (udev->speed) {
1427 case USB_SPEED_SUPER: 1429 case USB_SPEED_SUPER:
1428 max_packet = usb_endpoint_maxp(&ep->desc);
1429 ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet));
1430 /* dig out max burst from ep companion desc */ 1430 /* dig out max burst from ep companion desc */
1431 max_packet = ep->ss_ep_comp.bMaxBurst; 1431 max_burst = ep->ss_ep_comp.bMaxBurst;
1432 ep_ctx->ep_info2 |= cpu_to_le32(MAX_BURST(max_packet));
1433 break; 1432 break;
1434 case USB_SPEED_HIGH: 1433 case USB_SPEED_HIGH:
1434 /* Some devices get this wrong */
1435 if (usb_endpoint_xfer_bulk(&ep->desc))
1436 max_packet = 512;
1435 /* bits 11:12 specify the number of additional transaction 1437 /* bits 11:12 specify the number of additional transaction
1436 * opportunities per microframe (USB 2.0, section 9.6.6) 1438 * opportunities per microframe (USB 2.0, section 9.6.6)
1437 */ 1439 */
@@ -1439,17 +1441,16 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
1439 usb_endpoint_xfer_int(&ep->desc)) { 1441 usb_endpoint_xfer_int(&ep->desc)) {
1440 max_burst = (usb_endpoint_maxp(&ep->desc) 1442 max_burst = (usb_endpoint_maxp(&ep->desc)
1441 & 0x1800) >> 11; 1443 & 0x1800) >> 11;
1442 ep_ctx->ep_info2 |= cpu_to_le32(MAX_BURST(max_burst));
1443 } 1444 }
1444 /* Fall through */ 1445 break;
1445 case USB_SPEED_FULL: 1446 case USB_SPEED_FULL:
1446 case USB_SPEED_LOW: 1447 case USB_SPEED_LOW:
1447 max_packet = GET_MAX_PACKET(usb_endpoint_maxp(&ep->desc));
1448 ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet));
1449 break; 1448 break;
1450 default: 1449 default:
1451 BUG(); 1450 BUG();
1452 } 1451 }
1452 ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet) |
1453 MAX_BURST(max_burst));
1453 max_esit_payload = xhci_get_max_esit_payload(xhci, udev, ep); 1454 max_esit_payload = xhci_get_max_esit_payload(xhci, udev, ep);
1454 ep_ctx->tx_info = cpu_to_le32(MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload)); 1455 ep_ctx->tx_info = cpu_to_le32(MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload));
1455 1456
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 3a18e44e9391..e1b661d04021 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -560,6 +560,7 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
560 if (!config) { 560 if (!config) {
561 dev_err(&pdev->dev, 561 dev_err(&pdev->dev,
562 "failed to allocate musb hdrc config\n"); 562 "failed to allocate musb hdrc config\n");
563 ret = -ENOMEM;
563 goto err2; 564 goto err2;
564 } 565 }
565 566
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 3551f1a30c65..628b93fe5ccc 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -549,7 +549,8 @@ static int omap2430_probe(struct platform_device *pdev)
549 glue->control_otghs = omap_get_control_dev(); 549 glue->control_otghs = omap_get_control_dev();
550 if (IS_ERR(glue->control_otghs)) { 550 if (IS_ERR(glue->control_otghs)) {
551 dev_vdbg(&pdev->dev, "Failed to get control device\n"); 551 dev_vdbg(&pdev->dev, "Failed to get control device\n");
552 return -ENODEV; 552 ret = PTR_ERR(glue->control_otghs);
553 goto err2;
553 } 554 }
554 } else { 555 } else {
555 glue->control_otghs = ERR_PTR(-ENODEV); 556 glue->control_otghs = ERR_PTR(-ENODEV);
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 371d0e74e909..7ef3eb8617a6 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -25,7 +25,7 @@ config AB8500_USB
25 25
26config FSL_USB2_OTG 26config FSL_USB2_OTG
27 bool "Freescale USB OTG Transceiver Driver" 27 bool "Freescale USB OTG Transceiver Driver"
28 depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_SUSPEND 28 depends on USB_EHCI_FSL && USB_FSL_USB2 && PM_RUNTIME
29 select USB_OTG 29 select USB_OTG
30 help 30 help
31 Enable this to support Freescale USB OTG transceiver. 31 Enable this to support Freescale USB OTG transceiver.
@@ -139,7 +139,6 @@ config USB_ISP1301
139 tristate "NXP ISP1301 USB transceiver support" 139 tristate "NXP ISP1301 USB transceiver support"
140 depends on USB || USB_GADGET 140 depends on USB || USB_GADGET
141 depends on I2C 141 depends on I2C
142 select USB_OTG_UTILS
143 help 142 help
144 Say Y here to add support for the NXP ISP1301 USB transceiver driver. 143 Say Y here to add support for the NXP ISP1301 USB transceiver driver.
145 This chip is typically used as USB transceiver for USB host, gadget 144 This chip is typically used as USB transceiver for USB host, gadget
@@ -162,7 +161,7 @@ config USB_MSM_OTG
162 161
163config USB_MV_OTG 162config USB_MV_OTG
164 tristate "Marvell USB OTG support" 163 tristate "Marvell USB OTG support"
165 depends on USB_EHCI_MV && USB_MV_UDC && USB_SUSPEND 164 depends on USB_EHCI_MV && USB_MV_UDC && PM_RUNTIME
166 select USB_OTG 165 select USB_OTG
167 help 166 help
168 Say Y here if you want to build Marvell USB OTG transciever 167 Say Y here if you want to build Marvell USB OTG transciever
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
index 4acef26a2ef5..e5eb1b5a04eb 100644
--- a/drivers/usb/phy/phy-ab8500-usb.c
+++ b/drivers/usb/phy/phy-ab8500-usb.c
@@ -892,8 +892,6 @@ static int ab8500_usb_remove(struct platform_device *pdev)
892 else if (ab->mode == USB_PERIPHERAL) 892 else if (ab->mode == USB_PERIPHERAL)
893 ab8500_usb_peri_phy_dis(ab); 893 ab8500_usb_peri_phy_dis(ab);
894 894
895 platform_set_drvdata(pdev, NULL);
896
897 return 0; 895 return 0;
898} 896}
899 897
diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
index 97b9308507c3..e771bafb9f1d 100644
--- a/drivers/usb/phy/phy-fsl-usb.c
+++ b/drivers/usb/phy/phy-fsl-usb.c
@@ -799,6 +799,7 @@ static int fsl_otg_conf(struct platform_device *pdev)
799 799
800 /* initialize the otg structure */ 800 /* initialize the otg structure */
801 fsl_otg_tc->phy.label = DRIVER_DESC; 801 fsl_otg_tc->phy.label = DRIVER_DESC;
802 fsl_otg_tc->phy.dev = &pdev->dev;
802 fsl_otg_tc->phy.set_power = fsl_otg_set_power; 803 fsl_otg_tc->phy.set_power = fsl_otg_set_power;
803 804
804 fsl_otg_tc->phy.otg->phy = &fsl_otg_tc->phy; 805 fsl_otg_tc->phy.otg->phy = &fsl_otg_tc->phy;
diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c b/drivers/usb/phy/phy-gpio-vbus-usb.c
index 4c76074e518d..8443335c2ea0 100644
--- a/drivers/usb/phy/phy-gpio-vbus-usb.c
+++ b/drivers/usb/phy/phy-gpio-vbus-usb.c
@@ -266,6 +266,7 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)
266 platform_set_drvdata(pdev, gpio_vbus); 266 platform_set_drvdata(pdev, gpio_vbus);
267 gpio_vbus->dev = &pdev->dev; 267 gpio_vbus->dev = &pdev->dev;
268 gpio_vbus->phy.label = "gpio-vbus"; 268 gpio_vbus->phy.label = "gpio-vbus";
269 gpio_vbus->phy.dev = gpio_vbus->dev;
269 gpio_vbus->phy.set_power = gpio_vbus_set_power; 270 gpio_vbus->phy.set_power = gpio_vbus_set_power;
270 gpio_vbus->phy.set_suspend = gpio_vbus_set_suspend; 271 gpio_vbus->phy.set_suspend = gpio_vbus_set_suspend;
271 gpio_vbus->phy.state = OTG_STATE_UNDEFINED; 272 gpio_vbus->phy.state = OTG_STATE_UNDEFINED;
@@ -343,7 +344,6 @@ err_irq:
343 gpio_free(pdata->gpio_pullup); 344 gpio_free(pdata->gpio_pullup);
344 gpio_free(pdata->gpio_vbus); 345 gpio_free(pdata->gpio_vbus);
345err_gpio: 346err_gpio:
346 platform_set_drvdata(pdev, NULL);
347 kfree(gpio_vbus->phy.otg); 347 kfree(gpio_vbus->phy.otg);
348 kfree(gpio_vbus); 348 kfree(gpio_vbus);
349 return err; 349 return err;
@@ -365,7 +365,6 @@ static int __exit gpio_vbus_remove(struct platform_device *pdev)
365 if (gpio_is_valid(pdata->gpio_pullup)) 365 if (gpio_is_valid(pdata->gpio_pullup))
366 gpio_free(pdata->gpio_pullup); 366 gpio_free(pdata->gpio_pullup);
367 gpio_free(gpio); 367 gpio_free(gpio);
368 platform_set_drvdata(pdev, NULL);
369 kfree(gpio_vbus->phy.otg); 368 kfree(gpio_vbus->phy.otg);
370 kfree(gpio_vbus); 369 kfree(gpio_vbus);
371 370
diff --git a/drivers/usb/phy/phy-isp1301.c b/drivers/usb/phy/phy-isp1301.c
index 225ae6c97eeb..8a55b37d1a02 100644
--- a/drivers/usb/phy/phy-isp1301.c
+++ b/drivers/usb/phy/phy-isp1301.c
@@ -102,6 +102,7 @@ static int isp1301_probe(struct i2c_client *client,
102 mutex_init(&isp->mutex); 102 mutex_init(&isp->mutex);
103 103
104 phy = &isp->phy; 104 phy = &isp->phy;
105 phy->dev = &client->dev;
105 phy->label = DRV_NAME; 106 phy->label = DRV_NAME;
106 phy->init = isp1301_phy_init; 107 phy->init = isp1301_phy_init;
107 phy->set_vbus = isp1301_phy_set_vbus; 108 phy->set_vbus = isp1301_phy_set_vbus;
diff --git a/drivers/usb/phy/phy-mv-usb.c b/drivers/usb/phy/phy-mv-usb.c
index c987bbe27851..4a6b03c73876 100644
--- a/drivers/usb/phy/phy-mv-usb.c
+++ b/drivers/usb/phy/phy-mv-usb.c
@@ -667,7 +667,6 @@ int mv_otg_remove(struct platform_device *pdev)
667 mv_otg_disable(mvotg); 667 mv_otg_disable(mvotg);
668 668
669 usb_remove_phy(&mvotg->phy); 669 usb_remove_phy(&mvotg->phy);
670 platform_set_drvdata(pdev, NULL);
671 670
672 return 0; 671 return 0;
673} 672}
@@ -850,8 +849,6 @@ err_destroy_workqueue:
850 flush_workqueue(mvotg->qwork); 849 flush_workqueue(mvotg->qwork);
851 destroy_workqueue(mvotg->qwork); 850 destroy_workqueue(mvotg->qwork);
852 851
853 platform_set_drvdata(pdev, NULL);
854
855 return retval; 852 return retval;
856} 853}
857 854
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index eb25dd2a1429..bd601c537c8d 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -155,6 +155,7 @@ static int mxs_phy_probe(struct platform_device *pdev)
155 mxs_phy->phy.set_suspend = mxs_phy_suspend; 155 mxs_phy->phy.set_suspend = mxs_phy_suspend;
156 mxs_phy->phy.notify_connect = mxs_phy_on_connect; 156 mxs_phy->phy.notify_connect = mxs_phy_on_connect;
157 mxs_phy->phy.notify_disconnect = mxs_phy_on_disconnect; 157 mxs_phy->phy.notify_disconnect = mxs_phy_on_disconnect;
158 mxs_phy->phy.type = USB_PHY_TYPE_USB2;
158 159
159 ATOMIC_INIT_NOTIFIER_HEAD(&mxs_phy->phy.notifier); 160 ATOMIC_INIT_NOTIFIER_HEAD(&mxs_phy->phy.notifier);
160 161
@@ -175,8 +176,6 @@ static int mxs_phy_remove(struct platform_device *pdev)
175 176
176 usb_remove_phy(&mxs_phy->phy); 177 usb_remove_phy(&mxs_phy->phy);
177 178
178 platform_set_drvdata(pdev, NULL);
179
180 return 0; 179 return 0;
181} 180}
182 181
diff --git a/drivers/usb/phy/phy-nop.c b/drivers/usb/phy/phy-nop.c
index 2b10cc969bbb..638cc5dade35 100644
--- a/drivers/usb/phy/phy-nop.c
+++ b/drivers/usb/phy/phy-nop.c
@@ -254,8 +254,6 @@ static int nop_usb_xceiv_remove(struct platform_device *pdev)
254 254
255 usb_remove_phy(&nop->phy); 255 usb_remove_phy(&nop->phy);
256 256
257 platform_set_drvdata(pdev, NULL);
258
259 return 0; 257 return 0;
260} 258}
261 259
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 242b5776648a..7260ec660347 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -189,6 +189,8 @@ static struct usb_device_id id_table_combined [] = {
189 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) }, 189 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) },
190 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_BOOST_PID) }, 190 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_BOOST_PID) },
191 { USB_DEVICE(NEWPORT_VID, NEWPORT_AGILIS_PID) }, 191 { USB_DEVICE(NEWPORT_VID, NEWPORT_AGILIS_PID) },
192 { USB_DEVICE(NEWPORT_VID, NEWPORT_CONEX_CC_PID) },
193 { USB_DEVICE(NEWPORT_VID, NEWPORT_CONEX_AGP_PID) },
192 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, 194 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
193 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, 195 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
194 { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) }, 196 { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) },
@@ -924,8 +926,8 @@ static int ftdi_tiocmset(struct tty_struct *tty,
924static int ftdi_ioctl(struct tty_struct *tty, 926static int ftdi_ioctl(struct tty_struct *tty,
925 unsigned int cmd, unsigned long arg); 927 unsigned int cmd, unsigned long arg);
926static void ftdi_break_ctl(struct tty_struct *tty, int break_state); 928static void ftdi_break_ctl(struct tty_struct *tty, int break_state);
927static int ftdi_chars_in_buffer(struct tty_struct *tty); 929static bool ftdi_tx_empty(struct usb_serial_port *port);
928static int ftdi_get_modem_status(struct tty_struct *tty, 930static int ftdi_get_modem_status(struct usb_serial_port *port,
929 unsigned char status[2]); 931 unsigned char status[2]);
930 932
931static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base); 933static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base);
@@ -961,7 +963,7 @@ static struct usb_serial_driver ftdi_sio_device = {
961 .ioctl = ftdi_ioctl, 963 .ioctl = ftdi_ioctl,
962 .set_termios = ftdi_set_termios, 964 .set_termios = ftdi_set_termios,
963 .break_ctl = ftdi_break_ctl, 965 .break_ctl = ftdi_break_ctl,
964 .chars_in_buffer = ftdi_chars_in_buffer, 966 .tx_empty = ftdi_tx_empty,
965}; 967};
966 968
967static struct usb_serial_driver * const serial_drivers[] = { 969static struct usb_serial_driver * const serial_drivers[] = {
@@ -2056,27 +2058,18 @@ static void ftdi_break_ctl(struct tty_struct *tty, int break_state)
2056 2058
2057} 2059}
2058 2060
2059static int ftdi_chars_in_buffer(struct tty_struct *tty) 2061static bool ftdi_tx_empty(struct usb_serial_port *port)
2060{ 2062{
2061 struct usb_serial_port *port = tty->driver_data;
2062 int chars;
2063 unsigned char buf[2]; 2063 unsigned char buf[2];
2064 int ret; 2064 int ret;
2065 2065
2066 chars = usb_serial_generic_chars_in_buffer(tty); 2066 ret = ftdi_get_modem_status(port, buf);
2067 if (chars)
2068 goto out;
2069
2070 /* Check if hardware buffer is empty. */
2071 ret = ftdi_get_modem_status(tty, buf);
2072 if (ret == 2) { 2067 if (ret == 2) {
2073 if (!(buf[1] & FTDI_RS_TEMT)) 2068 if (!(buf[1] & FTDI_RS_TEMT))
2074 chars = 1; 2069 return false;
2075 } 2070 }
2076out:
2077 dev_dbg(&port->dev, "%s - %d\n", __func__, chars);
2078 2071
2079 return chars; 2072 return true;
2080} 2073}
2081 2074
2082/* old_termios contains the original termios settings and tty->termios contains 2075/* old_termios contains the original termios settings and tty->termios contains
@@ -2268,10 +2261,9 @@ no_c_cflag_changes:
2268 * Returns the number of status bytes retrieved (device dependant), or 2261 * Returns the number of status bytes retrieved (device dependant), or
2269 * negative error code. 2262 * negative error code.
2270 */ 2263 */
2271static int ftdi_get_modem_status(struct tty_struct *tty, 2264static int ftdi_get_modem_status(struct usb_serial_port *port,
2272 unsigned char status[2]) 2265 unsigned char status[2])
2273{ 2266{
2274 struct usb_serial_port *port = tty->driver_data;
2275 struct ftdi_private *priv = usb_get_serial_port_data(port); 2267 struct ftdi_private *priv = usb_get_serial_port_data(port);
2276 unsigned char *buf; 2268 unsigned char *buf;
2277 int len; 2269 int len;
@@ -2336,7 +2328,7 @@ static int ftdi_tiocmget(struct tty_struct *tty)
2336 unsigned char buf[2]; 2328 unsigned char buf[2];
2337 int ret; 2329 int ret;
2338 2330
2339 ret = ftdi_get_modem_status(tty, buf); 2331 ret = ftdi_get_modem_status(port, buf);
2340 if (ret < 0) 2332 if (ret < 0)
2341 return ret; 2333 return ret;
2342 2334
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 98528270c43c..6dd79253205d 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -772,6 +772,8 @@
772 */ 772 */
773#define NEWPORT_VID 0x104D 773#define NEWPORT_VID 0x104D
774#define NEWPORT_AGILIS_PID 0x3000 774#define NEWPORT_AGILIS_PID 0x3000
775#define NEWPORT_CONEX_CC_PID 0x3002
776#define NEWPORT_CONEX_AGP_PID 0x3006
775 777
776/* Interbiometrics USB I/O Board */ 778/* Interbiometrics USB I/O Board */
777/* Developed for Interbiometrics by Rudolf Gugler */ 779/* Developed for Interbiometrics by Rudolf Gugler */
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 297665fdd16d..ba45170c78e5 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -253,6 +253,37 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty)
253} 253}
254EXPORT_SYMBOL_GPL(usb_serial_generic_chars_in_buffer); 254EXPORT_SYMBOL_GPL(usb_serial_generic_chars_in_buffer);
255 255
256void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout)
257{
258 struct usb_serial_port *port = tty->driver_data;
259 unsigned int bps;
260 unsigned long period;
261 unsigned long expire;
262
263 bps = tty_get_baud_rate(tty);
264 if (!bps)
265 bps = 9600; /* B0 */
266 /*
267 * Use a poll-period of roughly the time it takes to send one
268 * character or at least one jiffy.
269 */
270 period = max_t(unsigned long, (10 * HZ / bps), 1);
271 period = min_t(unsigned long, period, timeout);
272
273 dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n",
274 __func__, jiffies_to_msecs(timeout),
275 jiffies_to_msecs(period));
276 expire = jiffies + timeout;
277 while (!port->serial->type->tx_empty(port)) {
278 schedule_timeout_interruptible(period);
279 if (signal_pending(current))
280 break;
281 if (time_after(jiffies, expire))
282 break;
283 }
284}
285EXPORT_SYMBOL_GPL(usb_serial_generic_wait_until_sent);
286
256static int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, 287static int usb_serial_generic_submit_read_urb(struct usb_serial_port *port,
257 int index, gfp_t mem_flags) 288 int index, gfp_t mem_flags)
258{ 289{
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 158bf4bc29cc..1be6ba7bee27 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -2019,8 +2019,6 @@ static int edge_chars_in_buffer(struct tty_struct *tty)
2019 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 2019 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
2020 int chars = 0; 2020 int chars = 0;
2021 unsigned long flags; 2021 unsigned long flags;
2022 int ret;
2023
2024 if (edge_port == NULL) 2022 if (edge_port == NULL)
2025 return 0; 2023 return 0;
2026 2024
@@ -2028,16 +2026,22 @@ static int edge_chars_in_buffer(struct tty_struct *tty)
2028 chars = kfifo_len(&edge_port->write_fifo); 2026 chars = kfifo_len(&edge_port->write_fifo);
2029 spin_unlock_irqrestore(&edge_port->ep_lock, flags); 2027 spin_unlock_irqrestore(&edge_port->ep_lock, flags);
2030 2028
2031 if (!chars) {
2032 ret = tx_active(edge_port);
2033 if (ret > 0)
2034 chars = ret;
2035 }
2036
2037 dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); 2029 dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
2038 return chars; 2030 return chars;
2039} 2031}
2040 2032
2033static bool edge_tx_empty(struct usb_serial_port *port)
2034{
2035 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
2036 int ret;
2037
2038 ret = tx_active(edge_port);
2039 if (ret > 0)
2040 return false;
2041
2042 return true;
2043}
2044
2041static void edge_throttle(struct tty_struct *tty) 2045static void edge_throttle(struct tty_struct *tty)
2042{ 2046{
2043 struct usb_serial_port *port = tty->driver_data; 2047 struct usb_serial_port *port = tty->driver_data;
@@ -2557,6 +2561,7 @@ static struct usb_serial_driver edgeport_1port_device = {
2557 .write = edge_write, 2561 .write = edge_write,
2558 .write_room = edge_write_room, 2562 .write_room = edge_write_room,
2559 .chars_in_buffer = edge_chars_in_buffer, 2563 .chars_in_buffer = edge_chars_in_buffer,
2564 .tx_empty = edge_tx_empty,
2560 .break_ctl = edge_break, 2565 .break_ctl = edge_break,
2561 .read_int_callback = edge_interrupt_callback, 2566 .read_int_callback = edge_interrupt_callback,
2562 .read_bulk_callback = edge_bulk_in_callback, 2567 .read_bulk_callback = edge_bulk_in_callback,
@@ -2589,6 +2594,7 @@ static struct usb_serial_driver edgeport_2port_device = {
2589 .write = edge_write, 2594 .write = edge_write,
2590 .write_room = edge_write_room, 2595 .write_room = edge_write_room,
2591 .chars_in_buffer = edge_chars_in_buffer, 2596 .chars_in_buffer = edge_chars_in_buffer,
2597 .tx_empty = edge_tx_empty,
2592 .break_ctl = edge_break, 2598 .break_ctl = edge_break,
2593 .read_int_callback = edge_interrupt_callback, 2599 .read_int_callback = edge_interrupt_callback,
2594 .read_bulk_callback = edge_bulk_in_callback, 2600 .read_bulk_callback = edge_bulk_in_callback,
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 734372846abb..93d02bc4eb52 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -196,6 +196,7 @@ static void option_instat_callback(struct urb *urb);
196 196
197#define DELL_PRODUCT_5800_MINICARD_VZW 0x8195 /* Novatel E362 */ 197#define DELL_PRODUCT_5800_MINICARD_VZW 0x8195 /* Novatel E362 */
198#define DELL_PRODUCT_5800_V2_MINICARD_VZW 0x8196 /* Novatel E362 */ 198#define DELL_PRODUCT_5800_V2_MINICARD_VZW 0x8196 /* Novatel E362 */
199#define DELL_PRODUCT_5804_MINICARD_ATT 0x819b /* Novatel E371 */
199 200
200#define KYOCERA_VENDOR_ID 0x0c88 201#define KYOCERA_VENDOR_ID 0x0c88
201#define KYOCERA_PRODUCT_KPC650 0x17da 202#define KYOCERA_PRODUCT_KPC650 0x17da
@@ -341,8 +342,8 @@ static void option_instat_callback(struct urb *urb);
341#define CINTERION_PRODUCT_EU3_E 0x0051 342#define CINTERION_PRODUCT_EU3_E 0x0051
342#define CINTERION_PRODUCT_EU3_P 0x0052 343#define CINTERION_PRODUCT_EU3_P 0x0052
343#define CINTERION_PRODUCT_PH8 0x0053 344#define CINTERION_PRODUCT_PH8 0x0053
344#define CINTERION_PRODUCT_AH6 0x0055 345#define CINTERION_PRODUCT_AHXX 0x0055
345#define CINTERION_PRODUCT_PLS8 0x0060 346#define CINTERION_PRODUCT_PLXX 0x0060
346 347
347/* Olivetti products */ 348/* Olivetti products */
348#define OLIVETTI_VENDOR_ID 0x0b3c 349#define OLIVETTI_VENDOR_ID 0x0b3c
@@ -771,6 +772,7 @@ static const struct usb_device_id option_ids[] = {
771 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_VZW) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */ 772 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_VZW) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
772 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_MINICARD_VZW, 0xff, 0xff, 0xff) }, 773 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_MINICARD_VZW, 0xff, 0xff, 0xff) },
773 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_V2_MINICARD_VZW, 0xff, 0xff, 0xff) }, 774 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_V2_MINICARD_VZW, 0xff, 0xff, 0xff) },
775 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5804_MINICARD_ATT, 0xff, 0xff, 0xff) },
774 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */ 776 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */
775 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, 777 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
776 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) }, 778 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
@@ -966,6 +968,8 @@ static const struct usb_device_id option_ids[] = {
966 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 968 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
967 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0330, 0xff, 0xff, 0xff) }, 969 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0330, 0xff, 0xff, 0xff) },
968 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0395, 0xff, 0xff, 0xff) }, 970 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0395, 0xff, 0xff, 0xff) },
971 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0412, 0xff, 0xff, 0xff), /* Telewell TW-LTE 4G */
972 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
969 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0414, 0xff, 0xff, 0xff) }, 973 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0414, 0xff, 0xff, 0xff) },
970 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0417, 0xff, 0xff, 0xff) }, 974 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0417, 0xff, 0xff, 0xff) },
971 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff), 975 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff),
@@ -1264,8 +1268,9 @@ static const struct usb_device_id option_ids[] = {
1264 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, 1268 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) },
1265 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, 1269 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) },
1266 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, 1270 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) },
1267 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AH6) }, 1271 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX) },
1268 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLS8) }, 1272 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX),
1273 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1269 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, 1274 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) },
1270 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, 1275 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
1271 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, 1276 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) },
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index cac47aef2918..c92c5ed4e580 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -101,6 +101,7 @@ static int ti_write(struct tty_struct *tty, struct usb_serial_port *port,
101 const unsigned char *data, int count); 101 const unsigned char *data, int count);
102static int ti_write_room(struct tty_struct *tty); 102static int ti_write_room(struct tty_struct *tty);
103static int ti_chars_in_buffer(struct tty_struct *tty); 103static int ti_chars_in_buffer(struct tty_struct *tty);
104static bool ti_tx_empty(struct usb_serial_port *port);
104static void ti_throttle(struct tty_struct *tty); 105static void ti_throttle(struct tty_struct *tty);
105static void ti_unthrottle(struct tty_struct *tty); 106static void ti_unthrottle(struct tty_struct *tty);
106static int ti_ioctl(struct tty_struct *tty, 107static int ti_ioctl(struct tty_struct *tty,
@@ -222,6 +223,7 @@ static struct usb_serial_driver ti_1port_device = {
222 .write = ti_write, 223 .write = ti_write,
223 .write_room = ti_write_room, 224 .write_room = ti_write_room,
224 .chars_in_buffer = ti_chars_in_buffer, 225 .chars_in_buffer = ti_chars_in_buffer,
226 .tx_empty = ti_tx_empty,
225 .throttle = ti_throttle, 227 .throttle = ti_throttle,
226 .unthrottle = ti_unthrottle, 228 .unthrottle = ti_unthrottle,
227 .ioctl = ti_ioctl, 229 .ioctl = ti_ioctl,
@@ -253,6 +255,7 @@ static struct usb_serial_driver ti_2port_device = {
253 .write = ti_write, 255 .write = ti_write,
254 .write_room = ti_write_room, 256 .write_room = ti_write_room,
255 .chars_in_buffer = ti_chars_in_buffer, 257 .chars_in_buffer = ti_chars_in_buffer,
258 .tx_empty = ti_tx_empty,
256 .throttle = ti_throttle, 259 .throttle = ti_throttle,
257 .unthrottle = ti_unthrottle, 260 .unthrottle = ti_unthrottle,
258 .ioctl = ti_ioctl, 261 .ioctl = ti_ioctl,
@@ -684,8 +687,6 @@ static int ti_chars_in_buffer(struct tty_struct *tty)
684 struct ti_port *tport = usb_get_serial_port_data(port); 687 struct ti_port *tport = usb_get_serial_port_data(port);
685 int chars = 0; 688 int chars = 0;
686 unsigned long flags; 689 unsigned long flags;
687 int ret;
688 u8 lsr;
689 690
690 if (tport == NULL) 691 if (tport == NULL)
691 return 0; 692 return 0;
@@ -694,16 +695,22 @@ static int ti_chars_in_buffer(struct tty_struct *tty)
694 chars = kfifo_len(&tport->write_fifo); 695 chars = kfifo_len(&tport->write_fifo);
695 spin_unlock_irqrestore(&tport->tp_lock, flags); 696 spin_unlock_irqrestore(&tport->tp_lock, flags);
696 697
697 if (!chars) {
698 ret = ti_get_lsr(tport, &lsr);
699 if (!ret && !(lsr & TI_LSR_TX_EMPTY))
700 chars = 1;
701 }
702
703 dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); 698 dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
704 return chars; 699 return chars;
705} 700}
706 701
702static bool ti_tx_empty(struct usb_serial_port *port)
703{
704 struct ti_port *tport = usb_get_serial_port_data(port);
705 int ret;
706 u8 lsr;
707
708 ret = ti_get_lsr(tport, &lsr);
709 if (!ret && !(lsr & TI_LSR_TX_EMPTY))
710 return false;
711
712 return true;
713}
707 714
708static void ti_throttle(struct tty_struct *tty) 715static void ti_throttle(struct tty_struct *tty)
709{ 716{
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index cf75beb1251b..4753c005cfb6 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -359,20 +359,29 @@ static int serial_chars_in_buffer(struct tty_struct *tty)
359{ 359{
360 struct usb_serial_port *port = tty->driver_data; 360 struct usb_serial_port *port = tty->driver_data;
361 struct usb_serial *serial = port->serial; 361 struct usb_serial *serial = port->serial;
362 int count = 0;
363 362
364 dev_dbg(tty->dev, "%s\n", __func__); 363 dev_dbg(tty->dev, "%s\n", __func__);
365 364
366 mutex_lock(&serial->disc_mutex);
367 /* if the device was unplugged then any remaining characters
368 fell out of the connector ;) */
369 if (serial->disconnected) 365 if (serial->disconnected)
370 count = 0; 366 return 0;
371 else 367
372 count = serial->type->chars_in_buffer(tty); 368 return serial->type->chars_in_buffer(tty);
373 mutex_unlock(&serial->disc_mutex); 369}
370
371static void serial_wait_until_sent(struct tty_struct *tty, int timeout)
372{
373 struct usb_serial_port *port = tty->driver_data;
374 struct usb_serial *serial = port->serial;
375
376 dev_dbg(tty->dev, "%s\n", __func__);
377
378 if (!port->serial->type->wait_until_sent)
379 return;
374 380
375 return count; 381 mutex_lock(&serial->disc_mutex);
382 if (!serial->disconnected)
383 port->serial->type->wait_until_sent(tty, timeout);
384 mutex_unlock(&serial->disc_mutex);
376} 385}
377 386
378static void serial_throttle(struct tty_struct *tty) 387static void serial_throttle(struct tty_struct *tty)
@@ -1191,6 +1200,7 @@ static const struct tty_operations serial_ops = {
1191 .unthrottle = serial_unthrottle, 1200 .unthrottle = serial_unthrottle,
1192 .break_ctl = serial_break, 1201 .break_ctl = serial_break,
1193 .chars_in_buffer = serial_chars_in_buffer, 1202 .chars_in_buffer = serial_chars_in_buffer,
1203 .wait_until_sent = serial_wait_until_sent,
1194 .tiocmget = serial_tiocmget, 1204 .tiocmget = serial_tiocmget,
1195 .tiocmset = serial_tiocmset, 1205 .tiocmset = serial_tiocmset,
1196 .get_icount = serial_get_icount, 1206 .get_icount = serial_get_icount,
@@ -1316,6 +1326,8 @@ static void usb_serial_operations_init(struct usb_serial_driver *device)
1316 set_to_generic_if_null(device, close); 1326 set_to_generic_if_null(device, close);
1317 set_to_generic_if_null(device, write_room); 1327 set_to_generic_if_null(device, write_room);
1318 set_to_generic_if_null(device, chars_in_buffer); 1328 set_to_generic_if_null(device, chars_in_buffer);
1329 if (device->tx_empty)
1330 set_to_generic_if_null(device, wait_until_sent);
1319 set_to_generic_if_null(device, read_bulk_callback); 1331 set_to_generic_if_null(device, read_bulk_callback);
1320 set_to_generic_if_null(device, write_bulk_callback); 1332 set_to_generic_if_null(device, write_bulk_callback);
1321 set_to_generic_if_null(device, process_read_urb); 1333 set_to_generic_if_null(device, process_read_urb);
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
index 8623577bbbe7..281be56d5648 100644
--- a/drivers/usb/storage/realtek_cr.c
+++ b/drivers/usb/storage/realtek_cr.c
@@ -105,8 +105,9 @@ struct rts51x_chip {
105 int status_len; 105 int status_len;
106 106
107 u32 flag; 107 u32 flag;
108#ifdef CONFIG_REALTEK_AUTOPM
109 struct us_data *us; 108 struct us_data *us;
109
110#ifdef CONFIG_REALTEK_AUTOPM
110 struct timer_list rts51x_suspend_timer; 111 struct timer_list rts51x_suspend_timer;
111 unsigned long timer_expires; 112 unsigned long timer_expires;
112 int pwr_state; 113 int pwr_state;
@@ -988,6 +989,7 @@ static int init_realtek_cr(struct us_data *us)
988 us->extra = chip; 989 us->extra = chip;
989 us->extra_destructor = realtek_cr_destructor; 990 us->extra_destructor = realtek_cr_destructor;
990 us->max_lun = chip->max_lun = rts51x_get_max_lun(us); 991 us->max_lun = chip->max_lun = rts51x_get_max_lun(us);
992 chip->us = us;
991 993
992 usb_stor_dbg(us, "chip->max_lun = %d\n", chip->max_lun); 994 usb_stor_dbg(us, "chip->max_lun = %d\n", chip->max_lun);
993 995
@@ -1010,10 +1012,8 @@ static int init_realtek_cr(struct us_data *us)
1010 SET_AUTO_DELINK(chip); 1012 SET_AUTO_DELINK(chip);
1011 } 1013 }
1012#ifdef CONFIG_REALTEK_AUTOPM 1014#ifdef CONFIG_REALTEK_AUTOPM
1013 if (ss_en) { 1015 if (ss_en)
1014 chip->us = us;
1015 realtek_cr_autosuspend_setup(us); 1016 realtek_cr_autosuspend_setup(us);
1016 }
1017#endif 1017#endif
1018 1018
1019 usb_stor_dbg(us, "chip->flag = 0x%x\n", chip->flag); 1019 usb_stor_dbg(us, "chip->flag = 0x%x\n", chip->flag);
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index c454a88abf2e..f1b0dca60f12 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -563,9 +563,8 @@ static inline int gadget_is_dualspeed(struct usb_gadget *g)
563} 563}
564 564
565/** 565/**
566 * gadget_is_superspeed() - return true if the hardware handles 566 * gadget_is_superspeed() - return true if the hardware handles superspeed
567 * supperspeed 567 * @g: controller that might support superspeed
568 * @g: controller that might support supper speed
569 */ 568 */
570static inline int gadget_is_superspeed(struct usb_gadget *g) 569static inline int gadget_is_superspeed(struct usb_gadget *g)
571{ 570{
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index b9b0f7b4e43b..302ddf55d2da 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -268,6 +268,8 @@ struct usb_serial_driver {
268 struct usb_serial_port *port, struct ktermios *old); 268 struct usb_serial_port *port, struct ktermios *old);
269 void (*break_ctl)(struct tty_struct *tty, int break_state); 269 void (*break_ctl)(struct tty_struct *tty, int break_state);
270 int (*chars_in_buffer)(struct tty_struct *tty); 270 int (*chars_in_buffer)(struct tty_struct *tty);
271 void (*wait_until_sent)(struct tty_struct *tty, long timeout);
272 bool (*tx_empty)(struct usb_serial_port *port);
271 void (*throttle)(struct tty_struct *tty); 273 void (*throttle)(struct tty_struct *tty);
272 void (*unthrottle)(struct tty_struct *tty); 274 void (*unthrottle)(struct tty_struct *tty);
273 int (*tiocmget)(struct tty_struct *tty); 275 int (*tiocmget)(struct tty_struct *tty);
@@ -327,6 +329,8 @@ extern void usb_serial_generic_close(struct usb_serial_port *port);
327extern int usb_serial_generic_resume(struct usb_serial *serial); 329extern int usb_serial_generic_resume(struct usb_serial *serial);
328extern int usb_serial_generic_write_room(struct tty_struct *tty); 330extern int usb_serial_generic_write_room(struct tty_struct *tty);
329extern int usb_serial_generic_chars_in_buffer(struct tty_struct *tty); 331extern int usb_serial_generic_chars_in_buffer(struct tty_struct *tty);
332extern void usb_serial_generic_wait_until_sent(struct tty_struct *tty,
333 long timeout);
330extern void usb_serial_generic_read_bulk_callback(struct urb *urb); 334extern void usb_serial_generic_read_bulk_callback(struct urb *urb);
331extern void usb_serial_generic_write_bulk_callback(struct urb *urb); 335extern void usb_serial_generic_write_bulk_callback(struct urb *urb);
332extern void usb_serial_generic_throttle(struct tty_struct *tty); 336extern void usb_serial_generic_throttle(struct tty_struct *tty);