]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
usb: chipidea: Check usb_phy exists before using it
authorSubbaraya Sundeep Bhatta <subbaraya.sundeep.bhatta@xilinx.com>
Thu, 19 Nov 2015 18:24:52 +0000 (23:54 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 19 Nov 2015 19:12:09 +0000 (20:12 +0100)
usb_phy and usb_phy->set_vbus may not be present all the times
based on PHY driver used. So check for it.

Signed-off-by: Subbaraya Sundeep Bhatta <sbhatta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/usb/chipidea/host.c
drivers/usb/chipidea/otg_fsm.c

index b09fc86411f3345b6e3539f2365587007a787e89..fdb8ecaf8d7dd6112e83d60015fdeb01fe5632b8 100644 (file)
@@ -65,7 +65,8 @@ static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable)
                }
        }
 
-       if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL) {
+       if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL &&
+                       ci->usb_phy && ci->usb_phy->set_vbus) {
                if (enable)
                        ci->usb_phy->set_vbus(ci->usb_phy, 1);
                else
index 9eec64574c3f0b5bda4576c67d7abb86e31355c8..e98c3d6ffeb8fc3060a737e2aae9e2b05a7eb09c 100644 (file)
@@ -475,7 +475,8 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on)
                        }
                }
 
-               if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL)
+               if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL &&
+                               ci->usb_phy && ci->usb_phy->set_vbus)
                        ci->usb_phy->set_vbus(ci->usb_phy, 1);
 
                /* Disable data pulse irq */
@@ -487,7 +488,8 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on)
                if (ci->platdata->reg_vbus)
                        regulator_disable(ci->platdata->reg_vbus);
 
-               if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL)
+               if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL &&
+                               ci->usb_phy && ci->usb_phy->set_vbus)
                        ci->usb_phy->set_vbus(ci->usb_phy, 0);
 
                fsm->a_bus_drop = 1;