Skip to content

Commit 1163d50

Browse files
committed
Merge tag 'usb-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here's a round of USB fixes for 4.0-rc3. Nothing major, the usual gadget, xhci and usb-serial fixes and a few new device ids as well. All have been in linux-next successfully" * tag 'usb-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (36 commits) xhci: Workaround for PME stuck issues in Intel xhci xhci: fix reporting of 0-sized URBs in control endpoint usb: ftdi_sio: Add jtag quirk support for Cyber Cortex AV boards USB: ch341: set tty baud speed according to tty struct USB: serial: cp210x: Adding Seletek device id's USB: pl2303: disable break on shutdown USB: mxuport: fix null deref when used as a console USB: serial: clean up bus probe error handling USB: serial: fix port attribute-creation race USB: serial: fix tty-device error handling at probe USB: serial: fix potential use-after-free after failed probe USB: console: add dummy __module_get USB: ftdi_sio: add PIDs for Actisense USB devices Revert "USB: serial: make bulk_out_size a lower limit" cdc-acm: Add support for Denso cradle CU-321 usb-storage: support for more than 8 LUNs uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS539 USB: usbfs: don't leak kernel data in siginfo xhci: Clear the host side toggle manually when endpoint is 'soft reset' xhci: Allocate correct amount of scratchpad buffers ...
2 parents bbbce51 + b8cb91e commit 1163d50

34 files changed

+374
-109
lines changed

drivers/usb/class/cdc-acm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,6 +1650,8 @@ static int acm_reset_resume(struct usb_interface *intf)
16501650

16511651
static const struct usb_device_id acm_ids[] = {
16521652
/* quirky and broken devices */
1653+
{ USB_DEVICE(0x076d, 0x0006), /* Denso Cradle CU-321 */
1654+
.driver_info = NO_UNION_NORMAL, },/* has no union descriptor */
16531655
{ USB_DEVICE(0x17ef, 0x7000), /* Lenovo USB modem */
16541656
.driver_info = NO_UNION_NORMAL, },/* has no union descriptor */
16551657
{ USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */

drivers/usb/core/devio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ static void async_completed(struct urb *urb)
501501
as->status = urb->status;
502502
signr = as->signr;
503503
if (signr) {
504+
memset(&sinfo, 0, sizeof(sinfo));
504505
sinfo.si_signo = as->signr;
505506
sinfo.si_errno = as->status;
506507
sinfo.si_code = SI_ASYNCIO;
@@ -2382,6 +2383,7 @@ static void usbdev_remove(struct usb_device *udev)
23822383
wake_up_all(&ps->wait);
23832384
list_del_init(&ps->list);
23842385
if (ps->discsignr) {
2386+
memset(&sinfo, 0, sizeof(sinfo));
23852387
sinfo.si_signo = ps->discsignr;
23862388
sinfo.si_errno = EPIPE;
23872389
sinfo.si_code = SI_ASYNCIO;

drivers/usb/dwc3/dwc3-omap.c

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,18 @@ static void dwc3_omap_write_irq0_set(struct dwc3_omap *omap, u32 value)
205205
omap->irq0_offset, value);
206206
}
207207

208+
static void dwc3_omap_write_irqmisc_clr(struct dwc3_omap *omap, u32 value)
209+
{
210+
dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_CLR_MISC +
211+
omap->irqmisc_offset, value);
212+
}
213+
214+
static void dwc3_omap_write_irq0_clr(struct dwc3_omap *omap, u32 value)
215+
{
216+
dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_CLR_0 -
217+
omap->irq0_offset, value);
218+
}
219+
208220
static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,
209221
enum omap_dwc3_vbus_id_status status)
210222
{
@@ -345,9 +357,23 @@ static void dwc3_omap_enable_irqs(struct dwc3_omap *omap)
345357

346358
static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
347359
{
360+
u32 reg;
361+
348362
/* disable all IRQs */
349-
dwc3_omap_write_irqmisc_set(omap, 0x00);
350-
dwc3_omap_write_irq0_set(omap, 0x00);
363+
reg = USBOTGSS_IRQO_COREIRQ_ST;
364+
dwc3_omap_write_irq0_clr(omap, reg);
365+
366+
reg = (USBOTGSS_IRQMISC_OEVT |
367+
USBOTGSS_IRQMISC_DRVVBUS_RISE |
368+
USBOTGSS_IRQMISC_CHRGVBUS_RISE |
369+
USBOTGSS_IRQMISC_DISCHRGVBUS_RISE |
370+
USBOTGSS_IRQMISC_IDPULLUP_RISE |
371+
USBOTGSS_IRQMISC_DRVVBUS_FALL |
372+
USBOTGSS_IRQMISC_CHRGVBUS_FALL |
373+
USBOTGSS_IRQMISC_DISCHRGVBUS_FALL |
374+
USBOTGSS_IRQMISC_IDPULLUP_FALL);
375+
376+
dwc3_omap_write_irqmisc_clr(omap, reg);
351377
}
352378

353379
static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);

