Skip to content

Commit a36c160

Browse files
committed
Merge tag 'usb-3.13-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are a few USB fixes for things that have people have reported issues with recently" * tag 'usb-3.13-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: usb: ohci-at91: fix irq and iomem resource retrieval usb: phy: fix driver dependencies phy: kconfig: add depends on "USB_PHY" to OMAP_USB2 and TWL4030_USB drivers: phy: tweaks to phy_create() drivers: phy: Fix memory leak xhci: Limit the spurious wakeup fix only to HP machines usb: chipidea: fix nobody cared IRQ when booting with host role usb: chipidea: host: Only disable the vbus regulator if it is not NULL usb: serial: zte_ev: move support for ZTE AC2726 from zte_ev back to option usb: cdc-wdm: manage_power should always set needs_remote_wakeup usb: phy-tegra-usb.c: wrong pointer check for remap UTMI usb: phy: twl6030-usb: signedness bug in twl6030_readb() usb: dwc3: power off usb phy in error path usb: dwc3: invoke phy_resume after phy_init
2 parents e523365 + fb5f183 commit a36c160

File tree

14 files changed

+56
-47
lines changed

14 files changed

+56
-47
lines changed

drivers/phy/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ config PHY_EXYNOS_MIPI_VIDEO
2424
config OMAP_USB2
2525
tristate "OMAP USB2 PHY Driver"
2626
depends on ARCH_OMAP2PLUS
27+
depends on USB_PHY
2728
select GENERIC_PHY
28-
select USB_PHY
2929
select OMAP_CONTROL_USB
3030
help
3131
Enable this to support the transceiver that is part of SOC. This
@@ -36,8 +36,8 @@ config OMAP_USB2
3636
config TWL4030_USB
3737
tristate "TWL4030 USB Transceiver Driver"
3838
depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS
39+
depends on USB_PHY
3940
select GENERIC_PHY
40-
select USB_PHY
4141
help
4242
Enable this to support the USB OTG transceiver on TWL4030
4343
family chips (including the TWL5030 and TPS659x0 devices).

drivers/phy/phy-core.c

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -437,23 +437,18 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
437437
int id;
438438
struct phy *phy;
439439

440-
if (!dev) {
441-
dev_WARN(dev, "no device provided for PHY\n");
442-
ret = -EINVAL;
443-
goto err0;
444-
}
440+
if (WARN_ON(!dev))
441+
return ERR_PTR(-EINVAL);
445442

446443
phy = kzalloc(sizeof(*phy), GFP_KERNEL);
447-
if (!phy) {
448-
ret = -ENOMEM;
449-
goto err0;
450-
}
444+
if (!phy)
445+
return ERR_PTR(-ENOMEM);
451446

452447
id = ida_simple_get(&phy_ida, 0, 0, GFP_KERNEL);
453448
if (id < 0) {
454449
dev_err(dev, "unable to get id\n");
455450
ret = id;
456-
goto err0;
451+
goto free_phy;
457452
}
458453

459454
device_initialize(&phy->dev);
@@ -468,11 +463,11 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
468463

469464
ret = dev_set_name(&phy->dev, "phy-%s.%d", dev_name(dev), id);
470465
if (ret)
471-
goto err1;
466+
goto put_dev;
472467

473468
ret = device_add(&phy->dev);
474469
if (ret)
475-
goto err1;
470+
goto put_dev;
476471

477472
if (pm_runtime_enabled(dev)) {
478473
pm_runtime_enable(&phy->dev);
@@ -481,12 +476,11 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
481476

482477
return phy;
483478

484-
err1:
485-
ida_remove(&phy_ida, phy->id);
479+
put_dev:
486480
put_device(&phy->dev);
481+
ida_remove(&phy_ida, phy->id);
482+
free_phy:
487483
kfree(phy);
488-
489-
err0:
490484
return ERR_PTR(ret);
491485
}
492486
EXPORT_SYMBOL_GPL(phy_create);

drivers/usb/chipidea/core.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,10 @@ static int ci_hdrc_probe(struct platform_device *pdev)
642642
: CI_ROLE_GADGET;
643643
}
644644

645+
/* only update vbus status for peripheral */
646+
if (ci->role == CI_ROLE_GADGET)
647+
ci_handle_vbus_change(ci);
648+
645649
ret = ci_role_start(ci, ci->role);
646650
if (ret) {
647651
dev_err(dev, "can't start %s role\n", ci_role(ci)->name);

drivers/usb/chipidea/host.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ static int host_start(struct ci_hdrc *ci)
8888
return ret;
8989

9090
disable_reg:
91-
regulator_disable(ci->platdata->reg_vbus);
91+
if (ci->platdata->reg_vbus)
92+
regulator_disable(ci->platdata->reg_vbus);
9293

9394
put_hcd:
9495
usb_put_hcd(hcd);

drivers/usb/chipidea/udc.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,9 +1795,6 @@ static int udc_start(struct ci_hdrc *ci)
17951795
pm_runtime_no_callbacks(&ci->gadget.dev);
17961796
pm_runtime_enable(&ci->gadget.dev);
17971797

1798-
/* Update ci->vbus_active */
1799-
ci_handle_vbus_change(ci);
1800-
18011798
return retval;
18021799

18031800
destroy_eps:

drivers/usb/class/cdc-wdm.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -854,13 +854,11 @@ static int wdm_manage_power(struct usb_interface *intf, int on)
854854
{
855855
/* need autopm_get/put here to ensure the usbcore sees the new value */
856856
int rv = usb_autopm_get_interface(intf);
857-
if (rv < 0)
858-
goto err;
859857

860858
intf->needs_remote_wakeup = on;
861-
usb_autopm_put_interface(intf);
862-
err:
863-
return rv;
859+
if (!rv)
860+
usb_autopm_put_interface(intf);
861+
return 0;
864862
}
865863

866864
static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id)

drivers/usb/dwc3/core.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,6 @@ static int dwc3_probe(struct platform_device *pdev)
455455
if (IS_ERR(regs))
456456
return PTR_ERR(regs);
457457

458-
usb_phy_set_suspend(dwc->usb2_phy, 0);
459-
usb_phy_set_suspend(dwc->usb3_phy, 0);
460-
461458
spin_lock_init(&dwc->lock);
462459
platform_set_drvdata(pdev, dwc);
463460

@@ -488,6 +485,9 @@ static int dwc3_probe(struct platform_device *pdev)
488485
goto err0;
489486
}
490487

