Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1670086ybc; Wed, 13 Nov 2019 02:29:47 -0800 (PST) X-Google-Smtp-Source: APXvYqwD5BHWJGVFT3FJ8YbZhme11LnefQMiBQ21iGRfVM86Yf1cjax3tq36rw30U4Xwo9k1d/Gf X-Received: by 2002:a50:90a8:: with SMTP id c37mr2613896eda.153.1573640987163; Wed, 13 Nov 2019 02:29:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573640987; cv=none; d=google.com; s=arc-20160816; b=DlkC+ieECXimquxaRDRwftWPrOAxEQWU77Y8nfz5HmjFa6dgUkrY4W7xGQxAVwYzuE ffdNfGnOUHqC8dTazQl1orckaV9PJzEDwXDdBqeCSkxDgY9kUGLBxFEshTJmV5ieAVhS ShSiJQ1AVe868Lc+2Faw0ZjTx+QS5niyea0R19k/kRb3l0F9WgR0qS9Q6CrfrfK3vgG9 wsqUR9RvMNMEQWutgdRgNKgYmJjgcI8Zv7HrfXFgcA2azfL3MFmgHTD04mFj13HQcp+h Q5I2LcoLPuXkVjDCzUgMvVG+X7C0mzsl8zhFheFTzgVmLgMhhzoqN4V7YyOriQQCxSeI balA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=tPNeF+gUJ+p9FLYAaHm+hEv7Xx4wJqHeqgH5XViL1ro=; b=oZOr5tPeFnKvteTY3SWX1Z8CSjkacIfYs6BSPDUQOwkg1qJbytPUkVx4R1ts7AajrM DhjoZLDwjjJNqXYfbt07eOGPhS+oNoziv9H2xHyoiG4lnyQ98ENQmgBinZOJs3QE8HUS PAbVtuNulrUd7lQVBYrVv4CV4LNVpR36pMAmF8uJ4sPS9fkZMLgnkYjUCPdTk51OLPMn R7TIdXgHYYZX8giY0/LwoZrb/0yISu2QKKq6Wjsv799y80Gitbc2wExGLjJcqnn806/z dWidYg0q3+PJgdJwtClJvCJ/DHDLJud5cSWbNNZskIZF67mVmX4LKuhqPPXb8oia/lyY Mfig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=iYel5SRo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l16si834011ejg.240.2019.11.13.02.29.22; Wed, 13 Nov 2019 02:29:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=iYel5SRo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727427AbfKMK1q (ORCPT + 99 others); Wed, 13 Nov 2019 05:27:46 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:7790 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727374AbfKMK1o (ORCPT ); Wed, 13 Nov 2019 05:27:44 -0500 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xADALxjA021509; Wed, 13 Nov 2019 11:27:39 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=STMicroelectronics; bh=tPNeF+gUJ+p9FLYAaHm+hEv7Xx4wJqHeqgH5XViL1ro=; b=iYel5SRoBGMshMr6OiqvlGHPStiBrjVszL1KYY85seAkF4FkTXtxlF0xbsbKOl8E8kiE 3h67NHTX9l1ov19E8qZpmFENFqNnkiq6sVX04ITvIfXUxGLS2Xj3b9rv8+Da9P5KDeTG z5JrSM0KXm/5G4e7QCyqrp3JomAAhnaoDwg4YveTpV++MS0BrhOLiHsNrug9lQgZlWRq epZbiTKltXew8JfSmRE0zYpaDixZwkkfFUdkIUbwjJpZ+7jsXgAWPZs/E189rTkjycPe lkflhg6Y719d+VYRfyDaCc0szsLSDuquYjHwe+H5Wcn+i0jdex4Pk0p8McQPNCY78Nv7 6g== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2w7psf7jbv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Nov 2019 11:27:39 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9FF0C100039; Wed, 13 Nov 2019 11:27:38 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag6node2.st.com [10.75.127.17]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 955102B52FE; Wed, 13 Nov 2019 11:27:38 +0100 (CET) Received: from localhost (10.75.127.47) by SFHDAG6NODE2.st.com (10.75.127.17) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Wed, 13 Nov 2019 11:27:38 +0100 From: Pascal Paillet To: , , CC: , Subject: [RFC] regulator: core: Let boot-on regulators be powered off Date: Wed, 13 Nov 2019 11:27:37 +0100 Message-ID: <20191113102737.27831-1-p.paillet@st.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG3NODE1.st.com (10.75.127.7) To SFHDAG6NODE2.st.com (10.75.127.17) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-13_02:2019-11-13,2019-11-13 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/regulator/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 970905124382..f01862844da6 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1403,7 +1403,9 @@ static int set_machine_constraints(struct regulator_dev *rdev, rdev_err(rdev, "failed to enable\n"); return ret; } - rdev->use_count++; + + if (rdev->constraints->always_on) + rdev->use_count++; } print_constraints(rdev); -- 2.17.1