Re: [RFC PATCH 2/2] regulator: add boot protection flag

From: Mark Brown
Date: Tue Apr 26 2016 - 12:36:38 EST


On Tue, Apr 26, 2016 at 07:46:07PM +0800, Pingbo Wen wrote:

> > This is still a complete hack which is going to break as soon as things
> > are built modular, it's definitely *not* something that should ever
> > appear in DT since it depends so heavily on implementation details. If
> > you need some driver to start early work on getting that sorted.

> I think this patch can handle the case you mentioned. I have add a
> regulator_has_booted flag, and it will set in regulator_init_complete()
> late_initcall hook. The regulator_ops_is_valid() will ignore boot
> protection if this flag is set.

That doesn't help after we get to userspace so doesn't work as soon as
things are built as modules. That's a key issue with making something
that's robust here.

> > This is also going to interact badly with any other drivers that are
> > trying to configure things at runtime, if they've done enables and
> > disables (or especially an enable without a matching disable) their

> Ok, I have to admit that the boot_protection didnât cover this. If other
> consumer try to configure during booting, it will get some error code.
> And the consumers need to re-configure the regulator state after
> late_initcall.

The worst thing is where we silently accept but forget about things
because the code currently translates them into valid noops then later
start paying attention to the operations, error codes at least the other
driver can handle.

> If we need to hold the state of other consumer, I prefer using a
> dummy-consumer to hold this. And this is my next try.

Or possibly store the data on the consumer but don't act on it then go
round actually acting on it when we decide to do things - that's more
what I'd have expected and seems like it might be easier than creating a
separate object.

Attachment: signature.asc
Description: PGP signature