]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
usb: dwc3: gadget: remove redundant otg checks from dwc3_gadget_init()
authorAnurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Sat, 30 Mar 2019 10:23:15 +0000 (10:23 +0000)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 3 Apr 2019 08:31:22 +0000 (10:31 +0200)
otg_set_peripheral() is getting called from dwc3_gadget_init()
at the end, remove the redundant code

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/usb/dwc3/gadget.c

index 2d31b7e93449fa6341b6d49306a4d03a89fc0bd8..e1794de6e89bc3acc087a6d165bf77029c9dfbcd 100644 (file)
@@ -3364,19 +3364,6 @@ int dwc3_gadget_init(struct dwc3 *dwc)
                goto err0;
        }
 
-       if (dwc->dr_mode == USB_DR_MODE_OTG) {
-               struct usb_phy *phy;
-
-               /* Switch otg to peripheral mode */
-               phy = usb_get_phy(USB_PHY_TYPE_USB3);
-               if (!IS_ERR(phy)) {
-                       if (phy && phy->otg)
-                               otg_set_peripheral(phy->otg,
-                                               (struct usb_gadget *)(long)1);
-                       usb_put_phy(phy);
-               }
-       }
-
        dwc->ep0_trb = dma_alloc_coherent(dwc->sysdev,
                                          sizeof(*dwc->ep0_trb) * 2,
                                          &dwc->ep0_trb_addr, GFP_KERNEL);
@@ -3452,11 +3439,10 @@ int dwc3_gadget_init(struct dwc3 *dwc)
                if (!IS_ERR(phy)) {
                        if (phy && phy->otg) {
                                ret = otg_set_peripheral(phy->otg,
-                                               &dwc->gadget);
+                                                        &dwc->gadget);
                                if (ret) {
                                        dev_err(dwc->dev,
-                                       "%s otg_set_peripheral failed\n",
-                                                       __func__);
+                                               "otg_set_peripheral failed\n");
                                        usb_put_phy(phy);
                                        phy = NULL;
                                        goto err4;