From: Mark Brown on
On Tue, Jul 13, 2010 at 11:51:29AM +0530, Sundar Iyer wrote:

> + * @mask: mask to enable/disable regulator
> + * @enable: enable bits to enable the regulator

Presumably these two will always be identical?

> + * @typical_voltages: typical supported voltage table

Why typical - might the set of supported values change, and if they do
how will that be detected and handled?

> + ret = ab8500_read(info->ab8500, info->update_reg);
> + if (ret < 0)
> + dev_dbg(rdev_get_dev(rdev),
> + "couldnt read 0x%x register\n", info->update_reg);
> +
> + if (ret & info->mask)
> + return true;
> + else
> + return false;

This should return the error code if the read failed.

> +static int ab8500_get_best_voltage_index(struct regulator_dev *rdev,
> + int min_uV, int max_uV)
> +{
> + struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
> + int i;
> +
> + /* check the supported voltage */
> + for (i = 0; i < info->voltages_len; i++) {
> + if ((info->typical_voltages[i] >= min_uV) &&
> + (info->typical_voltages[i] <= max_uV))
> + return i;

The indentation here is confusing - the second line of the if () is
aligned with the return statement not the first line.

> + /* get the appropriate voltages within the range */
> + ret = ab8500_get_best_voltage_index(rdev, min_uV, max_uV);
> + if (ret < 0) {
> + dev_dbg(rdev_get_dev(rdev),
> + "coudlnt get best voltage for regulator\n");
> + }

Should return an error here.

> + /* set the registers for the request */
> + ret = ab8500_set_bits(info->ab8500, info->voltage_reg,
> + info->voltage_mask, ret);
> + if (ret < 0) {
> + dev_dbg(rdev_get_dev(rdev),
> + "couldnt set voltage reg for regulator\n");
> + return -EINVAL;

Should return the error you got back from set_bits() to provide maximum
information to the caller (besides, this isn't an invalid value - it's
an I/O issue).

> +static int ab8500_fixed_get_voltage(struct regulator_dev *rdev)
> +{
> + int regulator_id;
> + struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
> +
> + regulator_id = rdev_get_id(rdev);
> + if (regulator_id >= AB8500_NUM_REGULATORS)
> + return -EINVAL;
> +
> + return info->fixed_uV;
> +}
> +
> +static struct regulator_ops ab8500_ldo_fixed_ops = {
> + .enable = ab8500_regulator_enable,
> + .disable = ab8500_regulator_disable,
> + .is_enabled = ab8500_regulator_is_enabled,
> + .get_voltage = ab8500_fixed_get_voltage,
> +};

Should have list_voltage() support also ideally.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Mark Brown on
On Tue, Jul 13, 2010 at 07:39:32PM +0530, Sundar Iyer wrote:

> + * @mask: mask to enable/disable regulator
> + * @enable: bits to enable the regulator in normal(high power) mode

Have you addressed my comments here?

> + ret = ab8500_get_best_voltage_index(rdev, min_uV, max_uV);
> + if (ret < 0) {
> + dev_dbg(rdev_get_dev(rdev),
> + "coudlnt get best voltage for regulator\n");

Typo here. Also, shouldn't your error messages be errors rather than
debug output?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Sundar R IYER on
Hello Mark,

>> + * @mask: mask to enable/disable regulator
>> + * @enable: bits to enable the regulator in normal(high power) mode
>Have you addressed my comments here?
Sorry that I couldn't inline my replies into the patch itself :(. I changed the comments for the variable
from the previous patch set. But I agree I messed up!

Yes. The mask here is different for the fact that we have two enable bits; enable LP(low power)
mode and enable HP(high power). We enable only the HP modes and hence the different mask
for enable/disable as well as for the enable.

>> + ret = ab8500_get_best_voltage_index(rdev, min_uV, max_uV);
>> + if (ret < 0) {
>> + dev_dbg(rdev_get_dev(rdev),
>> + "coudlnt get best voltage for regulator\n");
>
>Typo here. Also, shouldn't your error messages be errors rather than
>debug output?
Yes. I will correct this.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Mark Brown on
On Tue, Jul 13, 2010 at 04:34:56PM +0200, Sundar R IYER wrote:

> >> + * @mask: mask to enable/disable regulator
> >> + * @enable: bits to enable the regulator in normal(high power) mode
> >Have you addressed my comments here?
> Sorry that I couldn't inline my replies into the patch itself :(. I changed the comments for the variable
> from the previous patch set. But I agree I messed up!

> Yes. The mask here is different for the fact that we have two enable bits; enable LP(low power)
> mode and enable HP(high power). We enable only the HP modes and hence the different mask
> for enable/disable as well as for the enable.

OK.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Mark Brown on
On Tue, Jul 13, 2010 at 04:34:56PM +0200, Sundar R IYER wrote:

> Sorry that I couldn't inline my replies into the patch itself :(. I changed the comments for the variable

Oh, and on this point you should either address things in reply to the
review comments or in the non-changelog part of the patch (after the
---).
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/