Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2738705rda; Wed, 25 Oct 2023 10:50:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGSfN+w8xsUkz6gArMu3F7qVc7z23yrpsaNd4I3kBwYsiR9gPhs4DWf1yalX4lxMqGsWLqc X-Received: by 2002:a25:2302:0:b0:da0:50a9:a748 with SMTP id j2-20020a252302000000b00da050a9a748mr5136308ybj.11.1698256204139; Wed, 25 Oct 2023 10:50:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698256204; cv=none; d=google.com; s=arc-20160816; b=axhbqZ0M/eUSfXoaJ0Wk8zPiETztUnt6qm3Tleenv8M8OajNSZkju86jpCdqgyeyHT Qyns6ppvqhZNP6pFZwCUCXlkoDNE/QOC3uIvf/dIESNU8ufnsAYrPUZFdiSfZphDYJO5 gbjxw2VKaAzfVxtlmniK1jWYRIVw4HpV030LCvwPDxcYQAbwwhX7R1wpmbcbuZyDR6SF iWes0pL3cyM0zYx2VxW5QS+IZoq0DaB5WX+HGxZX+nFrYbsJ2oNYC4XKCsE5FeqIJEtR 0TM2xDcUlobGaw5RKWhxWWvbtWaNZyXGrYcurzOu5mhcR9Inanu3583rYiPZWPeV77my H5dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Kv5YhEdND3Kpl35X+UZFunA1VmN9N0YBFLogV1ApfOc=; fh=YQ8wwKeEXsGO9EzKM0M2f6nHKmHgXLM82kM0VfBaHr8=; b=sIA/P4rK7heznRWubmoF9VXRGv8sstT5Tx7D7cT/tk8c/5Ktr1NvTc2AmvU8S80FiY JtdRSZln5rElBxdNG9Uv+ypmnqFcyZih9QuKZDP0Q6oU0wuq2mTEcjcwO1lksbylX14J CPjk8b+KCulzes9cUuKnxN1d3gIPp2k6diq/Bpqeo8xZkTBjQ8SVie71VsYMaedwfu7N 8HFwPWq80IrAJc3Yxrzoqr/6qx0EPfCnGOKXyf1JnrVRNFt/KhwXUkExy4CWavr5ghAL ATNkysLuKhMaB92wQCR8YWDvrVt0Uqn0f2K2H3ziRsn/epKbOavXLw33nBGSry7w14A6 Dh3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PVjQaFBL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id w3-20020a25ac03000000b00d7bac6678absi11437306ybi.668.2023.10.25.10.50.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 10:50:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PVjQaFBL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 0DA82811F11D; Wed, 25 Oct 2023 10:50:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234217AbjJYRt6 (ORCPT + 99 others); Wed, 25 Oct 2023 13:49:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbjJYRty (ORCPT ); Wed, 25 Oct 2023 13:49:54 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98F7B137; Wed, 25 Oct 2023 10:49:52 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FF2EC433C7; Wed, 25 Oct 2023 17:49:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698256192; bh=GfTn7Xee+oCBAL1wjgkcyUybl3bF+IE0RYsaSIgCmWU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PVjQaFBLNuLj6tf0nMM9dkdTLSzQJ2nilbMLvi//5ZNnxBgCF498kCqxgeq5fD3TN Q+SMDQ84yCAnOf9RSjnqhg4NJ3UNy9b5LG8biq8Snl6E9B0pi+HooxzgGXo7ZgEqim rBKA79B7NH6YTf7G5Ens/K0U7uo9y0Skk6VNQkkZg6JPbUzA4LhSsP+T8EFfSd99cI lhveiAZ99EFtzU2M1rudgc9xKYdXf+AsrFnshRSKjSa7cTPgA8sc4iZAlc+ixQQxQY Qd5UwgADNsgp/qFmnaiPqPb1Ch6eJv9yeWGkq4JiivvSxHhcv4VB8TOUz2kZRv8OZG h0MfQvqXaGdDA== Date: Wed, 25 Oct 2023 18:49:47 +0100 From: Mark Brown To: Stephan Gerhold Cc: Liam Girdwood , Andy Gross , Bjorn Andersson , Konrad Dybcio , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stephan Gerhold Subject: Re: [PATCH RFC 1/2] regulator: core: Disable unused regulators with unknown status Message-ID: <802e7f15-029c-4eb6-b0d8-53d16f7da37a@sirena.org.uk> References: <20231004-reg-smd-unused-v1-0-5d682493d555@kernkonzept.com> <20231004-reg-smd-unused-v1-1-5d682493d555@kernkonzept.com> <80307316-f55e-4540-9c5f-655844c3b3f4@sirena.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="2sywMGf7CHfsxokJ" Content-Disposition: inline In-Reply-To: X-Cookie: There's no time like the pleasant. X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 25 Oct 2023 10:50:02 -0700 (PDT) --2sywMGf7CHfsxokJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Oct 24, 2023 at 10:57:38AM +0200, Stephan Gerhold wrote: > I think it does not change much for this patch, though. Even when > implemented in the core we still need to represent this situation > somehow for regulator_is_enabled(). Simply returning 0 (disabled) or > 1 (enabled) would be wrong. Do you think returning -EBUSY would be > appropriate for that? In these cases where we simply can't read the expectation is that we'll always be using the logical state - one way of thinking about it is that the operation is mostly a bootstrapping helper to figure out what the initial state is. A quick survey of users suggest they'll pretty much all be buggy if we start returning errors, and I frankly even if all the current users were fixed I'd expect that to continue to be a common error. I suppose that the effect of ignoring the possibility of error is like the current behaviour though. > The second challenge I see on a quick look is that both > qcom_smd-regulator.c and qcom-rpmh-regulator.c use their reference > counter internally in other function (e.g. to decide if a voltage change > should be sent, see "vreg->enabled" checks). I think we would also need > to add some rdev_is_enabled() function that would expose the core > reference counter to the driver? > Tracking the enable state in the driver (the way it is right now) is not > that much code, so I'm not entirely sure if we might actually end up > with more code/complexity when moving this to the core. We have to do the reference count in the core anyway since it's a reference count not just a simple on/off so it doesn't really cost us anything to make it available to drivers. --2sywMGf7CHfsxokJ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmU5VToACgkQJNaLcl1U h9DB4wf7BiRuxxpXWmgvX+9voz3yXyMjnGHpDT7SedjySMwy6VoNAI4SRRINPF7y IEMTL/lgYq89V0yfyp2HzXZJrjJ6nn+93l6fVj/0ya//0blP6du/EIsSpL2/fADl FqFVPo4hd7Vx6XwJGFm7H1O1iPn84xq2muca1fdOvi58KVDbLTtV/ewWKh9IhGNs NDCVv87dqn3QfIblJUEfOJRR5KKFb4LNdq8DzIdqAg93Pg7FsRtWpOL8/IOxpp9a uUGESQA7gpqtIM9bZxAaA1XH4jV+g8mxEtScpoSfLQgRZruKY1lkarGU0mUmKrbh h0V/GWJOTgdVf8sFflAYrBQtw8KB0w== =GKpo -----END PGP SIGNATURE----- --2sywMGf7CHfsxokJ--