From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26D10C433F5 for ; Mon, 24 Jan 2022 19:52:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348331AbiAXTwb (ORCPT ); Mon, 24 Jan 2022 14:52:31 -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: stable@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);