From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from opensource.wolfsonmicro.com ([80.75.67.52]:42038 "EHLO opensource2.wolfsonmicro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751085Ab0LGWhJ (ORCPT ); Tue, 7 Dec 2010 17:37:09 -0500 Date: Tue, 7 Dec 2010 22:37:15 +0000 From: Mark Brown Subject: Re: [PATCH] regulator: debugfs: Adding debugfs functions into regulator framework Message-ID: <20101207223714.GA10566@opensource.wolfsonmicro.com> References: <1291668763-15734-1-git-send-email-bleong@codeaurora.org> <20101206222907.GA2425@opensource.wolfsonmicro.com> <1291690320.4150.1.camel@m0nster> <20101207115701.GC4698@rakim.wolfsonmicro.main> <2f8efbbd2ab7f88aa40a9c22a1fec0dc.squirrel@www.codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2f8efbbd2ab7f88aa40a9c22a1fec0dc.squirrel@www.codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org List-ID: To: Brandon Leong Cc: Daniel Walker , lrg@slimlogic.co.uk, davidb@codeaurora.org, linux-arm-msm@vger.kernel.org On Tue, Dec 07, 2010 at 02:04:02PM -0800, Brandon Leong wrote: [Please don't top post, and please quote properly - I've added a layer of quotation to my text.] > So is it decided that we should use BUG_ON() now? I'd prefer it, other people's mileage may vary. But please do also engage with the big picture stuff I was talking about. > Also, regarding this issue: > > > + if (val) > > > + err_info = regulator_enable(data); > > > + else > > > + err_info = regulator_disable(data); > > This isn't going to do what people expect - the refcounting really is > > going to surprise people, especially as you read back the physical > > enable/disable state through the same file. Abuse of this file is > > likely to confuse any actual consumers we have too. > ---- > Could you clarify the issue with this? All I am doing here is if the user > enters a "1", then enable, if the user enters a "0" then disable. Right, but remember that the regulator API does refcounting. Writing to the file won't always have an immediate effect, it'll update the refcount which may or may not do what's expected to the actual hardware. One other thing: your code checks for operations before it creates files but the operations may not be permitted by the constraints.