Skip to content

Commit b07c2e7

Browse files
committed
Merge tag 'usb-5.6-rc7' 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.6-rc7. And there's a thunderbolt driver fix thrown in for good measure as well. These fixes are: - new device ids for usb-serial drivers - thunderbolt error code fix - xhci driver fixes - typec fixes - cdc-acm driver fixes - chipidea driver fix - more USB quirks added for devices that need them. All of these have been in linux-next with no reported issues" * tag 'usb-5.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: USB: cdc-acm: fix rounding error in TIOCSSERIAL USB: cdc-acm: fix close_delay and closing_wait units in TIOCSSERIAL usb: quirks: add NO_LPM quirk for RTL8153 based ethernet adapters usb: chipidea: udc: fix sleeping function called from invalid context USB: serial: pl2303: add device-id for HP LD381 USB: serial: option: add ME910G1 ECM composition 0x110b usb: host: xhci-plat: add a shutdown usb: typec: ucsi: displayport: Fix a potential race during registration usb: typec: ucsi: displayport: Fix NULL pointer dereference USB: Disable LPM on WD19's Realtek Hub usb: xhci: apply XHCI_SUSPEND_DELAY to AMD XHCI controller 1022:145c xhci: Do not open code __print_symbolic() in xhci trace events thunderbolt: Fix error code in tb_port_is_width_supported()
2 parents fa91418 + 2866ce8 commit b07c2e7

File tree

11 files changed

+56
-36
lines changed

11 files changed

+56
-36
lines changed

drivers/thunderbolt/switch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ static bool tb_port_is_width_supported(struct tb_port *port, int width)
954954
ret = tb_port_read(port, &phy, TB_CFG_PORT,
955955
port->cap_phy + LANE_ADP_CS_0, 1);
956956
if (ret)
957-
return ret;
957+
return false;
958958

959959
widths = (phy & LANE_ADP_CS_0_SUPPORTED_WIDTH_MASK) >>
960960
LANE_ADP_CS_0_SUPPORTED_WIDTH_SHIFT;

