Skip to content

Commit db8cbfa

Browse files
committed
Merge tag 'usb-3.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are a number of USB fixes for 3.11-rc3. Lots of little things, nothing major. A number of new device ids, build fixes for DMA, and a bunch of other minor things. All of these have been in the linux-next tree" * tag 'usb-3.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (40 commits) usb: Clear both buffers when clearing a control transfer TT buffer. usb/gadget: free opts struct on error recovery USB: mos7840: fix memory leak in open usb: serial: option.c: remove ONDA MT825UP product ID fromdriver usb: serial: option: add Olivetti Olicard 200 usb: serial: option: blacklist ONDA MT689DC QMI interface xhci: fix null pointer dereference on ring_doorbell_for_active_rings usb: host: xhci: Enable XHCI_SPURIOUS_SUCCESS for all controllers with xhci 1.0 usb: fix build warning in pci-quirks.h when CONFIG_PCI is not enabled usb: xhci: Mark two functions __maybe_unused xhci: Avoid NULL pointer deref when host dies. usb: serial: option: Add ONYX 3G device support USB: ti_usb_3410_5052: fix dynamic-id matching usb: option: add TP-LINK MA260 USB: option: add D-Link DWM-152/C1 and DWM-156/C1 USB: EHCI: Fix resume signalling on remote wakeup USB: cp210x: add MMB and PI ZigBee USB Device Support usb: cp210x support SEL C662 Vendor/Device USB: option: append Petatel NP10T device to GSM modems list USB: misc: Add Manhattan Hi-Speed USB DVI Converter to sisusbvga ...
2 parents ab20fb8 + 2c7b871 commit db8cbfa

33 files changed

Lines changed: 172 additions & 79 deletions

‎drivers/usb/core/hub.c‎

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,15 @@ static void hub_irq(struct urb *urb)
668668
static inline int
669669
hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt)
670670
{
671+
/* Need to clear both directions for control ep */
672+
if (((devinfo >> 11) & USB_ENDPOINT_XFERTYPE_MASK) ==
673+
USB_ENDPOINT_XFER_CONTROL) {
674+
int status = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
675+
HUB_CLEAR_TT_BUFFER, USB_RT_PORT,
676+
devinfo ^ 0x8000, tt, NULL, 0, 1000);
677+
if (status)
678+
return status;
679+
}
671680
return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
672681
HUB_CLEAR_TT_BUFFER, USB_RT_PORT, devinfo,
673682
tt, NULL, 0, 1000);
@@ -2848,6 +2857,15 @@ static int usb_disable_function_remotewakeup(struct usb_device *udev)
28482857
USB_CTRL_SET_TIMEOUT);
28492858
}
28502859

2860+
/* Count of wakeup-enabled devices at or below udev */
2861+
static unsigned wakeup_enabled_descendants(struct usb_device *udev)
2862+
{
2863+
struct usb_hub *hub = usb_hub_to_struct_hub(udev);
2864+
2865+
return udev->do_remote_wakeup +
2866+
(hub ? hub->wakeup_enabled_descendants : 0);
2867+
}
2868+
28512869
/*
28522870
* usb_port_suspend - suspend a usb device's upstream port
28532871
* @udev: device that's no longer in active use, not a root hub
@@ -2888,8 +2906,8 @@ static int usb_disable_function_remotewakeup(struct usb_device *udev)
28882906
* Linux (2.6) currently has NO mechanisms to initiate that: no khubd
28892907
* timer, no SRP, no requests through sysfs.
28902908
*
2891-
* If Runtime PM isn't enabled or used, non-SuperSpeed devices really get
2892-
* suspended only when their bus goes into global suspend (i.e., the root
2909+
* If Runtime PM isn't enabled or used, non-SuperSpeed devices may not get
2910+
* suspended until their bus goes into global suspend (i.e., the root
28932911
* hub is suspended). Nevertheless, we change @udev->state to
28942912
* USB_STATE_SUSPENDED as this is the device's "logical" state. The actual
28952913
* upstream port setting is stored in @udev->port_is_suspended.
@@ -2960,15 +2978,21 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
29602978
/* see 7.1.7.6 */
29612979
if (hub_is_superspeed(hub->hdev))
29622980
status = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_U3);
2963-
else if (PMSG_IS_AUTO(msg))
2964-
status = set_port_feature(hub->hdev, port1,
2965-
USB_PORT_FEAT_SUSPEND);
2981+
29662982
/*
29672983
* For system suspend, we do not need to enable the suspend feature
29682984
* on individual USB-2 ports. The devices will automatically go
29692985
* into suspend a few ms after the root hub stops sending packets.
29702986
* The USB 2.0 spec calls this "global suspend".
2987+
*
2988+
* However, many USB hubs have a bug: They don't relay wakeup requests
2989+
* from a downstream port if the port's suspend feature isn't on.
2990+
* Therefore we will turn on the suspend feature if udev or any of its
2991+
* descendants is enabled for remote wakeup.
29712992
*/
2993+
else if (PMSG_IS_AUTO(msg) || wakeup_enabled_descendants(udev) > 0)
2994+
status = set_port_feature(hub->hdev, port1,
2995+
USB_PORT_FEAT_SUSPEND);
29722996
else {
29732997
really_suspend = false;
29742998
status = 0;
@@ -3003,15 +3027,16 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
30033027
if (!PMSG_IS_AUTO(msg))
30043028
status = 0;
30053029
} else {
3006-
/* device has up to 10 msec to fully suspend */
30073030
dev_dbg(&udev->dev, "usb %ssuspend, wakeup %d\n",
30083031
(PMSG_IS_AUTO(msg) ? "auto-" : ""),
30093032
udev->do_remote_wakeup);
3010-
usb_set_device_state(udev, USB_STATE_SUSPENDED);
30113033
if (really_suspend) {
30123034
udev->port_is_suspended = 1;
3035+
3036+
/* device has up to 10 msec to fully suspend */
30133037
msleep(10);
30143038
}
3039+
usb_set_device_state(udev, USB_STATE_SUSPENDED);
30153040
}
30163041

