Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp609547pxx; Wed, 28 Oct 2020 12:19:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTawpeIn8dpJxR1I+fhEtsxe7VJ4YtkmY8UeECB2ksQ8w1tzxjh75W12kCy+CbiZ4yKJL5 X-Received: by 2002:a17:906:c315:: with SMTP id s21mr560857ejz.285.1603912758328; Wed, 28 Oct 2020 12:19:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603912758; cv=none; d=google.com; s=arc-20160816; b=oWv65IzYpIfNxZXkuXdEWtYm5+IWnAnrj28In49Zt+8BC1nKvDaft04GO0hdLNrJCL v/V8SUnBJ5L3PnKnPlN6Ql/ok9n+/6OgJrRVs5o1J3zdIst68F+liEId1k62D51RttvI d/UyENquHbM7HkZlubS7k0bH+E6jgA9XuyQPPuXwize4MJ70+BCv+6l00lFjyJCsjcru 8AOOPWLxxFbl3SI90gC80ihkUNknu6Z9xY4B89aZZjAvS3h+c1kuH8tpMunWoclnRP4k 0khO81i9Jqt7dxZvjZi+jVF0POJmqwxGUzzurKPRYHLWo8fSdGckGNZKeRM2/5Wow7hd 3ISg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t1g2gb+Rc8upQ3NGEq/RI2NvlAG3TyTw56TJ3Oww0I8=; b=Av/893mOnKkpuoksgKkcqujXdsKrNXwr6mdpaBDQkDjJv5J4NelK+jO7HwWHsR1uNQ Pv+4x2W5H6vlOqONj8GTJZa584zICD8YWutacJeEEasvNZ9MzbcSyzARw/HlHFDO5C/t CXhyFMaVUuN6JQxjoHhXAP9YGI0tw0IuiM4sVI5WuXAPP/AYXr0eX70YM56MpkhF4pwW 2nTQ5u6pZw++G5qQKw4UAXfQAvN4TYVf25PvWSfLjSwTU3KRIAjlKAJipgJ25ZZx5iN1 v2TlR+trKMQzALC1XEmHFwfXrKwNUYqV2xzofXZM/Lmjq7ivnLzKBNtKup6sQLHa52ob qn2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AHhtGkz7; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m26si11386edq.372.2020.10.28.12.18.55; Wed, 28 Oct 2020 12:19:18 -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=@kernel.org header.s=default header.b=AHhtGkz7; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1827197AbgJ0SWF (ORCPT + 99 others); Tue, 27 Oct 2020 14:22:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:50600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1741360AbgJ0OCl (ORCPT ); Tue, 27 Oct 2020 10:02:41 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 98D7F221F8; Tue, 27 Oct 2020 14:02:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807361; bh=WF/DrwobkPc8AnN036NJDYo4EzAFWL4v58QCOOMGz6I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AHhtGkz7+2GSpyOfYzM62pVFgUGR+bU5MhNn6LgGfCo4SVBNQhK4QWrlHt31WNl34 27w78AR6L1YjvqLTqvybe/BqHLBu6Mp8kM5vlNWa4yXnM6XPEXU0j14O20MhbHIlCm 9SBZlef5Z9VvfeUQ94/ajsoJWBv3CIR9E+98Zxlo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= , Mark Brown , Sasha Levin Subject: [PATCH 4.9 024/139] regulator: resolve supply after creating regulator Date: Tue, 27 Oct 2020 14:48:38 +0100 Message-Id: <20201027134903.282607455@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134902.130312227@linuxfoundation.org> References: <20201027134902.130312227@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michał Mirosław [ Upstream commit aea6cb99703e17019e025aa71643b4d3e0a24413 ] 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 Link: https://lore.kernel.org/r/ba09e0a8617ffeeb25cb4affffe6f3149319cef8.1601155770.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- 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 9355b65920ab4..0f730e4bf6bcb 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -4029,15 +4029,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.25.1