drivers/usb/chipidea/udc.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,18 +1530,19 @@ static const struct usb_ep_ops usb_ep_ops = {
15301530
static void ci_hdrc_gadget_connect(struct usb_gadget *_gadget, int is_active)
15311531
{
15321532
struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
1533-
unsigned long flags;
15341533

15351534
if (is_active) {
15361535
pm_runtime_get_sync(&_gadget->dev);
15371536
hw_device_reset(ci);
1538-
spin_lock_irqsave(&ci->lock, flags);
1537+
spin_lock_irq(&ci->lock);
15391538
if (ci->driver) {
15401539
hw_device_state(ci, ci->ep0out->qh.dma);
15411540
usb_gadget_set_state(_gadget, USB_STATE_POWERED);
1541+
spin_unlock_irq(&ci->lock);
15421542
usb_udc_vbus_handler(_gadget, true);
1543+
} else {
1544+
spin_unlock_irq(&ci->lock);
15431545
}
1544-
spin_unlock_irqrestore(&ci->lock, flags);
15451546
} else {
15461547
usb_udc_vbus_handler(_gadget, false);
15471548
if (ci->driver)

drivers/usb/class/cdc-acm.c

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -896,35 +896,43 @@ static int get_serial_info(struct tty_struct *tty, struct serial_struct *ss)
896896

897897
ss->xmit_fifo_size = acm->writesize;
898898
ss->baud_base = le32_to_cpu(acm->line.dwDTERate);
899-
ss->close_delay = acm->port.close_delay / 10;
899+
ss->close_delay = jiffies_to_msecs(acm->port.close_delay) / 10;
900900
ss->closing_wait = acm->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ?
901901
ASYNC_CLOSING_WAIT_NONE :
902-
acm->port.closing_wait / 10;
902+
jiffies_to_msecs(acm->port.closing_wait) / 10;
903903
return 0;
904904
}
905905

906906
static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss)
907907
{
908908
struct acm *acm = tty->driver_data;
909909
unsigned int closing_wait, close_delay;
910+
unsigned int old_closing_wait, old_close_delay;
910911
int retval = 0;
911912

912-
close_delay = ss->close_delay * 10;
913+
close_delay = msecs_to_jiffies(ss->close_delay * 10);
913914
closing_wait = ss->closing_wait == ASYNC_CLOSING_WAIT_NONE ?
914-
ASYNC_CLOSING_WAIT_NONE : ss->closing_wait * 10;
915+
ASYNC_CLOSING_WAIT_NONE :
916+
msecs_to_jiffies(ss->closing_wait * 10);
917+
918+
/* we must redo the rounding here, so that the values match */
919+
old_close_delay = jiffies_to_msecs(acm->port.close_delay) / 10;
920+
old_closing_wait = acm->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ?
921+
ASYNC_CLOSING_WAIT_NONE :
922+
jiffies_to_msecs(acm->port.closing_wait) / 10;
915923

916924
mutex_lock(&acm->port.mutex);
917925

918-
if (!capable(CAP_SYS_ADMIN)) {
919-
if ((close_delay != acm->port.close_delay) ||
920-
(closing_wait != acm->port.closing_wait))
926+
if ((ss->close_delay != old_close_delay) ||
927+
(ss->closing_wait != old_closing_wait)) {
928+
if (!capable(CAP_SYS_ADMIN))
921929
retval = -EPERM;
922-
else
923-
retval = -EOPNOTSUPP;
924-
} else {
925-
acm->port.close_delay = close_delay;
926-
acm->port.closing_wait = closing_wait;
927-
}
930+
else {
931+
acm->port.close_delay = close_delay;
932+
acm->port.closing_wait = closing_wait;
933+
}
934+
} else
935+
retval = -EOPNOTSUPP;
928936

929937
mutex_unlock(&acm->port.mutex);
930938
return retval;

drivers/usb/core/quirks.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,12 @@ static const struct usb_device_id usb_quirk_list[] = {
378378
{ USB_DEVICE(0x0b05, 0x17e0), .driver_info =
379379
USB_QUIRK_IGNORE_REMOTE_WAKEUP },
380380

381+
/* Realtek hub in Dell WD19 (Type-C) */
382+
{ USB_DEVICE(0x0bda, 0x0487), .driver_info = USB_QUIRK_NO_LPM },
383+
384+
/* Generic RTL8153 based ethernet adapters */
385+
{ USB_DEVICE(0x0bda, 0x8153), .driver_info = USB_QUIRK_NO_LPM },
386+
381387
/* Action Semiconductor flash disk */
382388
{ USB_DEVICE(0x10d6, 0x2200), .driver_info =
383389
USB_QUIRK_STRING_FETCH_255 },

drivers/usb/host/xhci-pci.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
136136
xhci->quirks |= XHCI_AMD_PLL_FIX;
137137

138138
if (pdev->vendor == PCI_VENDOR_ID_AMD &&
139-
(pdev->device == 0x15e0 ||
139+
(pdev->device == 0x145c ||
140+
pdev->device == 0x15e0 ||
140141
pdev->device == 0x15e1 ||
141142
pdev->device == 0x43bb))
142143
xhci->quirks |= XHCI_SUSPEND_DELAY;

drivers/usb/host/xhci-plat.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match);
445445
static struct platform_driver usb_xhci_driver = {
446446
.probe = xhci_plat_probe,
447447
.remove = xhci_plat_remove,
448+
.shutdown = usb_hcd_platform_shutdown,
448449
.driver = {
449450
.name = "xhci-hcd",
450451
.pm = &xhci_plat_pm_ops,

drivers/usb/host/xhci-trace.h

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -289,23 +289,12 @@ DECLARE_EVENT_CLASS(xhci_log_urb,
289289
),
290290
TP_printk("ep%d%s-%s: urb %p pipe %u slot %d length %d/%d sgs %d/%d stream %d flags %08x",
291291
__entry->epnum, __entry->dir_in ? "in" : "out",
292-
({ char *s;
293-
switch (__entry->type) {
294-
case USB_ENDPOINT_XFER_INT:
295-
s = "intr";
296-
break;
297-
case USB_ENDPOINT_XFER_CONTROL:
298-
s = "control";
299-
break;
300-
case USB_ENDPOINT_XFER_BULK:
301-
s = "bulk";
302-
break;
303-
case USB_ENDPOINT_XFER_ISOC:
304-
s = "isoc";
305-
break;
306-
default:
307-
s = "UNKNOWN";
308-
} s; }), __entry->urb, __entry->pipe, __entry->slot_id,
292+
__print_symbolic(__entry->type,
293+
{ USB_ENDPOINT_XFER_INT, "intr" },
294+
{ USB_ENDPOINT_XFER_CONTROL, "control" },
295+
{ USB_ENDPOINT_XFER_BULK, "bulk" },
296+
{ USB_ENDPOINT_XFER_ISOC, "isoc" }),
297+
__entry->urb, __entry->pipe, __entry->slot_id,
309298
__entry->actual, __entry->length, __entry->num_mapped_sgs,
310299
__entry->num_sgs, __entry->stream, __entry->flags
311300
)

drivers/usb/serial/option.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,8 @@ static const struct usb_device_id option_ids[] = {
11831183
.driver_info = NCTRL(0) },
11841184
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x110a, 0xff), /* Telit ME910G1 */
11851185
.driver_info = NCTRL(0) | RSVD(3) },
1186+
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x110b, 0xff), /* Telit ME910G1 (ECM) */
1187+
.driver_info = NCTRL(0) },
11861188
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910),
11871189
.driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
11881190
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4),

