Re: [PATCH 2/4] regulator: tps65023: Set missing bit for updatecore-voltage

From: Mark Brown
Date: Thu Aug 04 2011 - 08:38:35 EST


On Thu, Aug 04, 2011 at 01:33:50PM +0200, Marcus Folkesson wrote:

> + if (vsel == tps->info[dcdc]->table_len) {
> + ret = -EINVAL;
> + } else {
> + ret = tps_65023_reg_write(tps, TPS65023_REG_DEF_CORE, vsel);
> +
> + /* Tell the chip that we have changed the value in DEFCORE
> + * and its time to update the core voltage
> + */
> + tps_65023_set_bits(tps, TPS65023_REG_CON_CTRL2,
> + TPS65023_REG_CTRL2_GO);
> + }
> +
> + return ret;

This seems convoluted and non-scalable if we add more things here - it'd
seem to be better to return an error and then have the write and so on
as part of the regular function rather than putting them within the else
clause.
--
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/