Skip to contentSkip to conversation

phy: qcom-usb-hs: Fix unbalanced notifier registration

PATCH New Bjorn Andersson 1 participant 1 message Aug 23, 2018 USB

lore
Share & tools
lore
#0 lore raw

PATCH 5/6 phy: qcom-usb-hs: Fix unbalanced notifier registration

Quoted 14 lines · Loic Poulain

Phy power on/off cycle can happen several times during device life. We then need to balance the extcon notifier registration accordingly.

Fixes f0b5c2c96370 ("phy: qcom-usb-hs: Replace the extcon API")
---
 drivers/phy/qualcomm/phy-qcom-usb-hs.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/phy/qualcomm/phy-qcom-usb-hs.c +0 -0
index 2d0c70b..92e9d94 100644

drivers/phy/qualcomm/phy-qcom-usb-hs.c static int qcom_usb_hs_phy_power_off(struct phy *phy) · line 187

Quoted 7 lines
drivers/phy/qualcomm/phy-qcom-usb-hs.c +4 -0
@@ -181,6 +181,12 @@ static int qcom_usb_hs_phy_power_off(struct phy *phy)
 {
 	struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy);
 
+	if (uphy->vbus_edev) {
+		devm_extcon_unregister_notifier(&uphy->ulpi->dev,
+						uphy->vbus_edev, EXTCON_USB,
+						&uphy->vbus_notify);

As I presume the power_on should always be matched with a power_off I wonder if it really is appropriate to use the devres version of this API.

Should we drop the devm_ from registration in power_on as well?

drivers/phy/qualcomm/phy-qcom-usb-hs.c static int qcom_usb_hs_phy_power_off(struct phy *phy) · line 192

Quoted 5 lines
drivers/phy/qualcomm/phy-qcom-usb-hs.c +2 -0
+	}
+
 	regulator_disable(uphy->v3p3);
 	regulator_disable(uphy->v1p8);
 	clk_disable_unprepare(uphy->sleep_clk);

Regards,
Bjorn