* [PATCH] net: smsc911x: back out silently on probe deferrals
@ 2016-12-09 13:18 Linus Walleij
2016-12-10 4:05 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2016-12-09 13:18 UTC (permalink / raw)
To: netdev, David S . Miller, Steve Glendinning
Cc: Guenter Roeck, Jeremy Linton, Kamlakant Patel, Pavel Fedin,
Linus Walleij
When trying to get a regulator we may get deferred and we see
this noise:
smsc911x 1b800000.ethernet-ebi2 (unnamed net_device) (uninitialized):
couldn't get regulators -517
Then the driver continues anyway. Which means that the regulator
may not be properly retrieved and reference counted, and may be
switched off in case noone else is using it.
Fix this by returning silently on deferred probe and let the
system work it out.
Cc: Jeremy Linton <jeremy.linton@arm.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/net/ethernet/smsc/smsc911x.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 86b7c04e3738..c492e4ffd9e7 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -442,9 +442,16 @@ static int smsc911x_request_resources(struct platform_device *pdev)
ret = regulator_bulk_get(&pdev->dev,
ARRAY_SIZE(pdata->supplies),
pdata->supplies);
- if (ret)
+ if (ret) {
+ /*
+ * Retry on deferrals, else just report the error
+ * and try to continue.
+ */
+ if (ret == -EPROBE_DEFER)
+ return ret;
netdev_err(ndev, "couldn't get regulators %d\n",
ret);
+ }
/* Request optional RESET GPIO */
pdata->reset_gpiod = devm_gpiod_get_optional(&pdev->dev,
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: smsc911x: back out silently on probe deferrals
2016-12-09 13:18 [PATCH] net: smsc911x: back out silently on probe deferrals Linus Walleij
@ 2016-12-10 4:05 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-12-10 4:05 UTC (permalink / raw)
To: linus.walleij
Cc: netdev, steve.glendinning, linux, jeremy.linton, kamlakant.patel,
p.fedin
From: Linus Walleij <linus.walleij@linaro.org>
Date: Fri, 9 Dec 2016 14:18:00 +0100
> When trying to get a regulator we may get deferred and we see
> this noise:
>
> smsc911x 1b800000.ethernet-ebi2 (unnamed net_device) (uninitialized):
> couldn't get regulators -517
>
> Then the driver continues anyway. Which means that the regulator
> may not be properly retrieved and reference counted, and may be
> switched off in case noone else is using it.
>
> Fix this by returning silently on deferred probe and let the
> system work it out.
>
> Cc: Jeremy Linton <jeremy.linton@arm.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Looks good, applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-10 4:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-09 13:18 [PATCH] net: smsc911x: back out silently on probe deferrals Linus Walleij
2016-12-10 4:05 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).