diff mbox

[1/2] drivers:power:twl4030-charger: fix problem with EPROBE_DEFER

Message ID cfc5db66692e0415c86a08e2a3d37c2b299bf170.1446138086.git.hns@goldelico.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

H. Nikolaus Schaller Oct. 29, 2015, 5:01 p.m. UTC
devm_usb_get_phy_by_node() may return -EPROBE_DEFER in which
case we should also defer probing of the twl4030 charger
instead of turing USB charging off (forever).

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/power/twl4030_charger.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Nishanth Menon Oct. 29, 2015, 7:52 p.m. UTC | #1
On 10/29/2015 12:01 PM, H. Nikolaus Schaller wrote:
> devm_usb_get_phy_by_node() may return -EPROBE_DEFER in which
> case we should also defer probing of the twl4030 charger
> instead of turing USB charging off (forever).

s/turing/turning

> 
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> ---
>  drivers/power/twl4030_charger.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c
> index 423e886..859991f 100644
> --- a/drivers/power/twl4030_charger.c
> +++ b/drivers/power/twl4030_charger.c
> @@ -1059,9 +1059,13 @@ static int twl4030_bci_probe(struct platform_device *pdev)
>  
>  		phynode = of_find_compatible_node(bci->dev->of_node->parent,
>  						  NULL, "ti,twl4030-usb");
> -		if (phynode)
> +		if (phynode) {
>  			bci->transceiver = devm_usb_get_phy_by_node(
>  				bci->dev, phynode, &bci->usb_nb);
> +			if (IS_ERR(bci->transceiver) &&
> +				PTR_ERR(bci->transceiver) == -EPROBE_DEFER)
I might align this with the IS_ERR

> +				return -EPROBE_DEFER;	/* PHY not ready */
> +		}
>  	}
>  
>  	/* Enable interrupts now. */
> 

Otherwise it looks good to me.
H. Nikolaus Schaller Oct. 30, 2015, 6:01 a.m. UTC | #2
Am 29.10.2015 um 20:52 schrieb Nishanth Menon <nm@ti.com>:

> On 10/29/2015 12:01 PM, H. Nikolaus Schaller wrote:
>> devm_usb_get_phy_by_node() may return -EPROBE_DEFER in which
>> case we should also defer probing of the twl4030 charger
>> instead of turing USB charging off (forever).
> 
> s/turing/turning

Thanks for noting this.

> 
>> 
>> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
>> ---
>> drivers/power/twl4030_charger.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c
>> index 423e886..859991f 100644
>> --- a/drivers/power/twl4030_charger.c
>> +++ b/drivers/power/twl4030_charger.c
>> @@ -1059,9 +1059,13 @@ static int twl4030_bci_probe(struct platform_device *pdev)
>> 
>> 		phynode = of_find_compatible_node(bci->dev->of_node->parent,
>> 						  NULL, "ti,twl4030-usb");
>> -		if (phynode)
>> +		if (phynode) {
>> 			bci->transceiver = devm_usb_get_phy_by_node(
>> 				bci->dev, phynode, &bci->usb_nb);
>> +			if (IS_ERR(bci->transceiver) &&
>> +				PTR_ERR(bci->transceiver) == -EPROBE_DEFER)
> I might align this with the IS_ERR

Ok.

> 
>> +				return -EPROBE_DEFER;	/* PHY not ready */
>> +		}
>> 	}
>> 
>> 	/* Enable interrupts now. */
>> 
> 
> Otherwise it looks good to me.

I will update for v2.

BR,
Nikolaus Schaller
igitt--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c
index 423e886..859991f 100644
--- a/drivers/power/twl4030_charger.c
+++ b/drivers/power/twl4030_charger.c
@@ -1059,9 +1059,13 @@  static int twl4030_bci_probe(struct platform_device *pdev)
 
 		phynode = of_find_compatible_node(bci->dev->of_node->parent,
 						  NULL, "ti,twl4030-usb");
-		if (phynode)
+		if (phynode) {
 			bci->transceiver = devm_usb_get_phy_by_node(
 				bci->dev, phynode, &bci->usb_nb);
+			if (IS_ERR(bci->transceiver) &&
+				PTR_ERR(bci->transceiver) == -EPROBE_DEFER)
+				return -EPROBE_DEFER;	/* PHY not ready */
+		}
 	}
 
 	/* Enable interrupts now. */