30173042
/*
@@ -3293,7 +3318,11 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
32933318
unsigned port1;
32943319
int status;
32953320

3296-
/* Warn if children aren't already suspended */
3321+
/*
3322+
* Warn if children aren't already suspended.
3323+
* Also, add up the number of wakeup-enabled descendants.
3324+
*/
3325+
hub->wakeup_enabled_descendants = 0;
32973326
for (port1 = 1; port1 <= hdev->maxchild; port1++) {
32983327
struct usb_device *udev;
32993328

@@ -3303,6 +3332,9 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
33033332
if (PMSG_IS_AUTO(msg))
33043333
return -EBUSY;
33053334
}
3335+
if (udev)
3336+
hub->wakeup_enabled_descendants +=
3337+
wakeup_enabled_descendants(udev);
33063338
}
33073339

33083340
if (hdev->do_remote_wakeup && hub->quirk_check_port_auto_suspend) {

‎drivers/usb/core/hub.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ struct usb_hub {
5959
struct usb_tt tt; /* Transaction Translator */
6060

6161
unsigned mA_per_port; /* current for each child */
62+
#ifdef CONFIG_PM
63+
unsigned wakeup_enabled_descendants;
64+
#endif
6265

6366
unsigned limited_power:1;
6467
unsigned quiescing:1;

‎drivers/usb/dwc3/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
config USB_DWC3
22
tristate "DesignWare USB3 DRD Core Support"
3-
depends on (USB || USB_GADGET) && GENERIC_HARDIRQS
3+
depends on (USB || USB_GADGET) && GENERIC_HARDIRQS && HAS_DMA
44
select USB_XHCI_PLATFORM if USB_SUPPORT && USB_XHCI_HCD
55
help
66
Say Y or M here if your system has a Dual Role SuperSpeed

‎drivers/usb/dwc3/core.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ static int dwc3_probe(struct platform_device *pdev)
450450
}
451451

452452
if (IS_ERR(dwc->usb3_phy)) {
453-
ret = PTR_ERR(dwc->usb2_phy);
453+
ret = PTR_ERR(dwc->usb3_phy);
454454

455455
/*
456456
* if -ENXIO is returned, it means PHY layer wasn't

‎drivers/usb/dwc3/core.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,8 @@ struct dwc3 {
759759

760760
struct dwc3_event_type {
761761
u32 is_devspec:1;
762-
u32 type:6;
763-
u32 reserved8_31:25;
762+
u32 type:7;
763+
u32 reserved8_31:24;
764764
} __packed;
765765

766766
#define DWC3_DEPEVT_XFERCOMPLETE 0x01

‎drivers/usb/dwc3/gadget.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,6 +1584,7 @@ static int dwc3_gadget_start(struct usb_gadget *g,
15841584
__dwc3_gadget_ep_disable(dwc->eps[0]);
15851585

15861586
err0:
1587+
dwc->gadget_driver = NULL;
15871588
spin_unlock_irqrestore(&dwc->lock, flags);
15881589

15891590
return ret;

‎drivers/usb/gadget/Kconfig‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ config USB_FUSB300
193193
Faraday usb device controller FUSB300 driver
194194

195195
config USB_FOTG210_UDC
196+
depends on HAS_DMA
196197
tristate "Faraday FOTG210 USB Peripheral Controller"
197198
help
198199
Faraday USB2.0 OTG controller which can be configured as
@@ -328,13 +329,14 @@ config USB_S3C_HSUDC
328329

329330
config USB_MV_UDC
330331
tristate "Marvell USB2.0 Device Controller"
331-
depends on GENERIC_HARDIRQS
332+
depends on GENERIC_HARDIRQS && HAS_DMA
332333
help
333334
Marvell Socs (including PXA and MMP series) include a high speed
334335
USB2.0 OTG controller, which can be configured as high speed or
335336
full speed USB peripheral.
336337

337338
config USB_MV_U3D
339+
depends on HAS_DMA
338340
tristate "MARVELL PXA2128 USB 3.0 controller"
339341
help
340342
MARVELL PXA2128 Processor series include a super speed USB3.0 device
@@ -639,6 +641,7 @@ config USB_CONFIGFS_RNDIS
639641
depends on USB_CONFIGFS
640642
depends on NET
641643
select USB_U_ETHER
644+
select USB_U_RNDIS
642645
select USB_F_RNDIS
643646
help
644647
Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol,

‎drivers/usb/gadget/at91_udc.c‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -870,8 +870,8 @@ static void clk_on(struct at91_udc *udc)
870870
if (udc->clocked)
871871
return;
872872
udc->clocked = 1;
873-
clk_enable(udc->iclk);
874-
clk_enable(udc->fclk);
873+
clk_prepare_enable(udc->iclk);
874+
clk_prepare_enable(udc->fclk);
875875
}
876876

877877
static void clk_off(struct at91_udc *udc)
@@ -880,8 +880,8 @@ static void clk_off(struct at91_udc *udc)
880880
return;
881881
udc->clocked = 0;
882882
udc->gadget.speed = USB_SPEED_UNKNOWN;
883-
clk_disable(udc->fclk);
884-
clk_disable(udc->iclk);
883+
clk_disable_unprepare(udc->fclk);
884+
clk_disable_unprepare(udc->iclk);
885885
}
886886

887887
/*
@@ -1725,7 +1725,7 @@ static int at91udc_probe(struct platform_device *pdev)
17251725
/* init software state */
17261726
udc = &controller;
17271727
udc->gadget.dev.parent = dev;
1728-
if (pdev->dev.of_node)
1728+
if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node)
17291729
at91udc_of_init(udc, pdev->dev.of_node);
17301730
else
17311731
memcpy(&udc->board, dev->platform_data,
@@ -1782,12 +1782,14 @@ static int at91udc_probe(struct platform_device *pdev)
17821782
}
17831783

17841784
/* don't do anything until we have both gadget driver and VBUS */
1785-
clk_enable(udc->iclk);
1785+
retval = clk_prepare_enable(udc->iclk);
1786+
if (retval)
1787+
goto fail1;
17861788
at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS);
17871789
at91_udp_write(udc, AT91_UDP_IDR, 0xffffffff);
17881790
/* Clear all pending interrupts - UDP may be used by bootloader. */
17891791
at91_udp_write(udc, AT91_UDP_ICR, 0xffffffff);
1790-
clk_disable(udc->iclk);
1792+
clk_disable_unprepare(udc->iclk);
17911793

