Re: [PATCH 1/2] regulators: Add definition of regulator_set_voltage_time() for !CONFIG_REGULATOR

From: Viresh Kumar
Date: Wed Jun 04 2014 - 01:46:43 EST


On 3 June 2014 21:18, Mark Brown <broonie@xxxxxxxxxx> wrote:
> No, as I've explained repeatedly NULL is a perfectly valid regulator and

Okay, its been checked at multiple places already and that's obviously
wrong then.

> that's not going to work reliably. As I've previously requested please
> think about what happens to cpufreq if we fail to ramp voltages.

Okay, so here is the scenario:

- driver is generic (like cpufreq-cpu0) and some user platforms may have
regulator support and others might not..

- For platforms with regulators support, we _must_ check if the voltage
change is successful or not and fail if regulator_set_voltage() failed.

- But for platforms without regulators support (CONFIG_REGULATOR=n),
regulator_get() will return NULL (a valid regulator though) and
regulator_set_voltage() will fail. Because the platform doesn't care much
about regulators it must go on and change frequency as if nothing
happened.

How can we achieve both these requirements by a generic piece of
code?

The only way I could think of currently is by returning something
special like -ENOSYS from regulator_set_voltage() when
regulators aren't configured in kernel and check return value of
regulator_set_voltage() against this..

This also holds true for regulator_get_voltage() which is returning
-EINVAL currently..

Please share if you have some other solution in mind..
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/