From patchwork Wed Apr 23 23:10:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 4045061 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8080C9F1F4 for ; Wed, 23 Apr 2014 23:12:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AEA38202E6 for ; Wed, 23 Apr 2014 23:12:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BFB8F202DD for ; Wed, 23 Apr 2014 23:12:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752052AbaDWXMO (ORCPT ); Wed, 23 Apr 2014 19:12:14 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:46789 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751126AbaDWXMN (ORCPT ); Wed, 23 Apr 2014 19:12:13 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s3NNBYEB023798; Wed, 23 Apr 2014 18:11:34 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3NNBY3q002312; Wed, 23 Apr 2014 18:11:34 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Wed, 23 Apr 2014 18:11:34 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3NNBY5s028064; Wed, 23 Apr 2014 18:11:34 -0500 From: Nishanth Menon To: Mark Brown CC: , , , Saravana Kannan , Liam Girdwood , Markus Pargmann , Nishanth Menon Subject: [RESEND PATCH] regulator: core: Disable unused regulators after deferred probing is done Date: Wed, 23 Apr 2014 18:10:50 -0500 Message-ID: <1398294650-24821-1-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Saravana Kannan regulator_init_complete does a scan of regulators which dont have always-on or consumers are automatically disabled as being unused. However, with deferred probing, late_initcall() is too soon to declare a regulator as unused as the regulator itself might not have registered due to defferal - Example: A regulator deffered due to i2bus not available which in turn is deffered due to pinctrl availability. Since deferred probing is done in late_initcall(), do the cleanup of unused regulators by regulator_init_complete in late_initcall_sync instead of late_initcall. Cc: Liam Girdwood Cc: Mark Brown Cc: Markus Pargmann Signed-off-by: Saravana Kannan [nm@ti.com: minor rewording] Signed-off-by: Nishanth Menon --- Applies on v3.15-rc2 and on next-20140423 Original post: https://patchwork.kernel.org/patch/2545061/ I rediscovered this patch many times now :(: Latest Example: https://patchwork.kernel.org/patch/4044811/ http://slexy.org/raw/s21MCHgeJo shows none of the unused regulators are disabled and with this fix: http://slexy.org/raw/s2TH36cThR (which auto disables unused regulators). Ccying Markus as author of 66fda75f47dc (regulator: core: Replace direct ops->disable usage) he might be interested as well. Btw, this might open up a lot of broken boards - like we discovered for DRA7 - so it might be a good idea for next instead of current rc cyle giving it some time to cook and get platforms fixed. drivers/regulator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 9a09f3c..5a05de3 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -3867,4 +3867,4 @@ unlock: return 0; } -late_initcall(regulator_init_complete); +late_initcall_sync(regulator_init_complete);