From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751231AbdBWHZ0 (ORCPT ); Thu, 23 Feb 2017 02:25:26 -0500 Received: from mail-vk0-f45.google.com ([209.85.213.45]:36324 "EHLO mail-vk0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750944AbdBWHZY (ORCPT ); Thu, 23 Feb 2017 02:25:24 -0500 MIME-Version: 1.0 In-Reply-To: <20170221185634.hzlsfap4746qev7u@sirena.org.uk> References: <20170213023249.GA27688@dtor-ws> <20170213180129.wutjitdr72klhxwu@sirena.org.uk> <20170213185152.GC20057@dtor-ws> <20170220190258.fympxa43cdrzd44b@sirena.org.uk> <20170221083003.GA21739@dtor-ws> <20170221185634.hzlsfap4746qev7u@sirena.org.uk> From: Dmitry Torokhov Date: Wed, 22 Feb 2017 23:25:22 -0800 Message-ID: Subject: Re: [PATCH v2] regulator: devres: introduce managed enable and disable operations To: Mark Brown Cc: Liam Girdwood , Guenter Roeck , lkml Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 21, 2017 at 10:56:34AM -0800, Mark Brown wrote: > On Tue, Feb 21, 2017 at 12:30:03AM -0800, Dmitry Torokhov wrote: > > On Mon, Feb 20, 2017 at 11:02:58AM -0800, Mark Brown wrote: > > > On Mon, Feb 13, 2017 at 10:51:52AM -0800, Dmitry Torokhov wrote: > > > But that is what I meant here about managed action. You are not > > interacting with managed regulator here, you have managed enable. There > > is absolutely nothing preventing you from calling > > devm_regulator_enable() on a regulator that was obtained with > > regulator_get() (i.e. non-managed). > > That's not the point, the point is using both devm_regulator_enable() > and regulator_enable() and so on. I understand that you have objection that devm_regulator_enable() and regulator_enable() can be used together, I just do not see it being a problem in practice. I still think we need a way for the drivers to "undo" the enable automatically. Do you have some other idea how to achieve this? Do you maybe want regulator_put() to undo all outstanding disables for the regulator? Then drivers would not need to care about disabling regulators in error paths/driver teardown. Where would you want to take the API? Thanks. -- Dmitry