Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2705956rwb; Mon, 15 Aug 2022 09:57:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR7pbPAJ7eGxUv5fcKuAJkao8dripc5gLMq3WGRc8A8je8B5m87AdliS37RAUlswx0ENAudn X-Received: by 2002:a17:907:3da7:b0:730:cae5:7f7d with SMTP id he39-20020a1709073da700b00730cae57f7dmr10865921ejc.711.1660582655601; Mon, 15 Aug 2022 09:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660582655; cv=none; d=google.com; s=arc-20160816; b=vkNZjfTI2ylYnsWv/7tkXJGXlawVBF+Ys1XUfATAP5Z3iU32rvBUm87oyFKlhFr+GJ l1W6eb9aJQdEq1LRZwXVrPNVudZLS8tq2GIpFR+Ic+BZB+tm9LmXL8fnQSFsTFRbYMYm Ebjzok3w6lig5Jm51eDwS9VU3hNg+1EZiXhzv6UVRSC/DDqUDsgLh7wpXMC4taZlC+hC RCJ1YOC5NgYKbY/SAVcuqcB+QOQFu+ot475FVVzIwErf9FFxHXnPN4VIsJTG1/FC5cea j24tBpt/auV5hsWU4rxiVKSv2VSHK44QkiK84wyXnCyEvxl4tGOeQSxEa3b9+wycXGM4 dJWg== 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=nhCiA50d76BoGRn81CHlJ8zZdkNP+XpW2YVYWwTKbAE=; b=M4B0nC0+NHgPlJQLPyKnJpxkCNRaJ1eJrzqGYkrvBt/n8cCsauNYYpvMQbqjB3Qrrh QLdOaAt/WYKwnR3t5b1IINUejL95Likj57xkCJ2iAchT5rY80Lz8RQUq1afApTCzUIpU xnNFesZplMc6+J8jjQj4FzxdUbTnKCYPTWkSqlidgCCQ5uBcZsK0kGE5aJ0rmRao6e9z TSOCyhkqeU+uiSD2rToYE2AAepT3WNPetO2ECBpLmDNVQqFY67QrxQZhBvEIRisCETdO 3mhCdV+v+p3MvhTDjk1E/vxa3bGtaCm1M3Tc3lbvm5o5yMh3iLH2Xo2sARjLxoqxF+/D fKXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rmTxXiWd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k9-20020a170906128900b007318588b4bbsi7020184ejb.54.2022.08.15.09.57.10; Mon, 15 Aug 2022 09:57:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rmTxXiWd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231731AbiHOQdY (ORCPT + 99 others); Mon, 15 Aug 2022 12:33:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229754AbiHOQdW (ORCPT ); Mon, 15 Aug 2022 12:33:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 753BA14D2A; Mon, 15 Aug 2022 09:33:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 39891B80EF0; Mon, 15 Aug 2022 16:33:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E692C433D6; Mon, 15 Aug 2022 16:33:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660581199; bh=kBOMgsseA60cqKb8ZaWTeKRcdiuM8BBVMgx3WGOT2Vw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rmTxXiWdCfaKxjfeSH/wn3LpbaEYrRaZCw1f92jgSGWCcG2dAITp6jUamOj/9Et5l NLxQdQJ6bRwiBMzF3WOgxKy/ruO+5WFA5KyvFSSpRu6Jp4vPceQTBAGYsxJnkRaDiF VQs4HiAFoB6wMNroGRnPP1YIk98jhwB97kSZHSmw+l5iAPSEtqIYeHeV+2kguNbDCh OMOaadd3jKZLNLo5Ra4binpuaeeuHjzws48ygCy26/f3fh0/Z6Z2lPNoKbe/MHMGoD GRXNAh75/ymq45hZtYg5HjEKzu7bs/86N8gD/EMtnzrZtzuqtoEpW8lvyZOhjfQys0 rKBQntmgxyAVw== Date: Mon, 15 Aug 2022 17:33:06 +0100 From: Mark Brown To: Laurent Pinchart Cc: Matti Vaittinen , Matti Vaittinen , dri-devel@lists.freedesktop.org, Johan Hovold , Neil Armstrong , Lars-Peter Clausen , Kevin Hilman , linux-kernel@vger.kernel.org, Daniel Vetter , linux-amlogic@lists.infradead.org, Greg Kroah-Hartman , linux-doc@vger.kernel.org, Jonathan Cameron , Andy Shevchenko , Liam Girdwood , Michael Hennerich , Miaoqian Lin , linux-arm-kernel@lists.infradead.org, Alexandru Tachici , Jerome Brunet , Andrzej Hajda , Jonathan Corbet , Guenter Roeck , Jonas Karlman , Stephen Boyd , Lorenzo Bianconi , Michael Turquette , Jernej Skrabec , Martin Blumenstingl , Jean Delvare , Alexandru Ardelean , linux-hwmon@vger.kernel.org, linux-clk@vger.kernel.org, Nuno =?iso-8859-1?Q?S=E1?= , Robert Foss , Aswath Govindraju , David Airlie , linux-iio@vger.kernel.org Subject: Re: (subset) [PATCH v2 0/7] Devm helpers for regulator get and enable Message-ID: References: <166057828406.697572.228317501909350108.b4-ty@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="EyxHVb4W1IFNOeWj" Content-Disposition: inline In-Reply-To: X-Cookie: We have ears, earther...FOUR OF THEM! X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 --EyxHVb4W1IFNOeWj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Aug 15, 2022 at 06:54:45PM +0300, Laurent Pinchart wrote: > - With devres, you don't have full control over the order in which > resources will be released, which means that you can't control the > power off sequence, in particular if it needs to be sequenced with > GPIOs and clocks. That's not a concern for all drivers, but this API > will creep in in places where it shouldn't be used, driver authours > should really pay attention to power management and not live with the > false impression that everything will be handled automatically for > them. In the worst cases, an incorrect power off sequence could lead > to hardware damage. I basically agree with these concerns which is why I was only happy with this API when Matti suggested doing it in a way that meant that the callers are unable to access the regulator at runtime, this means that if anyone wants to do any kind of management of the power state outside of probe and remove they are forced to convert to the full fat APIs. The general ordering concern with devm is that the free happens too late but for the most part this isn't such a concern with regulators, they might have delayed power off anyway due to sharing - it's no worse than memory allocation AFAICT. Given all the other APIs using devm it's probably going to end up fixing some bugs. For sequencing I'm not convinced it's much worse than the bulk API is anyway, and practically speaking I expect most devices that have problems here will also need more control over power anyway - it's certainly the common case that hardware has pretty basic requirements and is fairly tolerant. > - Powering regulators on at probe time and leaving them on is a very bad > practice from a power management point of view, and should really be > discouraged. Adding convenience helpers to make this easy is the wrong > message, we should instead push driver authors to implement proper > runtime PM. The stick simply isn't working here as far as I can see. --EyxHVb4W1IFNOeWj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmL6dUIACgkQJNaLcl1U h9BS1Qf/aJ5FfSf2ZpgAnj2K1EYyJTQAf5hxweM6P8/UPf0PG25qZnrQ04w2KT+U J0dyFRSYl6wQbpFV7qxu5fLJC4OGjrDvyUmF+FgpX4qXSZYWhspqlsH73vA5olJB JssncwLyZQcX9kCua0RpN2NZ0+L7PAywvZ87c+2Ss00YkuS4GSE3CmeK3AhmHYfP 4sjjQuZeLgAF3KmoG8ImBJh+a9aRORWWmvVboZ4reeEkMfnIC37kD92wTH6+ubec Rink1Toz39UYEOFWWLMmC9VkRDTunn4JGF6ei4tDrxADrV2aCJ+05N5wV7N0Eg/D 37fKiGeyHN4cc64BVj5NW6aFp6UfgQ== =aGMq -----END PGP SIGNATURE----- --EyxHVb4W1IFNOeWj--