Re: [PATCH 2/4] regulator: core: Expose init_data to of_parse_cb

From: Bjorn Andersson
Date: Tue Mar 03 2015 - 11:16:16 EST


On Tue 03 Mar 04:50 PST 2015, Mark Brown wrote:

> On Mon, Mar 02, 2015 at 08:25:38PM -0800, Bjorn Andersson wrote:
>
> > Expose the newly created init_data to the driver's parse callback so
> > that it can futher enhance it with e.g. constraints of the regulator.
>
> Why would the driver need to do that? I guess I'll see later on in the
> series but the changelog should make that clear. Drivers aren't
> supposed to ever need to look at their init data, modifying the init
> data from what the machine provied is usually a red flag.
>

I think what you're getting at is that the init_data should come from a
board file or device tree. With the reworkings done in patch 4 this
makes more sense than it did before (e.g. I no longer call
of_get_regulator_init_data()).

However, by calling register_regulator() with dev->of_node being
non-NULL and desc->of_match being something that will match a DT entry
all init_data is now coming from device tree, through:

regulator_register()
regulator_of_get_init_data()
of_get_regulator_init_data()
of_get_regulation_constraints()

As this matches a regulator, there is no way for the driver (or anyone
else to affect the init_data).

The problem at hand is that there is nothing in this code path telling
the core that we can do DRMS - something we can figure out in the driver
by basically looking at the ops for the registering regulator.

> > This is needed because calling regulator_register() with a of_node and
> > of_match will overwrite the passed config->init_data. An alternative way
> > would be to merge the parsed init_data with the driver provided one.
>
> Put any explanation as to why the feature is needed in the changelog.

Point taken.

Let me know if you think I'm on a sane path with the above reasoning and
I can resend the patch with a better description of the problem at hand.

Regards,
Bjorn
--
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/