Re: [PATCH v5 3/5] regulator: of: Add regulator desc param to of_get_regulator_init_data()

From: Mark Brown
Date: Fri Nov 07 2014 - 11:21:33 EST


On Fri, Nov 07, 2014 at 02:00:03PM +0100, Javier Martinez Canillas wrote:

> - initdata = of_get_regulator_init_data(dev, np);
> sreg = devm_kzalloc(dev, sizeof(*sreg), GFP_KERNEL);
> if (!sreg)
> return -ENOMEM;
> - sreg->initdata = initdata;
> sreg->name = of_get_property(np, "regulator-name", NULL);
> rdesc = &sreg->rdesc;
> + initdata = of_get_regulator_init_data(dev, np, rdesc);
> + sreg->initdata = initdata;
> rdesc->name = sreg->name;
> rdesc->type = REGULATOR_VOLTAGE;
> rdesc->owner = THIS_MODULE;

This is using the regulator descriptor before it is initialized which
doesn't seem ideal...

> +++ b/include/linux/regulator/of_regulator.h
> @@ -6,6 +6,8 @@
> #ifndef __LINUX_OF_REG_H
> #define __LINUX_OF_REG_H
>
> +#include <linux/regulator/driver.h>
> +
> struct of_regulator_match {
> const char *name;
> void *driver_data;
> @@ -16,14 +18,16 @@ struct of_regulator_match {
> #if defined(CONFIG_OF)
> extern struct regulator_init_data
> *of_get_regulator_init_data(struct device *dev,
> - struct device_node *node);
> + struct device_node *node,
> + const struct regulator_desc *desc);

This is just adding the include to get the declaration of regulator_desc
as far as I can see, add a forward declaration of it instead.

Attachment: signature.asc
Description: Digital signature