From patchwork Fri Dec 9 13:18:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 87473 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp300820qgi; Fri, 9 Dec 2016 05:18:23 -0800 (PST) X-Received: by 10.99.168.10 with SMTP id o10mr144646649pgf.105.1481289503808; Fri, 09 Dec 2016 05:18:23 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u27si33879731pfa.187.2016.12.09.05.18.23; Fri, 09 Dec 2016 05:18:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933211AbcLINSU (ORCPT + 5 others); Fri, 9 Dec 2016 08:18:20 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:35102 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932595AbcLINSS (ORCPT ); Fri, 9 Dec 2016 08:18:18 -0500 Received: by mail-wm0-f41.google.com with SMTP id a197so26673639wmd.0 for ; Fri, 09 Dec 2016 05:18:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=p3ZKPklZlGLAhiG8lLABalOvQdRc0u6rXlZ4IrKlDtI=; b=OZy17YvjNyluTd1NULC0Jm0hTv9lsWoTFFX8q7QpjmlLAlUn2ApC8Pn2LYvOQnNmDn OWtqw3QrSRyZiX/rB/iyoBEoeI4zYm3rx8YWgsd8BcqEgN4LPLYlHZCATaXwNoisXLVV fjScQn2+ugy+6bQ2LLMz5+aqY66wowheYw00M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=p3ZKPklZlGLAhiG8lLABalOvQdRc0u6rXlZ4IrKlDtI=; b=QWPYissDtt73epLMT+cO+Cb0t44ipNA02E8wK46ksF2KnNIamjUJu8uh7tKXphHSWp psJVEhoauqDR1IKlUOnpfKrDNM//kB/jZ0kUAhHjmJhzmvckiK/owPPGfiiGZZjSpZRO ps4RtfyJM87+t3gzrmSQojLUGx/K4wC/uKygo99WIByaohbDO/X/rCP6UC+dsuQHu7Gy 2K3muRKpx0Hrxs3ikJP6t4LGcqYRDMyPWCJivfaA6x5//Mc0Y1XVNbCmMOOFX/j6xD2a vcwFKJBmGxUwxNf6YQAB4fDHNrs0/9WMPZC2bf5jxmeQDDusZ8ixG6pz7it5+i2Px8/1 QuyQ== X-Gm-Message-State: AKaTC003hzoeZZsN0jVQQdX9sTbPAULcg1aHC6rD1ibVmQvesU1nvbCGnRoI0s/Vslfl45Jj X-Received: by 10.25.196.88 with SMTP id u85mr27747075lff.69.1481289496841; Fri, 09 Dec 2016 05:18:16 -0800 (PST) Received: from linuslaptop.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id s7sm6586168lja.14.2016.12.09.05.18.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Dec 2016 05:18:16 -0800 (PST) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" , Steve Glendinning Cc: Guenter Roeck , Jeremy Linton , Kamlakant Patel , Pavel Fedin , Linus Walleij Subject: [PATCH] net: smsc911x: back out silently on probe deferrals Date: Fri, 9 Dec 2016 14:18:00 +0100 Message-Id: <1481289480-22096-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Signed-off-by: Linus Walleij --- drivers/net/ethernet/smsc/smsc911x.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.7.4 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,