Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752783AbcDUPer (ORCPT ); Thu, 21 Apr 2016 11:34:47 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:3283 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751555AbcDUPeq (ORCPT ); Thu, 21 Apr 2016 11:34:46 -0400 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Thu, 21 Apr 2016 08:34:39 -0700 Subject: Re: [PATCH 1/5] regulator: core: Resolve supply earlier To: Mark Brown References: <1460038959-21592-1-git-send-email-thierry.reding@gmail.com> <20160411140300.GH3351@sirena.org.uk> <20160411141101.GB27400@ulmo.ba.sec> <20160411141621.GI3351@sirena.org.uk> <5716059B.3080503@nvidia.com> <20160419154059.GW3217@sirena.org.uk> <57165857.5050809@nvidia.com> <20160420152143.GL3217@sirena.org.uk> CC: Thierry Reding , Liam Girdwood , From: Jon Hunter Message-ID: <5718F30F.2050704@nvidia.com> Date: Thu, 21 Apr 2016 16:34:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160420152143.GL3217@sirena.org.uk> X-Originating-IP: [10.21.132.108] X-ClientProxiedBy: UKMAIL101.nvidia.com (10.26.138.13) To UKMAIL101.nvidia.com (10.26.138.13) 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 Content-Length: 1001 Lines: 27 On 20/04/16 16:21, Mark Brown wrote: > * PGP Signed by an unknown key > > On Tue, Apr 19, 2016 at 05:09:59PM +0100, Jon Hunter wrote: >> On 19/04/16 16:40, Mark Brown wrote: > >>> This is *really* weird. Why would we need the list lock to do a >>> device_register()? > >> So I did not think that we would want someone to be able to >> look-up the regulator via of_find_regulator_by_node() until >> it had been registered successfully. In fact I believe that >> not locking around device_register() was causing some crashes >> when I was testing. > > What that's saying to me is that the device_register() is too early and > we shouldn't be registering the device until we're ready for it to be > used. True and in fact looking at the code some more I am not sure that the mutex actually would prevent someone from getting the regulator before it is completely setup. I have moved this to the end of the registration and seems to be fine. I will send out some patches for review. Cheers Jon