Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1238712ybn; Wed, 25 Sep 2019 14:50:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgh1fv1aqwjseq8+3Fj1E8bHIQWBqMTTx6DSgvjGdV6ayIF0zPSnimKSXgsA4eJQpHQZJ/ X-Received: by 2002:a17:906:4801:: with SMTP id w1mr259727ejq.245.1569448201882; Wed, 25 Sep 2019 14:50:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569448201; cv=none; d=google.com; s=arc-20160816; b=g6+yN/QLYYaK/Ok5VQ8j3Z40HK/c47aaZPFDhwUKtCtn4JVXKkcPzyBTVzzHcLsGxy 2zd0tUTsjsGwpklc4uVBqCHjU6BWExRKBL39DSC02JNR+p2eLWc94U42OVBLu21nGTcz KEdk91+Ymf8O3eiE3nC5q68OxQZ7kjfT9Xc/4Bx56W5enD9Yd2IRLDbQnatpFD4fHIzo n8KLmbP+1x9fIlTx9o/wCJsWipoYEU3oXt5sXNs6MM8DxqphpbX+mjeZHQJ475o6O+pC ezbAA28ylfe8iGz7oSYyugo3l3xf6mNkl4OWpVrk53lB14Z6SIFGKVa3q25Q5J5P0Ee7 fqWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=EupMjxcDDxYMZCqO2iFI6bmVxPF+mEoAtji705sGeoM=; b=hqYIGSwkcu8dUW9jL6kXu/fmCg3C1JCtxHaKBNb5ZZy8HXfm2UByHm351eK8rnwYa2 OzmeuShok3P5VPwRAsb1t/0ayH/LJkwQKf0NlQUksni1VfbxUBoLRUOJ9nep4x5QRfoi 0OAUewLxgRtEFVIEWiuk0siCY/NOtWCPtmzTjCc0e/i0/5gfcGlsBWFfaY4UeF7lXH3k 5/Mj6gbQ+rgBq7cMGA7hYBKJZ0Y5iDJlxQwAd5CliVupBSiSPTL8Duw0ohYTPd5lkj9k BNhmthGhYKnxQ7ei8DIFYs9IV9B+RkMTNP0yqCHJJbJWeImwq9TA4sQMhColvzTWyA5m t5nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=EmbmpEoL; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13si172896eds.375.2019.09.25.14.49.38; Wed, 25 Sep 2019 14:50:01 -0700 (PDT) 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=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=EmbmpEoL; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733131AbfIWStP (ORCPT + 99 others); Mon, 23 Sep 2019 14:49:15 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:58452 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726243AbfIWStO (ORCPT ); Mon, 23 Sep 2019 14:49:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=EupMjxcDDxYMZCqO2iFI6bmVxPF+mEoAtji705sGeoM=; b=EmbmpEoL3Xmeaocc9MdnIip3Y HmmRxYS9VQT2JOSIMT+o488blJyrpX7cl3vp6zuBO3KqG4H6hV0jH7pAQ2dsVVl+w3reUN2AVAoW9 HHvAaJBrBef2/smHsezqgrMC9UhAZY55sz7nXzC7TDidgACXEOqqHu8y0uI/IP01Zg2Co=; Received: from [12.157.10.114] (helo=fitzroy.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iCTOX-0004e4-13; Mon, 23 Sep 2019 18:49:09 +0000 Received: by fitzroy.sirena.org.uk (Postfix, from userid 1000) id 56DA9D02D0B; Mon, 23 Sep 2019 19:49:07 +0100 (BST) Date: Mon, 23 Sep 2019 11:49:07 -0700 From: Mark Brown To: Doug Anderson Cc: Marco Felsch , zhang.chunyan@linaro.org, Liam Girdwood , ckeepax@opensource.cirrus.com, LKML , Sascha Hauer Subject: Re: [PATCH 1/3] regulator: core: fix boot-on regulators use_count usage Message-ID: <20190923184907.GY2036@sirena.org.uk> References: <20190917154021.14693-1-m.felsch@pengutronix.de> <20190917154021.14693-2-m.felsch@pengutronix.de> <20190923181431.GU2036@sirena.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="p19/OaUkOQckSefz" Content-Disposition: inline In-Reply-To: X-Cookie: Be careful! UGLY strikes 9 out of 10! User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --p19/OaUkOQckSefz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Sep 23, 2019 at 11:36:11AM -0700, Doug Anderson wrote: > On Mon, Sep 23, 2019 at 11:14 AM Mark Brown wrote: > > Boot on means that it's powered on when the kernel starts, it's > > for regulators that we can't read back the status of. > 1. Would it be valid to say that it's always incorrect to set this > property if there is a way to read the status back from the regulator? As originally intended, yes. I'm now not 100% sure that it won't break any existing systems though :/ > 2. Would this be a valid description of how the property is expected to behave > a) At early boot this regulator will be turned on if it wasn't already on. > b) If no clients are found for this regulator after everything has > loaded, this regulator will be automatically disabled. > If so then I don't _think_ #2b is happening, but I haven't confirmed. > > boot-on just refers to the status at boot, we can still turn > > those regulators off later on if we want to. > How, exactly? As of my commit 5451781dadf8 ("regulator: core: Only > count load for enabled consumers") if you do: > r = regulator_get(...) > regulator_disable(r) > ...then you'll get "Underflow of regulator enable count". In other > words, if a given regulator client disables more times than it enables > then you will get an error. Since there is no client that did the > initial "boot" enable then there's no way to do the disable unless it > happens automatically (as per 2b above). It should be possible to do a regulator_disable() though I'm not sure anyone actually uses that. The pattern for a regular consumer should be the normal enable/disable pair to handle shared usage, only an exclusive consumer should be able to use just a straight disable. > ...or do you mean that people could call regulator_force_disable()? > Couldn't they also do that with an always-on regulator? No, nothing should use that in a non-emergency situation. --p19/OaUkOQckSefz Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl2JE6IACgkQJNaLcl1U h9D1yAf+J7IlRKZcRaDe46unExgr97b1dbhBAvQGi0SxLxQ4EwdRl6wd3cN02SEY j2G6C92Szw0KTwKMtWhTaxTDtF9Cw/nWPpl/gGyrJPXkTV2FnuFdrx3AfpYyRJzL VZ76RHjVsIFkVak8ZS2NwiFVGGyd87P9mpav/adObdxfmXpZbELhMuZTZ3G8GLbs X9ApzhsR66b1QcSH5V+yfIoEza1QOmAdvxzrNyS0unW9OjArdPrOE9YUFRDhGwAP t4RrGlAua/21M3uuY36vvloQ48FAy2Pr8rqLFyFKRDdYnaUP8Xm1oV7twUPe6SFd wnbJIIGFCJOTJ9MC3nNUjd2inNpZiw== =rhg2 -----END PGP SIGNATURE----- --p19/OaUkOQckSefz--