make use of the previously introduced gadget->status field. NYET-Signed-off-by: Felipe Balbi <balbi@xxxxxx> --- drivers/usb/dwc3/ep0.c | 17 +++++++++++++---- drivers/usb/dwc3/gadget.c | 3 +++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 2f51de5..45ba745 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -443,10 +443,13 @@ static int dwc3_ep0_set_address(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) reg |= DWC3_DCFG_DEVADDR(addr); dwc3_writel(dwc->regs, DWC3_DCFG, reg); - if (addr) + if (addr) { dwc->dev_state = DWC3_ADDRESS_STATE; - else + usb_gadget_set_status(&dwc->gadget, USB_STATUS_ADDRESSED); + } else { dwc->dev_state = DWC3_DEFAULT_STATE; + usb_gadget_set_status(&dwc->gadget, USB_STATUS_DEFAULT); + } return 0; } @@ -477,14 +480,20 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) case DWC3_ADDRESS_STATE: ret = dwc3_ep0_delegate_req(dwc, ctrl); /* if the cfg matches and the cfg is non zero */ - if (!ret && cfg) + if (!ret && cfg) { dwc->dev_state = DWC3_CONFIGURED_STATE; + usb_gadget_set_status(&dwc->gadget, + USB_STATUS_CONFIGURED); + } break; case DWC3_CONFIGURED_STATE: ret = dwc3_ep0_delegate_req(dwc, ctrl); - if (!cfg) + if (!cfg) { dwc->dev_state = DWC3_ADDRESS_STATE; + usb_gadget_set_status(&dwc->gadget, + USB_STATUS_ADDRESSED); + } break; default: ret = -EINVAL; diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index ac31771..65d27e0 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1706,6 +1706,8 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) dev_vdbg(dwc->dev, "%s\n", __func__); + usb_gadget_set_status(&dwc->gadget, USB_STATUS_RESETTING); + /* * WORKAROUND: DWC3 revisions <1.88a have an issue which * would cause a missing Disconnect Event if there's a @@ -1806,6 +1808,7 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc) u8 speed; dev_vdbg(dwc->dev, "%s\n", __func__); + usb_gadget_set_status(&dwc->gadget, USB_STATUS_DEFAULT); memset(¶ms, 0x00, sizeof(params)); -- 1.7.8.rc3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html