Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2042462pxk; Sat, 26 Sep 2020 14:34:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBHMYX2W+IKX/8Q+ZweQIvCi8iPYkdfR1kakSoUENK0dZurTZH8ABTZHhPcDZXbln9ChoZ X-Received: by 2002:a50:fc83:: with SMTP id f3mr8458762edq.102.1601156047703; Sat, 26 Sep 2020 14:34:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601156047; cv=none; d=google.com; s=arc-20160816; b=yr+Lvh5j/E8k8mKTroClcmYqCkP6pzqDgmX5tdsRXJ1mZ42SPChKOSi1I/vO5GrF4L Mu2TBlPU2BYA6o8Np3HpjgG26koLMyZFTtBszXZ1Eqbeg4xstybA4xItqwDFsaJAV3NC ueVg/8L3vsj5hBll+/d6eRaPuHbikzUKza8pVx2rJYzUTLxj5BAiBdvNLsWAqwuNR9ee hpETDB8i75v5U08ooiGiEEXmUub9udAycA2BIB+lmZJgEucfj6ZGZoVGh7Cyr4qcPHgV pCyIFBUPjrAmyPXLbtVR/ICVxMYT7cUoNXAP66rX3HuoZwGqhfzpWLMQ6E7moTUYkqZH DP0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :subject:from:references:in-reply-to:message-id:date:dkim-signature; bh=J+XgTTvMpUzJdoqINjK2gWZqQe0B+YgHBO37tm1kdc0=; b=yy6gqvcryAPPvwm/ite9vzqALOZulfnl00fzxQMDzighDjEJkXBQkaQOQWxdcXgbNM Jpgv+hFRUP8IKCTHZ9mDTaYi7DkoHPEvt54f7PdQyD2h7bCoRU4GhKYfDyCdW9oO4iRr olCRT0Ouontti5486C3FrUWySohBi5b6nXJPMvNhr7fRn6Ck5L/MkXfcjTKP6HiRFZaX UA4FyE6d8/LBjU//uQkiDoOuTSCcscNGV7XoOeWEV8bylwQe6muagR/lOev8F9LkXWdI fNuJuiyXeb0SiF0f+ozhjPAq3pYYAo7AMLflom4WEtZk6UEnyBg0aCwe43m2gtAB3Jqj nlwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b="OS9/Urme"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w20si4588488edu.534.2020.09.26.14.33.44; Sat, 26 Sep 2020 14:34:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b="OS9/Urme"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727324AbgIZVcq (ORCPT + 99 others); Sat, 26 Sep 2020 17:32:46 -0400 Received: from rere.qmqm.pl ([91.227.64.183]:44381 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726382AbgIZVcp (ORCPT ); Sat, 26 Sep 2020 17:32:45 -0400 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4BzMSn3zLwz2KQ; Sat, 26 Sep 2020 23:32:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1601155961; bh=yjW/YkTtfoxUSEufTrCdNzGAG3DmVwt9dXwIVmLLdBk=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=OS9/Urme9gevsQ3P1Bbeo/BFJPV0/sVuic+L/qGf9QkaZwsv90eTAclTMTcVrQW8Q oP+ZimuCwPx0b9DrQSVlZhWos2l27IkudrOW/8psDBlaae+s2J8CwYThKAt9vEsVxE PYiUXSyDL1vgvEr/ZKfluo7UO9T9U+BBESCnmkYKIU/Wf66XtwVSnlUTkmkJaA+MLS 705D8pB87UhKRw08dynOdhBNRwUo2HBM3Uw0zncqfgok6N8vOmgBxv14g8Cf02PVMc IhuvRdwomy3axPdAkVqPSo7JYDAUS7Okpkloao5iW6V+bGom9KutqQDrkLoAd5rI39 JrwcwyIGDB2Uw== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at mail Date: Sat, 26 Sep 2020 23:32:41 +0200 Message-Id: In-Reply-To: References: From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Subject: [PATCH 3/3] regulator: resolve supply after creating regulator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To: Liam Girdwood , Mark Brown , Jon Hunter Cc: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When creating a new regulator its supply cannot create the sysfs link because the device is not yet published. Remove early supply resolving since it will be done later anyway. This makes the following error disappear and the symlinks get created instead. DCDC_REG1: supplied by VSYS VSYS: could not add device link regulator.3 err -2 Note: It doesn't fix the problem for bypassed regulators, though. Fixes: 45389c47526d ("regulator: core: Add early supply resolution for regulators") Signed-off-by: Michał Mirosław --- drivers/regulator/core.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 6b56a22fd37f..607c2a76bb60 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -5279,15 +5279,20 @@ regulator_register(const struct regulator_desc *regulator_desc, else if (regulator_desc->supply_name) rdev->supply_name = regulator_desc->supply_name; - /* - * Attempt to resolve the regulator supply, if specified, - * but don't return an error if we fail because we will try - * to resolve it again later as more regulators are added. - */ - if (regulator_resolve_supply(rdev)) - rdev_dbg(rdev, "unable to resolve supply\n"); - ret = set_machine_constraints(rdev, constraints); + if (ret == -EPROBE_DEFER) { + /* Regulator might be in bypass mode and so needs its supply + * to set the constraints */ + /* FIXME: this currently triggers a chicken-and-egg problem + * when creating -SUPPLY symlink in sysfs to a regulator + * that is just being created */ + ret = regulator_resolve_supply(rdev); + if (!ret) + ret = set_machine_constraints(rdev, constraints); + else + rdev_dbg(rdev, "unable to resolve supply early: %pe\n", + ERR_PTR(ret)); + } if (ret < 0) goto wash; -- 2.20.1