Linux USB
 help / color / mirror / Atom feed
* [5/6] phy: qcom-usb-hs: Fix unbalanced notifier registration
@ 2018-08-23 17:27 Bjorn Andersson
  0 siblings, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2018-08-23 17:27 UTC (permalink / raw)
  To: Loic Poulain
  Cc: Peter.Chen, linux-usb, linux-arm-msm, david.brown, robh+dt,
	andy.gross

On Tue 21 Aug 06:55 PDT 2018, Loic Poulain wrote:

> 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")
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
>  drivers/phy/qualcomm/phy-qcom-usb-hs.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hs.c b/drivers/phy/qualcomm/phy-qcom-usb-hs.c
> index 2d0c70b..92e9d94 100644
> --- a/drivers/phy/qualcomm/phy-qcom-usb-hs.c
> +++ b/drivers/phy/qualcomm/phy-qcom-usb-hs.c
> @@ -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?

> +	}
> +
>  	regulator_disable(uphy->v3p3);
>  	regulator_disable(uphy->v1p8);
>  	clk_disable_unprepare(uphy->sleep_clk);

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [5/6] phy: qcom-usb-hs: Fix unbalanced notifier registration
@ 2018-08-24  9:17 Loic Poulain
  0 siblings, 0 replies; 3+ messages in thread
From: Loic Poulain @ 2018-08-24  9:17 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Peter Chen, USB, linux-arm-msm, David Brown, Rob Herring,
	Andy Gross

On 23 August 2018 at 19:27, Bjorn Andersson <bjorn.andersson@linaro.org> wrote:
> On Tue 21 Aug 06:55 PDT 2018, Loic Poulain wrote:
>
>> 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")
>> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
>> ---
>>  drivers/phy/qualcomm/phy-qcom-usb-hs.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hs.c b/drivers/phy/qualcomm/phy-qcom-usb-hs.c
>> index 2d0c70b..92e9d94 100644
>> --- a/drivers/phy/qualcomm/phy-qcom-usb-hs.c
>> +++ b/drivers/phy/qualcomm/phy-qcom-usb-hs.c
>> @@ -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?

Yes, thanks, I'll drop the devres version.

Regards,
Loic

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [5/6] phy: qcom-usb-hs: Fix unbalanced notifier registration
@ 2018-08-21 13:55 Loic Poulain
  0 siblings, 0 replies; 3+ messages in thread
From: Loic Poulain @ 2018-08-21 13:55 UTC (permalink / raw)
  To: Peter.Chen
  Cc: linux-usb, linux-arm-msm, david.brown, robh+dt, bjorn.andersson,
	andy.gross, 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")
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 drivers/phy/qualcomm/phy-qcom-usb-hs.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hs.c b/drivers/phy/qualcomm/phy-qcom-usb-hs.c
index 2d0c70b..92e9d94 100644
--- a/drivers/phy/qualcomm/phy-qcom-usb-hs.c
+++ b/drivers/phy/qualcomm/phy-qcom-usb-hs.c
@@ -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);
+	}
+
 	regulator_disable(uphy->v3p3);
 	regulator_disable(uphy->v1p8);
 	clk_disable_unprepare(uphy->sleep_clk);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-24  9:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-23 17:27 [5/6] phy: qcom-usb-hs: Fix unbalanced notifier registration Bjorn Andersson
  -- strict thread matches above, loose matches on Subject: below --
2018-08-24  9:17 Loic Poulain
2018-08-21 13:55 Loic Poulain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox