Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp161014rwb; Wed, 10 Aug 2022 22:03:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR6cojMmGr5Ojd/9u5zsvGkRF4fFm5qzmZ5bUWPTprNRpHmkj6Qz6rK655aOY/wn2EfSh9dj X-Received: by 2002:a17:907:6e88:b0:730:e16e:b760 with SMTP id sh8-20020a1709076e8800b00730e16eb760mr21814680ejc.5.1660194187099; Wed, 10 Aug 2022 22:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660194187; cv=none; d=google.com; s=arc-20160816; b=RmwYjZzf3wwylHVe9ExYzELZZp7XaQ53HB348UZquVOCWOHD5iMJLBytHsmptBHvNN DVFeVuv1XWqUTB8cwGUqqG1wZgLeXjK6D3b8NzyO30xqbkkb2wpWIePgtL8MT0PKMWpJ L56aPvlU7ANGnUFUa82iZQTZiAJd5+PnpIhDFzpeBRiGAEP0U12aKngc8nRk+DuZ5EIY eIexD9DFr/oQk0XHbdt82MI2b2cDel2thmg/c72NgL2ejGf5hZXionkAzMQQaOQyz+ZB O6uTkjykYnO9bM28mYbzuKWI+edPyGWhFkGytoF0q5aakPfH/s+6z8ei2ppDY0yWTIxk /fQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=evbV2QSTh0jjb46dPJrBnRBIm6kqkgOSimjCzn6KZ6w=; b=JqYpy2seuGKb+FCzvepRGaoj48L0iV060g5arxbll+7hcOjJ5qLFB2pK2xaRWoUJ8G 7uoidZyxiuHvvBpKvGMr78Kep1f5XIkd16fqkSg2ZRcOCbHNfZHBzc3SkcTmgUqTPFyM czc03u0+RvLYxKjANM2bd3jNBFY/wlaBRiBiFu9HYYSEvRcNkEhZbpZGMjKJaxpZuC6C JvcSSzWe8ojIrbJhlmHMfA0fD/0HYWGINDeOJm1mV+3Hnb5Ity9EOg1uZrUEB7uWAXXb kirruTF3zNGLOaMW+zaxRGFn4EpKAziBe1oGuYUz3XyoTu9GAhKeWm8ZvouflVLpcL42 RfKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=B4WZkBZw; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x92-20020a50bae5000000b0043c12e736c7si13448129ede.485.2022.08.10.22.02.39; Wed, 10 Aug 2022 22:03:07 -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=@gmail.com header.s=20210112 header.b=B4WZkBZw; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233820AbiHKEu4 (ORCPT + 99 others); Thu, 11 Aug 2022 00:50:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233627AbiHKEux (ORCPT ); Thu, 11 Aug 2022 00:50:53 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1077F647E2 for ; Wed, 10 Aug 2022 21:50:52 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id z6so16606380lfu.9 for ; Wed, 10 Aug 2022 21:50:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc; bh=evbV2QSTh0jjb46dPJrBnRBIm6kqkgOSimjCzn6KZ6w=; b=B4WZkBZwZpVAxOKJXSp9lcyLT5gyyb2X3AWF8Xnmy2GIoylCEaK6I1czwsX/PHlU4V hmxMBUvSpMXmaRpjiAe/nOCHrZCu2D+F8fU+l6ZvgncszfBuJPF4DtXTwkdJI9l89hgo jLgih0AbwHLwRfbIvFg4uanGq1M5NCZlgV2mCHGvHZm6S/DQbljK5gRec8bL+XQJR4mh aWA1qBwk4/XXKGnKBR3ioFY/XZ6T8OcV75eVyhpdp6Fnra9K/eRZFmZzh12dFEPyEO9Y KP4o30+OiWtpoOfMJc/D4E4PMSnRWfMO2MeGCYMPKKa8zFvR5AHe5ByjELVCeTaFXdmH Qayw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=evbV2QSTh0jjb46dPJrBnRBIm6kqkgOSimjCzn6KZ6w=; b=x6F/i1WIPvzszEXhROUxJ4YYztJQ2MTenYEBUkQFhvdEytmEIIYyNs+FGgRHZ2yO2M 0UlX+zPn4HExvoZAKJpsdHB0KJs/4/4MV/9y9qFkjWk3OpliEDc8sKtvJFRFZfDZMdv6 PZQvqos97LWw7IphXrcAY4/W/euY36ohq5LC4uumImL30RBzPl1XNKFWO61C4qI/qVNU JqLahmHH0O25oanB7KH7UUNoCXuGjewxiLRLhoePSeCvMWKoKGFv6c590H33otp0bvbV ZXpNAnEoTxxfwdqSfestPkqvpUWbxz7SGHbbRjAKkfbbME8IzLVkGW6gF8FxRNmg61Sg yEwQ== X-Gm-Message-State: ACgBeo0P8eBEuREAt4m1M82A3kdXN9zxzJ1JWQMEJHc1NUjU7HMzpkRS 7VJCdW/0b69JzsnTWLGKcfx5e7WpTg8= X-Received: by 2002:a05:6512:4016:b0:48b:1e96:af0f with SMTP id br22-20020a056512401600b0048b1e96af0fmr11716360lfb.359.1660193450253; Wed, 10 Aug 2022 21:50:50 -0700 (PDT) Received: from ?IPV6:2001:14ba:16ee:fa00::9? (dc73szyyyyyyyyyyyyyft-3.rev.dnainternet.fi. [2001:14ba:16ee:fa00::9]) by smtp.gmail.com with ESMTPSA id f19-20020a056512361300b0048a8f119e7esm563636lfs.233.2022.08.10.21.50.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Aug 2022 21:50:49 -0700 (PDT) Message-ID: Date: Thu, 11 Aug 2022 07:50:49 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Content-Language: en-US To: Mark Brown Cc: matti.vaittinen@fi.rohmeurope.com, Liam Girdwood , linux-kernel@vger.kernel.org References: From: Matti Vaittinen Subject: Re: [RFC PATCH 2/7] regulator: Add devm helpers for get and enable In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,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 On 8/10/22 18:16, Mark Brown wrote: > On Wed, Aug 10, 2022 at 03:19:05PM +0300, Matti Vaittinen wrote: > >> In order to tackle the issue the suggested API does not return handle to the >> regulators - it really just provides the "get'n enable, then forget" >> solution. The consumers who use the suggested API to "devm get'n enable" >> will have had time manually controlling the regulator afterwards as they >> will not get the handle. I would almost claim that the pattern we nowadays >> see (devm_get, enable, add_action_or_reset(disable())) is more error prone >> as users seem to in many case be storing the regulator handle w/o any >> comment about the automated disable at detach. > > Hrm, right - that does help with that case. However we do need a bulk > version since that's an obvious problem case. I'll take a look at the bulk APIs and add them if they're not too complex. I'm a bit short on time as I was told I should be doing something we can show to a customer ;) As a result of this discussion - not returning the handle to struct regulator * sounds like a safest option here. I'll drop the RFC when I respin this (hopefully with the bulk-APIs and a few more converted drivers) Thanks for the input! Best Regards Matti Vaittinen -- Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~ Discuss - Estimate - Plan - Report and finally accomplish this: void do_work(int time) __attribute__ ((const));