drivers/usb/serial/pl2303.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ static const struct usb_device_id id_table[] = {
9999
{ USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) },
100100
{ USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) },
101101
{ USB_DEVICE(HP_VENDOR_ID, HP_LD220TA_PRODUCT_ID) },
102+
{ USB_DEVICE(HP_VENDOR_ID, HP_LD381_PRODUCT_ID) },
102103
{ USB_DEVICE(HP_VENDOR_ID, HP_LD960_PRODUCT_ID) },
103104
{ USB_DEVICE(HP_VENDOR_ID, HP_LD960TA_PRODUCT_ID) },
104105
{ USB_DEVICE(HP_VENDOR_ID, HP_LCM220_PRODUCT_ID) },

drivers/usb/serial/pl2303.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
#define HP_LM920_PRODUCT_ID 0x026b
131131
#define HP_TD620_PRODUCT_ID 0x0956
132132
#define HP_LD960_PRODUCT_ID 0x0b39
133+
#define HP_LD381_PRODUCT_ID 0x0f7f
133134
#define HP_LCM220_PRODUCT_ID 0x3139
134135
#define HP_LCM960_PRODUCT_ID 0x3239
135136
#define HP_LD220_PRODUCT_ID 0x3524

drivers/usb/typec/ucsi/displayport.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ void ucsi_displayport_remove_partner(struct typec_altmode *alt)
271271
return;
272272

273273
dp = typec_altmode_get_drvdata(alt);
274+
if (!dp)
275+
return;
276+
274277
dp->data.conf = 0;
275278
dp->data.status = 0;
276279
dp->initialized = false;
@@ -285,6 +288,8 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con,
285288
struct typec_altmode *alt;
286289
struct ucsi_dp *dp;
287290

291+
mutex_lock(&con->lock);
292+
288293
/* We can't rely on the firmware with the capabilities. */
289294
desc->vdo |= DP_CAP_DP_SIGNALING | DP_CAP_RECEPTACLE;
290295

@@ -293,12 +298,15 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con,
293298
desc->vdo |= all_assignments << 16;
294299

295300
alt = typec_port_register_altmode(con->port, desc);
296-
if (IS_ERR(alt))
301+
if (IS_ERR(alt)) {
302+
mutex_unlock(&con->lock);
297303
return alt;
304+
}
298305

299306
dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL);
300307
if (!dp) {
301308
typec_unregister_altmode(alt);
309+
mutex_unlock(&con->lock);
302310
return ERR_PTR(-ENOMEM);
303311
}
304312

@@ -311,5 +319,7 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con,
311319
alt->ops = &ucsi_displayport_ops;
312320
typec_altmode_set_drvdata(alt, dp);
313321

322+
mutex_unlock(&con->lock);
323+
314324
return alt;
315325
}

0 commit comments

Comments
 (0)