All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: Kishon Vijay Abraham I <kishon@ti.com>, tony@atomide.com, balbi@ti.com
Cc: nsekhar@ti.com, nm@ti.com, george.cherian@ti.com,
	linux-omap@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/6] phy: omap-usb2: Balance pm_runtime_enable() on probe failure
Date: Thu, 3 Jul 2014 19:50:25 +0300	[thread overview]
Message-ID: <53B589D1.1090209@ti.com> (raw)
In-Reply-To: <53B55B4A.8020709@ti.com>

On 07/03/2014 04:31 PM, Kishon Vijay Abraham I wrote:
> Hi Roger,
> 
> On Wednesday 02 July 2014 05:33 PM, Roger Quadros wrote:
>> If probe fails then we need to call pm_runtime_disable() to balance
>> out the previous pm_runtime_enable() call. Else it will cause
>> unbalanced pm_runtime_enable() call in the succeding probe call.
>>
>> This anomaly was observed when the call to devm_phy_create() failed
>> with -EPROBE_DEFER.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>  drivers/phy/phy-omap-usb2.c | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
>> index 7007c11..c6f9809 100644
>> --- a/drivers/phy/phy-omap-usb2.c
>> +++ b/drivers/phy/phy-omap-usb2.c
>> @@ -265,15 +265,19 @@ static int omap_usb2_probe(struct platform_device *pdev)
>>  	pm_runtime_enable(phy->dev);
>>  
>>  	generic_phy = devm_phy_create(phy->dev, &ops, NULL);
>> -	if (IS_ERR(generic_phy))
>> +	if (IS_ERR(generic_phy)) {
>> +		pm_runtime_disable(phy->dev);
>>  		return PTR_ERR(generic_phy);
>> +	}
> 
> Maybe we can move pm_runtime_enable to just before phy_provider_register?

OK. will try that.

>>  
>>  	phy_set_drvdata(generic_phy, phy);
>>  
>>  	phy_provider = devm_of_phy_provider_register(phy->dev,
>>  			of_phy_simple_xlate);
>> -	if (IS_ERR(phy_provider))
>> +	if (IS_ERR(phy_provider)) {
>> +		pm_runtime_disable(phy->dev);
>>  		return PTR_ERR(phy_provider);
>> +	}
> 
> Noticed pm_runtime_disable was missing in omap_usb2_remove too. Would be good
> to fix it here.
> 

Fine, I'll add it there.

cheers,
-roger

WARNING: multiple messages have this Message-ID (diff)
From: Roger Quadros <rogerq@ti.com>
To: Kishon Vijay Abraham I <kishon@ti.com>, <tony@atomide.com>,
	<balbi@ti.com>
Cc: <nsekhar@ti.com>, <nm@ti.com>, <george.cherian@ti.com>,
	<linux-omap@vger.kernel.org>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/6] phy: omap-usb2: Balance pm_runtime_enable() on probe failure
Date: Thu, 3 Jul 2014 19:50:25 +0300	[thread overview]
Message-ID: <53B589D1.1090209@ti.com> (raw)
In-Reply-To: <53B55B4A.8020709@ti.com>

On 07/03/2014 04:31 PM, Kishon Vijay Abraham I wrote:
> Hi Roger,
> 
> On Wednesday 02 July 2014 05:33 PM, Roger Quadros wrote:
>> If probe fails then we need to call pm_runtime_disable() to balance
>> out the previous pm_runtime_enable() call. Else it will cause
>> unbalanced pm_runtime_enable() call in the succeding probe call.
>>
>> This anomaly was observed when the call to devm_phy_create() failed
>> with -EPROBE_DEFER.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>  drivers/phy/phy-omap-usb2.c | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
>> index 7007c11..c6f9809 100644
>> --- a/drivers/phy/phy-omap-usb2.c
>> +++ b/drivers/phy/phy-omap-usb2.c
>> @@ -265,15 +265,19 @@ static int omap_usb2_probe(struct platform_device *pdev)
>>  	pm_runtime_enable(phy->dev);
>>  
>>  	generic_phy = devm_phy_create(phy->dev, &ops, NULL);
>> -	if (IS_ERR(generic_phy))
>> +	if (IS_ERR(generic_phy)) {
>> +		pm_runtime_disable(phy->dev);
>>  		return PTR_ERR(generic_phy);
>> +	}
> 
> Maybe we can move pm_runtime_enable to just before phy_provider_register?

OK. will try that.

>>  
>>  	phy_set_drvdata(generic_phy, phy);
>>  
>>  	phy_provider = devm_of_phy_provider_register(phy->dev,
>>  			of_phy_simple_xlate);
>> -	if (IS_ERR(phy_provider))
>> +	if (IS_ERR(phy_provider)) {
>> +		pm_runtime_disable(phy->dev);
>>  		return PTR_ERR(phy_provider);
>> +	}
> 
> Noticed pm_runtime_disable was missing in omap_usb2_remove too. Would be good
> to fix it here.
> 

Fine, I'll add it there.

cheers,
-roger

  reply	other threads:[~2014-07-03 16:50 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-02 12:03 [PATCH 0/6] omap: phy: dra7-evm PHY fixes for 3.16 Roger Quadros
2014-07-02 12:03 ` Roger Quadros
2014-07-02 12:03 ` [PATCH 1/6] ARM: dts: dra7-evm: Make VDDA_1V8_PHY supply always on Roger Quadros
2014-07-02 12:03   ` Roger Quadros
2014-07-02 13:05   ` Nishanth Menon
2014-07-02 13:05     ` Nishanth Menon
2014-07-02 14:37     ` Roger Quadros
2014-07-02 14:37       ` Roger Quadros
2014-07-03  9:40   ` [PATCH v2 " Roger Quadros
2014-07-03  9:40     ` Roger Quadros
2014-07-02 12:03 ` [PATCH 2/6] phy: core: Fix error path in phy_create() Roger Quadros
2014-07-02 12:03   ` Roger Quadros
2014-07-02 12:03 ` [PATCH 3/6] phy: core: Support regulator supply for PHY power Roger Quadros
2014-07-02 12:03   ` Roger Quadros
2014-07-02 12:32   ` Sergei Shtylyov
2014-07-03  8:02     ` Roger Quadros
2014-07-03  8:02       ` Roger Quadros
2014-07-03  9:42   ` [PATCH v2 " Roger Quadros
2014-07-03  9:42     ` Roger Quadros
2014-07-02 12:03 ` [PATCH 4/6] phy: core: Add phy-supply to DT binding documentation Roger Quadros
2014-07-02 12:03   ` Roger Quadros
2014-07-02 12:03 ` [PATCH 5/6] phy: omap-usb2: Balance pm_runtime_enable() on probe failure Roger Quadros
2014-07-02 12:03   ` Roger Quadros
2014-07-03 13:31   ` Kishon Vijay Abraham I
2014-07-03 13:31     ` Kishon Vijay Abraham I
2014-07-03 16:50     ` Roger Quadros [this message]
2014-07-03 16:50       ` Roger Quadros
2014-07-02 12:03 ` [PATCH 6/6] ARM: dts: dra7-evm: Add regulator information to USB2 PHYs Roger Quadros
2014-07-02 12:03   ` Roger Quadros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53B589D1.1090209@ti.com \
    --to=rogerq@ti.com \
    --cc=balbi@ti.com \
    --cc=george.cherian@ti.com \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=nsekhar@ti.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.