Skip to content

Commit 741668e

Browse files
committed
Merge tag 'usb-5.15-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are some small USB fixes for 5.15-rc5 that resolve a number of reported issues: - gadget driver fixes - xhci build warning fixes - build configuration fix - cdc-acm tty handling fixes - cdc-wdm fix - typec fixes All of these have been in linux-next for a while with no reported issues" * tag 'usb-5.15-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: USB: cdc-acm: fix break reporting USB: cdc-acm: fix racy tty buffer accesses usb: gadget: f_uac2: fixed EP-IN wMaxPacketSize usb: cdc-wdm: Fix check for WWAN usb: chipidea: ci_hdrc_imx: Also search for 'phys' phandle usb: typec: tcpm: handle SRC_STARTUP state if cc changes usb: typec: tcpci: don't handle vSafe0V event if it's not enabled usb: typec: tipd: Remove dependency on "connector" child fwnode Partially revert "usb: Kconfig: using select for USB_COMMON dependency" usb: dwc3: gadget: Revert "set gadgets parent to the right controller" usb: xhci: tegra: mark PM functions as __maybe_unused
2 parents 9c7e705 + 58fc1da commit 741668e

File tree

10 files changed

+42
-29
lines changed

10 files changed

+42
-29
lines changed

drivers/usb/chipidea/ci_hdrc_imx.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,16 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
420420
data->phy = devm_usb_get_phy_by_phandle(dev, "fsl,usbphy", 0);
421421
if (IS_ERR(data->phy)) {
422422
ret = PTR_ERR(data->phy);
423-
/* Return -EINVAL if no usbphy is available */
424-
if (ret == -ENODEV)
425-
data->phy = NULL;
426-
else
427-
goto err_clk;
423+
if (ret == -ENODEV) {
424+
data->phy = devm_usb_get_phy_by_phandle(dev, "phys", 0);
425+
if (IS_ERR(data->phy)) {
426+
ret = PTR_ERR(data->phy);
427+
if (ret == -ENODEV)
428+
data->phy = NULL;
429+
else
430+
goto err_clk;
431+
}
432+
}
428433
}
429434

430435
pdata.usb_phy = data->phy;

drivers/usb/class/cdc-acm.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,9 @@ static void acm_process_notification(struct acm *acm, unsigned char *buf)
340340
acm->iocount.overrun++;
341341
spin_unlock_irqrestore(&acm->read_lock, flags);
342342

343+
if (newctrl & ACM_CTRL_BRK)
344+
tty_flip_buffer_push(&acm->port);
345+
343346
if (difference)
344347
wake_up_all(&acm->wioctl);
345348

@@ -475,11 +478,16 @@ static int acm_submit_read_urbs(struct acm *acm, gfp_t mem_flags)
475478

476479
static void acm_process_read_urb(struct acm *acm, struct urb *urb)
477480
{
481+
unsigned long flags;
482+
478483
if (!urb->actual_length)
479484
return;
480485

486+
spin_lock_irqsave(&acm->read_lock, flags);
481487
tty_insert_flip_string(&acm->port, urb->transfer_buffer,
482488
urb->actual_length);
489+
spin_unlock_irqrestore(&acm->read_lock, flags);
490+
483491
tty_flip_buffer_push(&acm->port);
484492
}
485493

drivers/usb/class/cdc-wdm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ static struct usb_class_driver wdm_class = {
824824
};
825825

826826
/* --- WWAN framework integration --- */
827-
#ifdef CONFIG_WWAN_CORE
827+
#ifdef CONFIG_WWAN
828828
static int wdm_wwan_port_start(struct wwan_port *port)
829829
{
830830
struct wdm_device *desc = wwan_port_get_drvdata(port);
@@ -963,11 +963,11 @@ static void wdm_wwan_rx(struct wdm_device *desc, int length)
963963
/* inbuf has been copied, it is safe to check for outstanding data */
964964
schedule_work(&desc->service_outs_intr);
965965
}
966-
#else /* CONFIG_WWAN_CORE */
966+
#else /* CONFIG_WWAN */
967967
static void wdm_wwan_init(struct wdm_device *desc) {}
968968
static void wdm_wwan_deinit(struct wdm_device *desc) {}
969969
static void wdm_wwan_rx(struct wdm_device *desc, int length) {}
970-
#endif /* CONFIG_WWAN_CORE */
970+
#endif /* CONFIG_WWAN */
971971

972972
/* --- error handling --- */
973973
static void wdm_rxwork(struct work_struct *work)

drivers/usb/common/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ config USB_COMMON
66

77
config USB_LED_TRIG
88
bool "USB LED Triggers"
9-
depends on LEDS_CLASS && LEDS_TRIGGERS
10-
select USB_COMMON
9+
depends on LEDS_CLASS && USB_COMMON && LEDS_TRIGGERS
1110
help
1211
This option adds LED triggers for USB host and/or gadget activity.
1312

drivers/usb/dwc3/gadget.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4243,7 +4243,7 @@ int dwc3_gadget_init(struct dwc3 *dwc)
42434243
}
42444244

42454245

4246-
usb_initialize_gadget(dwc->sysdev, dwc->gadget, dwc_gadget_release);
4246+
usb_initialize_gadget(dwc->dev, dwc->gadget, dwc_gadget_release);
42474247
dev = &dwc->gadget->dev;
42484248
dev->platform_data = dwc;
42494249
dwc->gadget->ops = &dwc3_gadget_ops;

drivers/usb/gadget/function/f_uac2.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -674,11 +674,17 @@ static int set_ep_max_packet_size(const struct f_uac2_opts *uac2_opts,
674674
ssize = uac2_opts->c_ssize;
675675
}
676676