17921794
/* request UDC and maybe VBUS irqs */
17931795
udc->udp_irq = platform_get_irq(pdev, 0);

‎drivers/usb/gadget/f_ecm.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,8 +959,11 @@ static struct usb_function_instance *ecm_alloc_inst(void)
959959
mutex_init(&opts->lock);
960960
opts->func_inst.free_func_inst = ecm_free_inst;
961961
opts->net = gether_setup_default();
962-
if (IS_ERR(opts->net))
963-
return ERR_PTR(PTR_ERR(opts->net));
962+
if (IS_ERR(opts->net)) {
963+
struct net_device *net = opts->net;
964+
kfree(opts);
965+
return ERR_CAST(net);
966+
}
964967

965968
config_group_init_type_name(&opts->func_inst.group, "", &ecm_func_type);
966969

‎drivers/usb/gadget/f_eem.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,11 @@ static struct usb_function_instance *eem_alloc_inst(void)
593593
mutex_init(&opts->lock);
594594
opts->func_inst.free_func_inst = eem_free_inst;
595595
opts->net = gether_setup_default();
596-
if (IS_ERR(opts->net))
597-
return ERR_CAST(opts->net);
596+
if (IS_ERR(opts->net)) {
597+
struct net_device *net = opts->net;
598+
kfree(opts);
599+
return ERR_CAST(net);
600+
}
598601

599602
config_group_init_type_name(&opts->func_inst.group, "", &eem_func_type);
600603

0 commit comments

Comments
 (0)