From patchwork Mon Jun 14 10:27:32 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: 459800 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp3161350jae; Mon, 14 Jun 2021 03:44:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzK+Mz7Ex9L9WN1yq97xV4KzBT1fNXO+rhUDIDkWiwZKIaDKWS82Ga7PvJcn21EtchI0F6i X-Received: by 2002:a17:906:390f:: with SMTP id f15mr14869538eje.270.1623667480283; Mon, 14 Jun 2021 03:44:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623667480; cv=none; d=google.com; s=arc-20160816; b=Y6d/+451481sy5/cYemMN4uWBjD6MlVv0XS5NYYkcw01JAUgDjeRhG0dN/bNuInQDj HB6ekfFqRKYGmQ5Ltcdx/Z8hfHVckkd6vh1GLMp1kAKNHhyQQNnAF+2KwuFSgjPBHX10 Hb6a5tL4L7rI6oih4fcZ///xnhJsv7VOT4BnK0UT5POFX+XPl2WuNHv9648bXsAa8pwW nsWRDJv3wwRu1VQgtD4R2wjQ6C7RcU6Ibmay99YEwOy2tiZrv571FB+AQYAwNifvZewS zOCe4xu93PG2c9gmCpOX368ZCOGLpwv3xB3su0en3yBLGq0J/csnTFLfHXqtlhCxgkPH F/lQ== 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=ZZBTWzODyA61SrsoVki7xekJA/lKSdGSM39TxVPCh8I=; b=AW0u8ChxM8byNjMy3WeCZuzJXdqD9Nx1ILueDs3DOla7zZhuYbNw6B0w//GF11QPvu G6QKWyWwGGvYPWs9CdtpRZjiLQGX8qGD0pShBNyxJ0o5SR4fwSoxG3SPQC05UYMTwlmB V8qFqf3rmhsU91jigLVKUUCOpM6wIL4wI0cL4oacHfNmnBhamTtswc+w9n+AfBr/NnGE b/5GC0xHjK7+bFAvgzsEMcBbR01GDgraRF/eU73jJyMoP6u7RcQTpiHaveBAJ9v7C87m v01Pyvi2DXOoG/Dw0Fs70yhzJFPvemdtwERzDZuDotTekrJQxIqdvTbOnNepV1az/FZc MnIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=afsAbU1P; 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 w19si10609433edc.458.2021.06.14.03.44.40; Mon, 14 Jun 2021 03:44:40 -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=afsAbU1P; 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 S233846AbhFNKqN (ORCPT + 12 others); Mon, 14 Jun 2021 06:46:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:47204 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234082AbhFNKoG (ORCPT ); Mon, 14 Jun 2021 06:44:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 660DC61447; Mon, 14 Jun 2021 10:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623666972; bh=18ytGtU2WXMzCGbXtRFWXSM52pc2RrKtSbHNWoN64/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=afsAbU1PyoUzhVe61l+iHuWMcWLgb4ZZS+7zOmfCDyXGMa/mzDDpnpJU+sKFbciHP Dt7A4a4SD3XaG+1cNJk1k7mCJnrU6xa4dGFzFr8CoXZEwlOMiyqDyPJQGmGuKZnn3c cKioxlH8vypz3gvMja5rCelXBJrRX1uvFyuKWB4w= 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.19 49/67] regulator: core: resolve supply for boot-on/always-on regulators Date: Mon, 14 Jun 2021 12:27:32 +0200 Message-Id: <20210614102645.439923262@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102643.797691914@linuxfoundation.org> References: <20210614102643.797691914@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 @@ -1191,6 +1191,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; + if (rdev->supply) { ret = regulator_enable(rdev->supply); if (ret < 0) {