Re: [PATCH 3/4] RK808: Add rk808 regulator driver

From: Mark Brown
Date: Sun Aug 17 2014 - 10:07:35 EST


On Sun, Aug 17, 2014 at 10:00:39AM +0800, Chris Zhong wrote:
> The regulator module consists of 4 DCDCs, 8 LDOs and 2 switches.
> The output voltages are configurable and are meant to supply power
> to the main processor and other components

Looks very good - a few small nits below but otherwise fine. Please use
subject lines matching the style for the subsystem (regulator: in this
case).

> + reg_np = of_find_node_by_name(np, "regulators");
> + if (!reg_np)
> + return -ENXIO;

This needs to be find_child_by_name() otherwise it'll search the entire
device tree and might match other regulators in the system.

> + count = of_regulator_match(rk808->dev, reg_np, rk808_reg_matches,
> + rk808_NUM_REGULATORS);

Should really use RK808_NUM_REGULATORS as the name of the constant -
defines are always upper case.

> + pdata = rk808->pdata;
> + if (!pdata) {
> + dev_err(rk808->dev, "%s no pdata\n", __func__);
> + return -ENODEV;
> + }

Missing platform data should be fine for a regulator driver, it should
be able to start up and let the user read back how the device is
configured.

> + if (reg_data->constraints.name)
> + rail_name = reg_data->constraints.name;
> + else
> + rail_name = rk808_reg[i].name;

Don't do this, just use the rk808_reg name - the regulator core will
take care of applying the name from the constraints.

> + reg_data->supply_regulator = rail_name;

This should be fixed in the driver, it should be whatever the name the
device uses for the supply in the datasheet.

> + rk808_rdev = regulator_register(&rk808_reg[i], &config);
> + if (IS_ERR(rk808_rdev)) {

devm_regulator_register() and then you don't need to clean up on
removal.

> +MODULE_DESCRIPTION("regulator driver for the rk808 series PMICs");
> +MODULE_AUTHOR("Chris Zhong<zyw@xxxxxxxxxxxxxx>");
> +MODULE_AUTHOR("Zhang Qing<zhanqging@xxxxxxxxxxxxxx>");

Should have a space before the < here.

Attachment: signature.asc
Description: Digital signature