public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Lists linaro-kernel <linaro-kernel@lists.linaro.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Arvind Chauhan <arvind.chauhan@arm.com>,
	Eduardo Valentin <edubezval@gmail.com>,
	Pavel Machek <pavel@ucw.cz>, Liam Girdwood <lgirdwood@gmail.com>
Subject: Re: [PATCH 1/2] regulators: Add definition of regulator_set_voltage_time() for !CONFIG_REGULATOR
Date: Mon, 2 Jun 2014 16:20:14 +0100	[thread overview]
Message-ID: <20140602152014.GL31751@sirena.org.uk> (raw)
In-Reply-To: <CAKohpo=vPojhX_9u6Coa=2Kiu0jY9hCTg2B0WiWfJS8ZQxK4Rg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2165 bytes --]

On Mon, Jun 02, 2014 at 06:44:35PM +0530, Viresh Kumar wrote:
> On 2 June 2014 17:53, Mark Brown <broonie@kernel.org> wrote:

> > If the consumer tried to set a voltage presumably it cares if that
> > voltage was set - for example if your cpufreq driver tries to increase
> > the voltage of a core supply so that it can then raise the frequency the
> > user is going to be upset if the voltage was not actually raised and it
> > goes off and raises the clock rate causing the system to become unstable.

> If the driver continued despite getting regulator as NULL, it means that
> regulator isn't a MUST for it. For example a CPUFreq driver may work
> with or without a regulator.

No, NULL is a perfectly valid regulator - the *only* thing that a caller
should check for is IS_ERR().  You are missing the point of the stubs,
and indeed the fact that real physical supplies can have exactly the
same limitations as the dummy supplies do and therefore the presence of
a physical regulator should not in itself indcate anything about what
you can do with it.

> Now if the dummy calls return *error* for some cases then these driver
> will have to do
> if(xyz)
>     API-call()..

Consumers should be implementing error checking code regardless.  If we
don't need to implement any error checking there's rather a lot of the
kernel we can go and delete...

> And so dummy APIs like clk_set_rate(), clk_get_rate(),
> regulator_set_voltage() must return zero..

Please re-read and think about my CPUfreq example.  How do you expect
that to work sanely if we don't care if any of the operations worked?

> To get rid of this in drivers these dummy routines *must* behave as
> they passed, if the drivers really care about them then they must
> quit as soon as regulator_get() returned NULL.

> This is why we have such implementations in clk framework which are
> very well thought earlier.

> Does this make sense?

No, not at all and I don't think it applies to the clock API either -
it's got similar issues with real physical clocks not always supporting
all operations.  Consider for a moment what happens if we try to set and
then use a clock rate ona fixed clock.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2014-06-02 16:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-27 12:07 [PATCH 1/2] regulators: Add definition of regulator_set_voltage_time() for !CONFIG_REGULATOR Viresh Kumar
2014-05-27 12:07 ` [PATCH V2 2/2] cpufreq: cpufreq-cpu0: remove dependency on THERMAL and REGULATOR Viresh Kumar
2014-05-27 19:29 ` [PATCH 1/2] regulators: Add definition of regulator_set_voltage_time() for !CONFIG_REGULATOR Mark Brown
2014-05-27 23:12   ` Rafael J. Wysocki
2014-05-28 17:37     ` Mark Brown
2014-05-28 16:29   ` Viresh Kumar
2014-05-28 17:38     ` Mark Brown
2014-06-02  7:20       ` Viresh Kumar
2014-06-02  9:51         ` Mark Brown
2014-06-02  9:54           ` Viresh Kumar
2014-06-02 10:02             ` Mark Brown
2014-06-02 10:15               ` Viresh Kumar
2014-06-02 12:23                 ` Mark Brown
2014-06-02 13:14                   ` Viresh Kumar
2014-06-02 15:20                     ` Mark Brown [this message]
2014-06-02 16:55                       ` Viresh Kumar
2014-06-03 10:52                         ` Mark Brown
2014-06-03 14:40       ` Viresh Kumar
2014-06-03 14:53         ` Mark Brown
2014-06-03 15:22           ` Viresh Kumar
2014-06-03 15:32             ` Mark Brown
2014-06-03 15:35               ` Viresh Kumar
2014-06-03 16:02                 ` Mark Brown
2014-06-03 15:25           ` Viresh Kumar
2014-06-03 15:48             ` Mark Brown
2014-06-04  5:46               ` Viresh Kumar
2014-06-04 10:38                 ` Mark Brown
2014-06-04 10:57                   ` Viresh Kumar
2014-06-04 12:33                     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140602152014.GL31751@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=arvind.chauhan@arm.com \
    --cc=edubezval@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox