From patchwork Tue Oct 27 13:47:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 312598 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22C4BC55179 for ; Tue, 27 Oct 2020 15:29:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF5BF22265 for ; Tue, 27 Oct 2020 15:29:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603812556; bh=8aAidsEKBvSKJ+eRVz/YNjTZm0lLkaRZt+LE+1BICXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wklcMlwlfqPxSI44tFVn4ilu9ecqHW8m+rkclQfNGeSr6RJygdik5HfsRJsgE3PDh x0nm9Ojb1FBHio2XfndJAQ7o8+kLV+Kd2Ww1mDqvomQKuaZRCj+ctZv7pM8cVSvYoH pJDsKCScGPbkzR/p3FKic21hvWFBNXpbczFe5k+E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1798611AbgJ0P3N (ORCPT ); Tue, 27 Oct 2020 11:29:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:43304 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2901377AbgJ0P1a (ORCPT ); Tue, 27 Oct 2020 11:27:30 -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 10F202224A; Tue, 27 Oct 2020 15:27:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603812449; bh=8aAidsEKBvSKJ+eRVz/YNjTZm0lLkaRZt+LE+1BICXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gooI1TLpPXqxrvAUXYSDXnqQuBtCZiWNv+PIoPRIm5yM1pNoqsotm0V0lj85Eq1CO 07Wk79pkmoQvm6zBI+4XwR1jrXB6/+KQnQtLZSyLmRoMUiIp6cV1yJjvy5jph1Ri9+ BT/qgrkIyrrcQRaQGcHVxtKS/r7AJE3E4Ka2NS6g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Mark Brown , Sasha Levin Subject: [PATCH 5.9 173/757] regulator: resolve supply after creating regulator Date: Tue, 27 Oct 2020 14:47:03 +0100 Message-Id: <20201027135458.709756525@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 7ff507ec875a8..4859cf84c0b2f 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -5256,15 +5256,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;