488+
usb_phy_set_suspend(dwc->usb2_phy, 0);
489+
usb_phy_set_suspend(dwc->usb3_phy, 0);
490+
491491
ret = dwc3_event_buffers_setup(dwc);
492492
if (ret) {
493493
dev_err(dwc->dev, "failed to setup event buffers\n");
@@ -569,6 +569,8 @@ static int dwc3_probe(struct platform_device *pdev)
569569
dwc3_event_buffers_cleanup(dwc);
570570

571571
err1:
572+
usb_phy_set_suspend(dwc->usb2_phy, 1);
573+
usb_phy_set_suspend(dwc->usb3_phy, 1);
572574
dwc3_core_exit(dwc);
573575

574576
err0:

drivers/usb/host/ohci-at91.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,23 +136,27 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
136136
struct ohci_hcd *ohci;
137137
int retval;
138138
struct usb_hcd *hcd = NULL;
139-
140-
if (pdev->num_resources != 2) {
141-
pr_debug("hcd probe: invalid num_resources");
142-
return -ENODEV;
139+
struct device *dev = &pdev->dev;
140+
struct resource *res;
141+
int irq;
142+
143+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
144+
if (!res) {
145+
dev_dbg(dev, "hcd probe: missing memory resource\n");
146+
return -ENXIO;
143147
}
144148

145-
if ((pdev->resource[0].flags != IORESOURCE_MEM)
146-
|| (pdev->resource[1].flags != IORESOURCE_IRQ)) {
147-
pr_debug("hcd probe: invalid resource type\n");
148-
return -ENODEV;
149+
irq = platform_get_irq(pdev, 0);
150+
if (irq < 0) {
151+
dev_dbg(dev, "hcd probe: missing irq resource\n");
152+
return irq;
149153
}
150154

151155
hcd = usb_create_hcd(driver, &pdev->dev, "at91");
152156
if (!hcd)
153157
return -ENOMEM;
154-
hcd->rsrc_start = pdev->resource[0].start;
155-
hcd->rsrc_len = resource_size(&pdev->resource[0]);
158+
hcd->rsrc_start = res->start;
159+
hcd->rsrc_len = resource_size(res);
156160

157161
if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
158162
pr_debug("request_mem_region failed\n");
@@ -199,7 +203,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
199203
ohci->num_ports = board->ports;
200204
at91_start_hc(pdev);
201205

202-
retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_SHARED);
206+
retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
203207
if (retval == 0)
204208
return retval;
205209

drivers/usb/host/xhci-pci.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,12 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
128128
* any other sleep) on Haswell machines with LPT and LPT-LP
129129
* with the new Intel BIOS
130130
*/
131-
xhci->quirks |= XHCI_SPURIOUS_WAKEUP;
131+
/* Limit the quirk to only known vendors, as this triggers
132+
* yet another BIOS bug on some other machines
133+
* https://bugzilla.kernel.org/show_bug.cgi?id=66171
134+
*/
135+
if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP)
136+
xhci->quirks |= XHCI_SPURIOUS_WAKEUP;
132137
}
133138
if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
134139
pdev->device == PCI_DEVICE_ID_ASROCK_P67) {

drivers/usb/phy/Kconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ config AB8500_USB
1919
in host mode, low speed.
2020

2121
config FSL_USB2_OTG
22-
bool "Freescale USB OTG Transceiver Driver"
22+
tristate "Freescale USB OTG Transceiver Driver"
2323
depends on USB_EHCI_FSL && USB_FSL_USB2 && PM_RUNTIME
24+
depends on USB
2425
select USB_OTG
2526
select USB_PHY
2627
help
@@ -29,6 +30,7 @@ config FSL_USB2_OTG
2930
config ISP1301_OMAP
3031
tristate "Philips ISP1301 with OMAP OTG"
3132
depends on I2C && ARCH_OMAP_OTG
33+
depends on USB
3234
select USB_PHY
3335
help
3436
If you say yes here you get support for the Philips ISP1301

drivers/usb/phy/phy-tegra-usb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy,
876876

877877
tegra_phy->pad_regs = devm_ioremap(&pdev->dev, res->start,
878878
resource_size(res));
879-
if (!tegra_phy->regs) {
879+
if (!tegra_phy->pad_regs) {
880880
dev_err(&pdev->dev, "Failed to remap UTMI Pad regs\n");
881881
return -ENOMEM;
882882
}

drivers/usb/phy/phy-twl6030-usb.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ static inline int twl6030_writeb(struct twl6030_usb *twl, u8 module,
127127

128128
static inline u8 twl6030_readb(struct twl6030_usb *twl, u8 module, u8 address)
129129
{
130-
u8 data, ret = 0;
130+
u8 data;
131+
int ret;
131132

132133
ret = twl_i2c_read_u8(module, &data, address);
133134
if (ret >= 0)

drivers/usb/serial/option.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ static void option_instat_callback(struct urb *urb);
251251
#define ZTE_PRODUCT_MF628 0x0015
252252
#define ZTE_PRODUCT_MF626 0x0031
253253
#define ZTE_PRODUCT_MC2718 0xffe8
254+
#define ZTE_PRODUCT_AC2726 0xfff1
254255

255256
#define BENQ_VENDOR_ID 0x04a5
256257
#define BENQ_PRODUCT_H10 0x4068
@@ -1453,6 +1454,7 @@ static const struct usb_device_id option_ids[] = {
14531454
{ USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) },
14541455
{ USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) },
14551456
{ USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) },
1457+
{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
14561458

14571459
{ USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
14581460
{ USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },

drivers/usb/serial/zte_ev.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,7 @@ static const struct usb_device_id id_table[] = {
281281
{ USB_DEVICE(0x19d2, 0xfffd) },
282282
{ USB_DEVICE(0x19d2, 0xfffc) },
283283
{ USB_DEVICE(0x19d2, 0xfffb) },
284-
/* AC2726, AC8710_V3 */
285-
{ USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xfff1, 0xff, 0xff, 0xff) },
284+
/* AC8710_V3 */
286285
{ USB_DEVICE(0x19d2, 0xfff6) },
287286
{ USB_DEVICE(0x19d2, 0xfff7) },
288287
{ USB_DEVICE(0x19d2, 0xfff8) },

0 commit comments

Comments
 (0)