Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp25453ybj; Fri, 8 May 2020 05:48:29 -0700 (PDT) X-Google-Smtp-Source: APiQypIE3Y4/sMkQDQJayQCqA7opPBD6LPuIIZ2ty8xV0mzDn7Yz+oOV9GxOHobnY2fjAapQ0Ula X-Received: by 2002:aa7:df0a:: with SMTP id c10mr2000702edy.306.1588942109809; Fri, 08 May 2020 05:48:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588942109; cv=none; d=google.com; s=arc-20160816; b=NH+25RHrWkiJWAEWbyLsx9oZnSUSb5nXXNfWnsEVw7uPue+pxVhytwYqpratXEcx53 8iiujbu6hflTnBpq/JMbokwQJZOKKWbk5nR5NshWUabhKSe5MEx3Fcla+Ml5O5afpK/n AZ/jolK1QW5rQMouKHMPn086m1trdI/8b/0A8MiyIL3VGlwmKbsh7xlMntmv8akv/orZ FfFoZ/clJTmmu5sWC7iYYdRNt9z1ofPHO5VsbjXkk5B1WhdrXTvaIaOIAWH4E0QHkagr 9qqdrFJAeBu2Yy9/76a5JektLcQWxlh0A3EaYPFAFlmx7K//K0gXlvXXxjG38hq+Iyzi pN1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=rYlt7a4zpcoiRJw8Rz9DAS1OkCAalNaefXpGpSUA8tk=; b=fLZUC9ElYx/QBNxSonFISvkpWj7sAW94mmVbyxaKz/6/0cqjg9naTN/HjYbMwiNOqd +2VR3I3nF/TOH45kt4jyRYT664f8YX8vy5GGykW3AIbZvHmPbo4jDXZ6F0qre1klBbNV 0t0sJ2WBNG8lr37hTquHJSmlh1hbuABz/yvw86nEdzXPzJu18Of36Nabv+nqEAEA059S S7mRIFBBU1TtulLwytq2PKxMAYoH/iT7gW5cNA+UFcL0FGTeiEdSjlWRBJv0hGLFbXid rsz9qA5kH74hOw4Gyvuy+Fwam7gBxTebWcrs63z1jHNmgofaxvdaH4liyi/N5QB3M1YL J3mg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 23si878606ejn.282.2020.05.08.05.48.05; Fri, 08 May 2020 05:48:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728391AbgEHMnj (ORCPT + 99 others); Fri, 8 May 2020 08:43:39 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2166 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727105AbgEHMnb (ORCPT ); Fri, 8 May 2020 08:43:31 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.108]) by Forcepoint Email with ESMTP id 6032C5A5AE26CA40D204; Fri, 8 May 2020 13:43:30 +0100 (IST) Received: from localhost (10.47.95.97) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Fri, 8 May 2020 13:43:29 +0100 Date: Fri, 8 May 2020 13:43:07 +0100 From: Jonathan Cameron To: Dan Carpenter CC: Jonathan Cameron , Alexandru Ardelean , , , , Mark Brown Subject: Re: [PATCH] staging: iio: ad5933: rework probe to use devm_ function variants Message-ID: <20200508134307.0000233a@Huawei.com> In-Reply-To: <20200507095016.GC9365@kadam> References: <20200428093128.60747-1-alexandru.ardelean@analog.com> <20200502192542.63cc25a2@archlinux> <20200507095016.GC9365@kadam> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.95.97] X-ClientProxiedBy: lhreml743-chm.china.huawei.com (10.201.108.193) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 7 May 2020 12:50:16 +0300 Dan Carpenter wrote: > On Sat, May 02, 2020 at 07:25:42PM +0100, Jonathan Cameron wrote: > > On Tue, 28 Apr 2020 12:31:28 +0300 > > Alexandru Ardelean wrote: > > > +static void ad5933_cleanup(void *data) > > > +{ > > > + struct ad5933_state *st = data; > > > + > > > + clk_disable_unprepare(st->mclk); > > > + regulator_disable(st->reg); > > > > Please do two separate callbacks so that these can be handled > > in the correct places. I.e. you do something then immediately > > register the handler to undo it. > > > > Currently you can end up disabling a clock you haven't enabled > > (which I am fairly sure will give you an error message). > > Yeah. It does. > > It feels like we should just make a devm_ version of regulator_enable(). > Or potentially this is more complicated than it seems, but in that case > probably adding devm_add_action_or_reset() is more complicated than it > seems as well. > > regards, > dan carpenter It has been a while since that was last proposed. At the time the counter argument was that you should almost always be doing some form of PM and hence the regulator shouldn't have the same lifetime as the driver. Reality is that a lot of simple drivers either don't do PM or have elected to not turn the regulator off so as to retain state etc. Mark what do you think? Jonathan