Skip to content

Commit

Permalink
Merge tag 'fixes-for-v4.8-rc6' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/balbi/usb into usb-linus

Felipe writes:

usb: fixes for v4.8-rc6

Unfortunately we have a bogus dwc3 patch leaked through the cracks and
got merged into Linus' HEAD. That patch ended up causing off-by-1 error
in our TRB accounting logic. Thankfully John Youn found out the problem
and we provided a revert to the bogus dwc3 patch in no time.

Apart from this off-by-1 error, we have two fixes to the Renesas drivers,
a small fix to our generic phy driver, a NULL pointer dereference fix for
f_eem and a build warning fix in dwc3.
  • Loading branch information
Greg Kroah-Hartman committed Sep 9, 2016
2 parents 1b49dae + 696118c commit 6b98174
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 7 deletions.
4 changes: 3 additions & 1 deletion drivers/usb/dwc3/dwc3-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ static int dwc3_pci_runtime_resume(struct device *dev)

return pm_runtime_get(&dwc3->dev);
}
#endif /* CONFIG_PM */

#ifdef CONFIG_PM_SLEEP
static int dwc3_pci_pm_dummy(struct device *dev)
{
/*
Expand All @@ -262,7 +264,7 @@ static int dwc3_pci_pm_dummy(struct device *dev)
*/
return 0;
}
#endif /* CONFIG_PM */
#endif /* CONFIG_PM_SLEEP */

static struct dev_pm_ops dwc3_pci_dev_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(dwc3_pci_pm_dummy, dwc3_pci_pm_dummy)
Expand Down
5 changes: 4 additions & 1 deletion drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,9 +884,12 @@ static u32 dwc3_calc_trbs_left(struct dwc3_ep *dep)
return DWC3_TRB_NUM - 1;
}

trbs_left = dep->trb_dequeue - dep->trb_enqueue - 1;
trbs_left = dep->trb_dequeue - dep->trb_enqueue;
trbs_left &= (DWC3_TRB_NUM - 1);

if (dep->trb_dequeue < dep->trb_enqueue)
trbs_left--;

return trbs_left;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/function/f_eem.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ static struct sk_buff *eem_wrap(struct gether *port, struct sk_buff *skb)
struct sk_buff *skb2 = NULL;
struct usb_ep *in = port->in_ep;
int headroom, tailroom, padlen = 0;
u16 len = skb->len;
u16 len;

if (!skb)
return NULL;
Expand Down
2 changes: 2 additions & 0 deletions drivers/usb/gadget/udc/renesas_usb3.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@

/* DRD_CON */
#define DRD_CON_PERI_CON BIT(24)
#define DRD_CON_VBOUT BIT(0)

/* USB_INT_ENA_1 and USB_INT_STA_1 */
#define USB_INT_1_B3_PLLWKUP BIT(31)
Expand Down Expand Up @@ -363,6 +364,7 @@ static void usb3_init_epc_registers(struct renesas_usb3 *usb3)
{
/* FIXME: How to change host / peripheral mode as well? */
usb3_set_bit(usb3, DRD_CON_PERI_CON, USB3_DRD_CON);
usb3_clear_bit(usb3, DRD_CON_VBOUT, USB3_DRD_CON);

usb3_write(usb3, ~0, USB3_USB_INT_STA_1);
usb3_enable_irq_1(usb3, USB_INT_1_VBUS_CNG);
Expand Down
8 changes: 6 additions & 2 deletions drivers/usb/phy/phy-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,18 @@ static irqreturn_t nop_gpio_vbus_thread(int irq, void *data)
int usb_gen_phy_init(struct usb_phy *phy)
{
struct usb_phy_generic *nop = dev_get_drvdata(phy->dev);
int ret;

if (!IS_ERR(nop->vcc)) {
if (regulator_enable(nop->vcc))
dev_err(phy->dev, "Failed to enable power\n");
}

if (!IS_ERR(nop->clk))
clk_prepare_enable(nop->clk);
if (!IS_ERR(nop->clk)) {
ret = clk_prepare_enable(nop->clk);
if (ret)
return ret;
}

nop_reset(nop);

Expand Down
11 changes: 9 additions & 2 deletions drivers/usb/renesas_usbhs/mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,16 @@ static irqreturn_t usbhs_interrupt(int irq, void *data)
if (usbhs_mod_is_host(priv))
usbhs_write(priv, INTSTS1, ~irq_state.intsts1 & INTSTS1_MAGIC);

usbhs_write(priv, BRDYSTS, ~irq_state.brdysts);
/*
* The driver should not clear the xxxSTS after the line of
* "call irq callback functions" because each "if" statement is
* possible to call the callback function for avoiding any side effects.
*/
if (irq_state.intsts0 & BRDY)
usbhs_write(priv, BRDYSTS, ~irq_state.brdysts);
usbhs_write(priv, NRDYSTS, ~irq_state.nrdysts);
usbhs_write(priv, BEMPSTS, ~irq_state.bempsts);
if (irq_state.intsts0 & BEMP)
usbhs_write(priv, BEMPSTS, ~irq_state.bempsts);

/*
* call irq callback functions
Expand Down

0 comments on commit 6b98174

Please sign in to comment.