drivers/usb/gadget/configfs.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,6 @@ static ssize_t interf_grp_compatible_id_store(struct usb_os_desc *desc,
11611161
if (desc->opts_mutex)
11621162
mutex_lock(desc->opts_mutex);
11631163
memcpy(desc->ext_compat_id, page, l);
1164-
desc->ext_compat_id[l] = '\0';
11651164

11661165
if (desc->opts_mutex)
11671166
mutex_unlock(desc->opts_mutex);
@@ -1192,7 +1191,6 @@ static ssize_t interf_grp_sub_compatible_id_store(struct usb_os_desc *desc,
11921191
if (desc->opts_mutex)
11931192
mutex_lock(desc->opts_mutex);
11941193
memcpy(desc->ext_compat_id + 8, page, l);
1195-
desc->ext_compat_id[l + 8] = '\0';
11961194

11971195
if (desc->opts_mutex)
11981196
mutex_unlock(desc->opts_mutex);

drivers/usb/gadget/function/f_hid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ static int hidg_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
569569
return status;
570570
}
571571

572-
const struct file_operations f_hidg_fops = {
572+
static const struct file_operations f_hidg_fops = {
573573
.owner = THIS_MODULE,
574574
.open = f_hidg_open,
575575
.release = f_hidg_release,

drivers/usb/gadget/function/f_phonet.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,10 @@ static int pn_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
417417
return -EINVAL;
418418

419419
spin_lock(&port->lock);
420-
__pn_reset(f);
420+
421+
if (fp->in_ep->driver_data)
422+
__pn_reset(f);
423+
421424
if (alt == 1) {
422425
int i;
423426

drivers/usb/gadget/function/f_sourcesink.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ static struct usb_endpoint_descriptor ss_int_source_desc = {
344344
.bInterval = USB_MS_TO_SS_INTERVAL(GZERO_INT_INTERVAL),
345345
};
346346

347-
struct usb_ss_ep_comp_descriptor ss_int_source_comp_desc = {
347+
static struct usb_ss_ep_comp_descriptor ss_int_source_comp_desc = {
348348
.bLength = USB_DT_SS_EP_COMP_SIZE,
349349
.bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
350350

@@ -362,7 +362,7 @@ static struct usb_endpoint_descriptor ss_int_sink_desc = {
362362
.bInterval = USB_MS_TO_SS_INTERVAL(GZERO_INT_INTERVAL),
363363
};
364364

365-
struct usb_ss_ep_comp_descriptor ss_int_sink_comp_desc = {
365+
static struct usb_ss_ep_comp_descriptor ss_int_sink_comp_desc = {
366366
.bLength = USB_DT_SS_EP_COMP_SIZE,
367367
.bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
368368

drivers/usb/gadget/function/f_uac2.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#define UNFLW_CTRL 8
5555
#define OVFLW_CTRL 10
5656

57-
const char *uac2_name = "snd_uac2";
57+
static const char *uac2_name = "snd_uac2";
5858

5959
struct uac2_req {
6060
struct uac2_rtd_params *pp; /* parent param */
@@ -634,7 +634,7 @@ static struct usb_interface_descriptor std_ac_if_desc = {
634634
};
635635

636636
/* Clock source for IN traffic */
637-
struct uac_clock_source_descriptor in_clk_src_desc = {
637+
static struct uac_clock_source_descriptor in_clk_src_desc = {
638638
.bLength = sizeof in_clk_src_desc,
639639
.bDescriptorType = USB_DT_CS_INTERFACE,
640640

@@ -646,7 +646,7 @@ struct uac_clock_source_descriptor in_clk_src_desc = {
646646
};
647647

648648
/* Clock source for OUT traffic */
649-
struct uac_clock_source_descriptor out_clk_src_desc = {
649+
static struct uac_clock_source_descriptor out_clk_src_desc = {
650650
.bLength = sizeof out_clk_src_desc,
651651
.bDescriptorType = USB_DT_CS_INTERFACE,
652652

@@ -658,7 +658,7 @@ struct uac_clock_source_descriptor out_clk_src_desc = {
658658
};
659659

660660
/* Input Terminal for USB_OUT */
661-
struct uac2_input_terminal_descriptor usb_out_it_desc = {
661+
static struct uac2_input_terminal_descriptor usb_out_it_desc = {
662662
.bLength = sizeof usb_out_it_desc,
663663
.bDescriptorType = USB_DT_CS_INTERFACE,
664664

@@ -672,7 +672,7 @@ struct uac2_input_terminal_descriptor usb_out_it_desc = {
672672
};
673673

674674
/* Input Terminal for I/O-In */
675-
struct uac2_input_terminal_descriptor io_in_it_desc = {
675+
static struct uac2_input_terminal_descriptor io_in_it_desc = {
676676
.bLength = sizeof io_in_it_desc,
677677
.bDescriptorType = USB_DT_CS_INTERFACE,
678678

@@ -686,7 +686,7 @@ struct uac2_input_terminal_descriptor io_in_it_desc = {
686686
};
687687

688688
/* Ouput Terminal for USB_IN */
689-
struct uac2_output_terminal_descriptor usb_in_ot_desc = {
689+
static struct uac2_output_terminal_descriptor usb_in_ot_desc = {
690690
.bLength = sizeof usb_in_ot_desc,
691691
.bDescriptorType = USB_DT_CS_INTERFACE,
692692

@@ -700,7 +700,7 @@ struct uac2_output_terminal_descriptor usb_in_ot_desc = {
700700
};
701701

702702
/* Ouput Terminal for I/O-Out */
703-
struct uac2_output_terminal_descriptor io_out_ot_desc = {
703+
static struct uac2_output_terminal_descriptor io_out_ot_desc = {
704704
.bLength = sizeof io_out_ot_desc,
705705
.bDescriptorType = USB_DT_CS_INTERFACE,
706706

@@ -713,7 +713,7 @@ struct uac2_output_terminal_descriptor io_out_ot_desc = {
713713
.bmControls = (CONTROL_RDWR << COPY_CTRL),
714714
};
715715

716-
struct uac2_ac_header_descriptor ac_hdr_desc = {
716+
static struct uac2_ac_header_descriptor ac_hdr_desc = {
717717
.bLength = sizeof ac_hdr_desc,
718718
.bDescriptorType = USB_DT_CS_INTERFACE,
719719

@@ -751,7 +751,7 @@ static struct usb_interface_descriptor std_as_out_if1_desc = {
751751
};
752752

753753
/* Audio Stream OUT Intface Desc */
754-
struct uac2_as_header_descriptor as_out_hdr_desc = {
754+
static struct uac2_as_header_descriptor as_out_hdr_desc = {
755755
.bLength = sizeof as_out_hdr_desc,
756756
.bDescriptorType = USB_DT_CS_INTERFACE,
757757

@@ -764,15 +764,15 @@ struct uac2_as_header_descriptor as_out_hdr_desc = {
764764
};
765765

766766
/* Audio USB_OUT Format */
767-
struct uac2_format_type_i_descriptor as_out_fmt1_desc = {
767+
static struct uac2_format_type_i_descriptor as_out_fmt1_desc = {
768768
.bLength = sizeof as_out_fmt1_desc,
769769
.bDescriptorType = USB_DT_CS_INTERFACE,
770770
.bDescriptorSubtype = UAC_FORMAT_TYPE,
771771
.bFormatType = UAC_FORMAT_TYPE_I,
772772
};
773773

774774
/* STD AS ISO OUT Endpoint */
775-
struct usb_endpoint_descriptor fs_epout_desc = {
775+
static struct usb_endpoint_descriptor fs_epout_desc = {
776776
.bLength = USB_DT_ENDPOINT_SIZE,
777777
.bDescriptorType = USB_DT_ENDPOINT,
778778

@@ -782,7 +782,7 @@ struct usb_endpoint_descriptor fs_epout_desc = {
782782
.bInterval = 1,
783783
};
784784

785-
struct usb_endpoint_descriptor hs_epout_desc = {
785+
static struct usb_endpoint_descriptor hs_epout_desc = {
786786
.bLength = USB_DT_ENDPOINT_SIZE,
787787
.bDescriptorType = USB_DT_ENDPOINT,
788788

@@ -828,7 +828,7 @@ static struct usb_interface_descriptor std_as_in_if1_desc = {
828828
};
829829

830830
/* Audio Stream IN Intface Desc */
831-
struct uac2_as_header_descriptor as_in_hdr_desc = {
831+
static struct uac2_as_header_descriptor as_in_hdr_desc = {
832832
.bLength = sizeof as_in_hdr_desc,
833833
.bDescriptorType = USB_DT_CS_INTERFACE,
834834

@@ -841,15 +841,15 @@ struct uac2_as_header_descriptor as_in_hdr_desc = {
841841
};
842842

843843
/* Audio USB_IN Format */
844-
struct uac2_format_type_i_descriptor as_in_fmt1_desc = {
844+
static struct uac2_format_type_i_descriptor as_in_fmt1_desc = {
845845
.bLength = sizeof as_in_fmt1_desc,
846846
.bDescriptorType = USB_DT_CS_INTERFACE,
847847
.bDescriptorSubtype = UAC_FORMAT_TYPE,
848848
.bFormatType = UAC_FORMAT_TYPE_I,
849849
};
850850

851851
/* STD AS ISO IN Endpoint */
852-
struct usb_endpoint_descriptor fs_epin_desc = {
852+
static struct usb_endpoint_descriptor fs_epin_desc = {
853853
.bLength = USB_DT_ENDPOINT_SIZE,
854854
.bDescriptorType = USB_DT_ENDPOINT,
855855

@@ -859,7 +859,7 @@ struct usb_endpoint_descriptor fs_epin_desc = {
859859
.bInterval = 1,
860860
};
861861

862-
struct usb_endpoint_descriptor hs_epin_desc = {
862+
static struct usb_endpoint_descriptor hs_epin_desc = {
863863
.bLength = USB_DT_ENDPOINT_SIZE,
864864
.bDescriptorType = USB_DT_ENDPOINT,
865865

@@ -1563,7 +1563,7 @@ static void afunc_unbind(struct usb_configuration *c, struct usb_function *f)
15631563
agdev->out_ep->driver_data = NULL;
15641564
}
15651565

1566-
struct usb_function *afunc_alloc(struct usb_function_instance *fi)
1566+
static struct usb_function *afunc_alloc(struct usb_function_instance *fi)
15671567
{
15681568
struct audio_dev *agdev;
15691569
struct f_uac2_opts *opts;

drivers/usb/gadget/function/uvc_v4l2.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "uvc.h"
2828
#include "uvc_queue.h"
2929
#include "uvc_video.h"
30+
#include "uvc_v4l2.h"
3031

3132
/* --------------------------------------------------------------------------
3233
* Requests handling

drivers/usb/gadget/function/uvc_video.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "uvc.h"
2323
#include "uvc_queue.h"
24+
#include "uvc_video.h"
2425

2526
/* --------------------------------------------------------------------------
2627
* Video codecs

drivers/usb/gadget/legacy/g_ffs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ struct gfs_configuration {
133133
struct usb_configuration c;
134134
int (*eth)(struct usb_configuration *c);
135135
int num;
136-
} gfs_configurations[] = {
136+
};
137+
138+
static struct gfs_configuration gfs_configurations[] = {
137139
#ifdef CONFIG_USB_FUNCTIONFS_RNDIS
138140
{
139141
.eth = bind_rndis_config,
@@ -278,7 +280,7 @@ static void *functionfs_acquire_dev(struct ffs_dev *dev)
278280
if (!try_module_get(THIS_MODULE))
279281
return ERR_PTR(-ENOENT);
280282

281-
return 0;
283+
return NULL;
282284
}
283285

284286
static void functionfs_release_dev(struct ffs_dev *dev)

drivers/usb/host/xhci-pci.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737

3838
#define PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI 0x8c31
3939
#define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI 0x9c31
40+
#define PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI 0x22b5
41+
#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI 0xa12f
42+
#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI 0x9d2f
4043

4144
static const char hcd_name[] = "xhci_hcd";
4245

@@ -133,6 +136,12 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
133136
pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) {
134137
xhci->quirks |= XHCI_SPURIOUS_REBOOT;
135138
}
139+
if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
140+
(pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI ||
141+
pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI ||
142+
pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI)) {
143+
xhci->quirks |= XHCI_PME_STUCK_QUIRK;
144+
}
136145
if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
137146
pdev->device == PCI_DEVICE_ID_EJ168) {
138147
xhci->quirks |= XHCI_RESET_ON_RESUME;
@@ -159,6 +168,21 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
159168
"QUIRK: Resetting on resume");
160169
}
161170

171+
/*
172+
* Make sure PME works on some Intel xHCI controllers by writing 1 to clear
173+
* the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4
174+
*/
175+
static void xhci_pme_quirk(struct xhci_hcd *xhci)
176+
{
177+
u32 val;
178+
void __iomem *reg;
179+
180+
reg = (void __iomem *) xhci->cap_regs + 0x80a4;
181+
val = readl(reg);
182+
writel(val | BIT(28), reg);
183+
readl(reg);
184+
}
185+
162186
/* called during probe() after chip reset completes */
163187
static int xhci_pci_setup(struct usb_hcd *hcd)
164188
{
@@ -283,6 +307,9 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
283307
if (xhci->quirks & XHCI_COMP_MODE_QUIRK)
284308
pdev->no_d3cold = true;
285309

310+
if (xhci->quirks & XHCI_PME_STUCK_QUIRK)
311+
xhci_pme_quirk(xhci);
312+
286313
return xhci_suspend(xhci, do_wakeup);
287314
}
288315

@@ -313,6 +340,9 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
313340
if (pdev->vendor == PCI_VENDOR_ID_INTEL)
314341
usb_enable_intel_xhci_ports(pdev);
315342

343+
if (xhci->quirks & XHCI_PME_STUCK_QUIRK)
344+
xhci_pme_quirk(xhci);
345+
316346
retval = xhci_resume(xhci, hibernated);
317347
return retval;
318348
}

0 commit comments

Comments
 (0)