From patchwork Mon Nov 2 21:27:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 11875393 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=-8.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_ALL,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 67F55C2D0A3 for ; Mon, 2 Nov 2020 21:29:03 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D0DC6208A9 for ; Mon, 2 Nov 2020 21:29:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2+FWxZjr"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="gVIkqZ7i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D0DC6208A9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rere.qmqm.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:MIME-Version:Subject:From:Message-Id:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=/82lvBv0wsLCi7FkXxZnCL6ydRf7JGKcxb20psJ9uzA=; b=2+FWxZjrE28C97XiaOLxaeNbmo gy6W5bOl8bktOvAZdUIdtg2b7sRJKJ9QwA8LeeEb0VsKtkk/ZXTV+V/RN+ZDnL4TEA2/uHWoT2kFX fe3o6T/QQHRNoOshNqvopF4Z2jam/7hcOxUuTGMvCSz+aKyzEbHJe9jtX8w/FikxJN/OsfYBt/1wn encJI4aTE5R6Twdrp4oA6UuXSR4G5q6UaukIdrMYI1LdI8LxwzVpAWeBXrMgV4NK8pH8h8tHZO8So B1XrN7w13cDmBn/dB8BEn0yAplu9ET+3nZ5KhrgpQ6GYXp/7SmGIsVrjc05gtxteCoKc5vhKUsKMc SgCK6W4w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZhMT-0004KH-AL; Mon, 02 Nov 2020 21:27:33 +0000 Received: from rere.qmqm.pl ([91.227.64.183]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZhMQ-0004Ja-0k for linux-arm-kernel@lists.infradead.org; Mon, 02 Nov 2020 21:27:30 +0000 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4CQ5bg6Ktbz6r; Mon, 2 Nov 2020 22:27:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1604352448; bh=2g213xzmFT56VmXrFrh2NgIcRbPzT1GPUDOzlYzxpPQ=; h=Date:From:Subject:To:Cc:From; b=gVIkqZ7iRjeBncuOQ0cnSZcwWCsXYqymh1kbJZK3KJjzDqWhYr4nkk+yVdDfoU8Tr BlMxwtDapVD7E8TrPRZtbR765pzwlcZ+6vjENRYM26Wg4BUGt5CnT+tytcWsA2J7UF SwoqeazIKrfDRT99+QXuRZH9htZjfQ9DfBI7foUUp5xjHEll8e9BWgXbEXlxSl1t5E zPIFuYU8QxwgVOz9REmFP6wvZyeAuGqiPjEuhCqnTWhvDxF+c32QlTozv1PCx2+nbF 4I2WzNJgyPG2zEQCAGah3PENGb2OGJcCuIqQpRUO2hUaR019qBU9QG9H2aH6nlDtKB 12EmfapnFsCqg== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at mail Date: Mon, 02 Nov 2020 22:27:27 +0100 Message-Id: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH v1] regulator: defer probe when trying to get voltage from unresolved supply MIME-Version: 1.0 To: Liam Girdwood , Mark Brown , =?utf-8?q?Ond=C5=99ej?= Jirman , Corentin Labbe , Ahmad Fatoum , X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201102_162730_268208_B282FAAF X-CRM114-Status: GOOD ( 13.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org regulator_get_voltage_rdev() is called in regulator probe() when applying machine constraints. The "fixed" commit exposed the problem that non-bypassed regulators can forward the request to its parent (like bypassed ones) supply. Return -EPROBE_DEFER when the supply is expected but not resolved yet. Fixes: aea6cb99703e ("regulator: resolve supply after creating regulator") Cc: stable@vger.kernel.org Signed-off-by: Michał Mirosław Reported-by: Ondřej Jirman Reported-by: Corentin Labbe Tested-by: Ondřej Jirman --- v1: this is a bit different solution than the hack sent earlier. It should be equivalent (putting the error code at the source), but please test again. --- drivers/regulator/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index a4ffd71696da..a5ad553da8cd 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -4165,6 +4165,8 @@ int regulator_get_voltage_rdev(struct regulator_dev *rdev) ret = rdev->desc->fixed_uV; } else if (rdev->supply) { ret = regulator_get_voltage_rdev(rdev->supply->rdev); + } else if (rdev->supply_name) { + return -EPROBE_DEFER; } else { return -EINVAL; }