677-
if (!is_playback && (uac2_opts->c_sync == USB_ENDPOINT_SYNC_ASYNC))
677+
if (!is_playback && (uac2_opts->c_sync == USB_ENDPOINT_SYNC_ASYNC)) {
678+
// Win10 requires max packet size + 1 frame
678679
srate = srate * (1000 + uac2_opts->fb_max) / 1000;
679-
680-
max_size_bw = num_channels(chmask) * ssize *
681-
DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1)));
680+
// updated srate is always bigger, therefore DIV_ROUND_UP always yields +1
681+
max_size_bw = num_channels(chmask) * ssize *
682+
(DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1))));
683+
} else {
684+
// adding 1 frame provision for Win10
685+
max_size_bw = num_channels(chmask) * ssize *
686+
(DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1))) + 1);
687+
}
682688
ep_desc->wMaxPacketSize = cpu_to_le16(min_t(u16, max_size_bw,
683689
max_size_ep));
684690

drivers/usb/host/xhci-tegra.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,7 +1787,6 @@ static int tegra_xusb_remove(struct platform_device *pdev)
17871787
return 0;
17881788
}
17891789

1790-
#if IS_ENABLED(CONFIG_PM) || IS_ENABLED(CONFIG_PM_SLEEP)
17911790
static bool xhci_hub_ports_suspended(struct xhci_hub *hub)
17921791
{
17931792
struct device *dev = hub->hcd->self.controller;
@@ -2102,7 +2101,7 @@ static int tegra_xusb_exit_elpg(struct tegra_xusb *tegra, bool runtime)
21022101
return err;
21032102
}
21042103

2105-
static int tegra_xusb_suspend(struct device *dev)
2104+
static __maybe_unused int tegra_xusb_suspend(struct device *dev)
21062105
{
21072106
struct tegra_xusb *tegra = dev_get_drvdata(dev);
21082107
int err;
@@ -2144,7 +2143,7 @@ static int tegra_xusb_suspend(struct device *dev)
21442143
return err;
21452144
}
21462145

2147-
static int tegra_xusb_resume(struct device *dev)
2146+
static __maybe_unused int tegra_xusb_resume(struct device *dev)
21482147
{
21492148
struct tegra_xusb *tegra = dev_get_drvdata(dev);
21502149
int err;
@@ -2174,10 +2173,8 @@ static int tegra_xusb_resume(struct device *dev)
21742173

21752174
return 0;
21762175
}
2177-
#endif
21782176

2179-
#ifdef CONFIG_PM
2180-
static int tegra_xusb_runtime_suspend(struct device *dev)
2177+
static __maybe_unused int tegra_xusb_runtime_suspend(struct device *dev)
21812178
{
21822179
struct tegra_xusb *tegra = dev_get_drvdata(dev);
21832180
int ret;
@@ -2190,7 +2187,7 @@ static int tegra_xusb_runtime_suspend(struct device *dev)
21902187
return ret;
21912188
}
21922189

2193-
static int tegra_xusb_runtime_resume(struct device *dev)
2190+
static __maybe_unused int tegra_xusb_runtime_resume(struct device *dev)
21942191
{
21952192
struct tegra_xusb *tegra = dev_get_drvdata(dev);
21962193
int err;
@@ -2201,7 +2198,6 @@ static int tegra_xusb_runtime_resume(struct device *dev)
22012198

22022199
return err;
22032200
}
2204-
#endif
22052201

22062202
static const struct dev_pm_ops tegra_xusb_pm_ops = {
22072203
SET_RUNTIME_PM_OPS(tegra_xusb_runtime_suspend,

drivers/usb/typec/tcpm/tcpci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ irqreturn_t tcpci_irq(struct tcpci *tcpci)
696696
tcpm_pd_receive(tcpci->port, &msg);
697697
}
698698

699-
if (status & TCPC_ALERT_EXTENDED_STATUS) {
699+
if (tcpci->data->vbus_vsafe0v && (status & TCPC_ALERT_EXTENDED_STATUS)) {
700700
ret = regmap_read(tcpci->regmap, TCPC_EXTENDED_STATUS, &raw);
701701
if (!ret && (raw & TCPC_EXTENDED_STATUS_VSAFE0V))
702702
tcpm_vbus_change(tcpci->port);

drivers/usb/typec/tcpm/tcpm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4876,6 +4876,7 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1,
48764876
tcpm_set_state(port, SRC_ATTACH_WAIT, 0);
48774877
break;
48784878
case SRC_ATTACHED:
4879+
case SRC_STARTUP:
48794880
case SRC_SEND_CAPABILITIES:
48804881
case SRC_READY:
48814882
if (tcpm_port_is_disconnected(port) ||

drivers/usb/typec/tipd/core.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -625,18 +625,16 @@ static int tps6598x_probe(struct i2c_client *client)
625625
if (ret < 0)
626626
return ret;
627627

628-
fwnode = device_get_named_child_node(&client->dev, "connector");
629-
if (!fwnode)
630-
return -ENODEV;
631-
632628
/*
633629
* This fwnode has a "compatible" property, but is never populated as a
634630
* struct device. Instead we simply parse it to read the properties.
635631
* This breaks fw_devlink=on. To maintain backward compatibility
636632
* with existing DT files, we work around this by deleting any
637633
* fwnode_links to/from this fwnode.
638634
*/
639-
fw_devlink_purge_absent_suppliers(fwnode);
635+
fwnode = device_get_named_child_node(&client->dev, "connector");
636+
if (fwnode)
637+
fw_devlink_purge_absent_suppliers(fwnode);
640638

641639
tps->role_sw = fwnode_usb_role_switch_get(fwnode);
642640
if (IS_ERR(tps->role_sw)) {

0 commit comments

Comments
 (0)