Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3584036pxb; Mon, 24 Jan 2022 12:49:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbGVwhZWGOLTLi6MDjamCHcb1Jj3zJVzpg3P1SLcTesVdAxaaOGkUSd80Bs6hbxw9SeOrF X-Received: by 2002:a17:902:e74e:b0:14b:1100:aebc with SMTP id p14-20020a170902e74e00b0014b1100aebcmr15841602plf.133.1643057381746; Mon, 24 Jan 2022 12:49:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643057381; cv=none; d=google.com; s=arc-20160816; b=pzcKEurJe7Y9nBfDPO0t8JFmDReyGIbKs4PyLzXz0L7LHAOeKYhyfme+n76yxUX+Su oRrJ8aQaQ4RqKCUsA1ZyrPX/xM3737XbMNEk2TgJN7ZdbxlY967lIgY8fsOZ2/A9gXlK o0YEMNzu7cdPVN59d723zpihEMT+ifrTjamzSm8RGQtdcOHVPbtAAx7qu+xEYm+BanGL jI9YA0Sa0RMWw0UCBQQUUUx2sdECAncSRei42kHRUNSznOYW3mB1GNiRJ49FqxctHC/C bmLVS9lFj0Jhx3/8+AdP7hgGjJLcC+xr+78FA0SggHfc/QFdHNNy3mExNq+gzTawdLWX iKBA== 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=lha9DM4EMjxwfb2fVgCE5kx1Atf+v+hpiTl3jQtH7yM=; b=NmheYg1SZWIXUF4n3qdtz8snq7JZ2H5oRQHJPlmluS5FW9ftiWS2U82aHfnMK7pZnk 2yHvPSej5PawqqtrCPE/feffjbHxu/pLFgW9t+cC4YjvItzcer6rNfmnjp8egMG7DQ6k Le4wzSB5lvlWFi8SYqRPJrXDmP8L+YLoVudote3dIrAgoQAq8Z3AWr2LOcQO+QpWczpv 4MsJdvDf6DX91N6szTKDrfQ7rQv7eJhxcI/IxKsRoHpRACnXL4CUyTD1F/1LX4U2cgxv q5wzFyt48MAkJCdEtVPF8h9na1Kevfr0dxgAluE93wT5MUYEFVNJi34suTRK2kVzhAab Uo+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ro9gttmR; 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=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 j3si15244009pfu.291.2022.01.24.12.49.28; Mon, 24 Jan 2022 12:49:41 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=Ro9gttmR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377090AbiAXUEz (ORCPT + 99 others); Mon, 24 Jan 2022 15:04:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356708AbiAXTrE (ORCPT ); Mon, 24 Jan 2022 14:47:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9E0BC038ADE; Mon, 24 Jan 2022 11:22:47 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6EF6EB810BD; Mon, 24 Jan 2022 19:22:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3A3EC340E5; Mon, 24 Jan 2022 19:22:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052166; bh=HJF1USL0tK5yt1VH2wuXAGk9bp4CfHgV/w0pSwgs8ZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ro9gttmReiYHy/V5lWEX2sIWoooyoGRFLnBALRlp4V+yiY3UG1Xk5oYsK/UyDmCx7 rfVhQaNeuhZ41QVKXvCK3SKqG60VhsZeXyNRiTKkgZdA/3jplIiwdL0S2w3HRwvIr0 9y+LwqGg51B9pJUDS1hThmXOREC2HcPRr6CI7rcc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pascal Paillet , Mark Brown , Andre Kalb Subject: [PATCH 4.19 209/239] regulator: core: Let boot-on regulators be powered off Date: Mon, 24 Jan 2022 19:44:07 +0100 Message-Id: <20220124183949.754390300@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183943.102762895@linuxfoundation.org> References: <20220124183943.102762895@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: Pascal Paillet commit 089b3f61ecfc43ca4ea26d595e1d31ead6de3f7b upstream. Boot-on regulators are always kept on because their use_count value is now incremented at boot time and never cleaned. Only increment count value for alway-on regulators. regulator_late_cleanup() is now able to power off boot-on regulators when unused. Fixes: 05f224ca6693 ("regulator: core: Clean enabling always-on regulators + their supplies") Signed-off-by: Pascal Paillet Link: https://lore.kernel.org/r/20191113102737.27831-1-p.paillet@st.com Signed-off-by: Mark Brown Acked-by: Andre Kalb Signed-off-by: Greg Kroah-Hartman --- drivers/regulator/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1211,7 +1211,9 @@ static int set_machine_constraints(struc rdev_err(rdev, "failed to enable\n"); return ret; } - rdev->use_count++; + + if (rdev->constraints->always_on) + rdev->use_count++; } print_constraints(rdev);