From patchwork Mon Jun 14 10:27:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 459793 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp3154110jae; Mon, 14 Jun 2021 03:33:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycvaNy+H1g8W6LS3tPWBjpG06FlDcLNQcqYb19YeZGZNUB82V7W+fErMJegNBLhddhoQZL X-Received: by 2002:a05:6402:1001:: with SMTP id c1mr16053627edu.26.1623666827919; Mon, 14 Jun 2021 03:33:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623666827; cv=none; d=google.com; s=arc-20160816; b=wW4duQexHNNuIieMM5qmgBu/G424Ak4N3MQN4lFGQacqfgbhmnOxXGk4sc6TftjdYE UXlkiGGr4ondF/KpgCqV3NpWrXJUh0f67An1p+2KXO54k8FDSG5LCcAMkYY7d3s0GT9X iGqFlfymTYheORWo+yaOcY+FEPngWmjehWavmjI/drd3DjJkhhDldtE8n8rJRE+yh15g FVGtDqK9upRl2tVSWtwLGAY3TBXOjfAlF0P37OjYkUa59V20KAxO1D/KODKivb/LGEcY aiQe56aMvCw3yStq708KL+5EEOv/WuItLO6QIKzg7sp5ITTPM1Pz2XAXST41yECpVv++ P5Ew== 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=cQKpuXfezJCj2WPhe1jlekKVmvWsjuROG6TiD7Fly44=; b=xye9yDXgRztVBzXvxHfjKNLY92NSiIYRgmn935SbUkfeljmD7mRybD2bCRhwWmGC6y T7q0TYt5M5DjmT8GwPQsd78L+9/tc4/ZEzfHyQNLKEr4nSpPRfCfQGqYZXPyAHBxaWT4 5QFHuUI1sHhH279mcmeaDgSB0OuDc8C2mNUhfy8Ab/Y3U5krJ6OgzMhBH7w8LRvTtbv2 Z+JO9s5oPZ0w2HGg/iuUkU9exZeodoaKm7ROJQE+StpwR4we05lXoT3uUvwfxd6Trkkt XW0pFxR6NwxUfn0lmaBdonIqQQIdL9kJlmHuavx4Q6gGeIEaBAx5a4vw/YDS5p82H1nL gEhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mUFmhdmi; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (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 zo19si11218970ejb.452.2021.06.14.03.33.47; Mon, 14 Jun 2021 03:33:47 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=@linuxfoundation.org header.s=korg header.b=mUFmhdmi; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233086AbhFNKfp (ORCPT + 12 others); Mon, 14 Jun 2021 06:35:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:39738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232746AbhFNKeF (ORCPT ); Mon, 14 Jun 2021 06:34:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 95FBA611C0; Mon, 14 Jun 2021 10:31:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623666707; bh=uH7X4E4uXYwz4moQg9ZSqhZ98whTmhNzkyKbhStAGOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mUFmhdmiXwRRKjRDoUwgEb41zURV8fKSOAzq1hbKiXOgf12sKMp5ZyYJEiUaGjoSe obG9w4BxzUQ4wKwKAKH8wuklMIoGjbPSiSUWQJVR9LpavvDNLzT0IqZaMjHJtESddZ pl2IjHa//hsiqVffAiyW19ePAP63X2g7xNNdCQ2U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Mark Brown Subject: [PATCH 4.9 33/42] regulator: core: resolve supply for boot-on/always-on regulators Date: Mon, 14 Jun 2021 12:27:24 +0200 Message-Id: <20210614102643.758079144@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102642.700712386@linuxfoundation.org> References: <20210614102642.700712386@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dmitry Baryshkov commit 98e48cd9283dbac0e1445ee780889f10b3d1db6a upstream. For the boot-on/always-on regulators the set_machine_constrainst() is called before resolving rdev->supply. Thus the code would try to enable rdev before enabling supplying regulator. Enforce resolving supply regulator before enabling rdev. Fixes: aea6cb99703e ("regulator: resolve supply after creating regulator") Signed-off-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20210519221224.2868496-1-dmitry.baryshkov@linaro.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/regulator/core.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1080,6 +1080,12 @@ static int set_machine_constraints(struc * and we have control then make sure it is enabled. */ if (rdev->constraints->always_on || rdev->constraints->boot_on) { + /* If we want to enable this regulator, make sure that we know + * the supplying regulator. + */ + if (rdev->supply_name && !rdev->supply) + return -EPROBE_DEFER; + ret = _regulator_do_enable(rdev); if (ret < 0 && ret != -EINVAL) { rdev_err(rdev, "failed to enable\n");