[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1629825378-8089-4-git-send-email-manish.narani@xilinx.com>
Date: Tue, 24 Aug 2021 22:46:15 +0530
From: Manish Narani <manish.narani@...inx.com>
To: <peter.chen@...nel.org>, <gregkh@...uxfoundation.org>,
<michal.simek@...inx.com>
CC: <linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<git@...inx.com>, Manish Narani <manish.narani@...inx.com>,
"Subbaraya Sundeep Bhatta" <sbhatta@...inx.com>
Subject: [PATCH 3/6] usb: chipidea: Check usb_phy exists before using it
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@...inx.com>
Signed-off-by: Michal Simek <michal.simek@...inx.com>
Signed-off-by: Manish Narani <manish.narani@...inx.com>
---
drivers/usb/chipidea/otg_fsm.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
index 2f7f94d..5f8f5d2 100644
--- a/drivers/usb/chipidea/otg_fsm.c
+++ b/drivers/usb/chipidea/otg_fsm.c
@@ -472,7 +472,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 */
@@ -484,7 +485,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;
--
2.1.1
Powered by blists - more mailing lists