From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932819AbdBPRZE (ORCPT ); Thu, 16 Feb 2017 12:25:04 -0500 Received: from ec2-52-27-115-49.us-west-2.compute.amazonaws.com ([52.27.115.49]:50961 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932492AbdBPRZD (ORCPT ); Thu, 16 Feb 2017 12:25:03 -0500 Subject: Re: [PATCH] regulator: core: Resolve supplies before disabling unused regulators To: linux-kernel@vger.kernel.org References: <20170216170629.19927-1-javier@osg.samsung.com> Cc: Mauro Carvalho Chehab , Andi Shyti , Mark Brown , Shuah Khan , Inki Dae , Jon Hunter , Liam Girdwood From: Javier Martinez Canillas Message-ID: <66ae2ae3-7fac-76f2-6897-3b0a9dc46111@osg.samsung.com> Date: Thu, 16 Feb 2017 14:24:54 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170216170629.19927-1-javier@osg.samsung.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On 02/16/2017 02:06 PM, Javier Martinez Canillas wrote: > After commit 66d228a2bf03 ("regulator: core: Don't use regulators as > supplies until the parent is bound"), input supplies aren't resolved > if the input supplies parent device has not been bound. This prevent > regulators to hold an invalid reference if its supply parent device > driver probe is deferred. > > But this causes issues on some boards where a PMIC's regulator use as > input supply a regulator from another PMIC whose driver is registered > after the driver for the former. > > In this case the regulators for the first PMIC will fail to resolve > input supplies on regulators registration (since the other PMIC wasn't > probed yet). And when the core attempts to resolve again latter when > the other PMIC registers its own regulators, it will fail again since > the parent device isn't bound yet. > > This will cause some parent supplies to never be resolved and wrongly > be disabled on boot due taking them as unused. > > To solve this problem don't attempt to resolve the pending regulators > input supplies on regulator registration, but instead do it just once > before disabling the unused regulators. > > This also makes the regulator resolve logic more efficient since there > is no need to attempt to resolve the input supplies on each regulator > registration, and doing it once before disabling the unused is enough. > I just noticed that this last paragraph is not true. Removing the input supply resolve logic from regulator_registration() may cause issues for modules, since these will register regulators after late_initcall(). So I'll post a v2 leaving this part. Sorry for the noise. > Signed-off-by: Javier Martinez Canillas > Best regards, -- Javier Martinez Canillas Open Source Group Samsung Research America