Re: [PATCH 6/9] regulator: da9121: Update registration to support multiple buck variants

From: Mark Brown
Date: Fri Nov 20 2020 - 08:06:52 EST


On Fri, Nov 20, 2020 at 12:14:56PM +0000, Adam Ward wrote:

> Checks DT matches tally with variant maximum and register accordingly.

This changelog doesn't really explain what the change is supposed to
be doing or why which makes it very hard to review, and the code is far
from obvious. I can't really tie much of the change to the words here.

> + if (max_matches > variant_parameters[chip->variant_id].num_bucks) {
> + dev_err(chip->dev, "Too many regulators in the DT\n");
> + ret = -EINVAL;
> + goto error;
> + }

If this validation is needed it should be in the regulator core.

> + for (i = 0; i < max_matches; i++) {
> + const struct regulator_desc *regl_desc =
> + local_da9121_regulators[chip->variant_id][i];
> + int id = regl_desc->id;
> + struct gpio_desc *gpio_ren;
> +
> + if (chip->pdata->gpiod_ren[i])
> + gpio_ren = chip->pdata->gpiod_ren[i];
> + else
> + gpio_ren = NULL;
> +
> + config.init_data = chip->pdata->init_data[i];
> + config.dev = chip->dev;
> + config.driver_data = chip;
> + config.regmap = chip->regmap;
> + config.of_node = chip->pdata->reg_node[i];

I *think* this is all open coding the core's DT parsing support.

Attachment: signature.asc
Description: PGP signature