RE: [PATCH v2] regulator: add new regulator driver for lp872x

From: Kim, Milo
Date: Tue Jun 19 2012 - 03:01:39 EST



> > + if (chip == LP8720) {
> > + mask = LP8720_TIMESTEP_M;
> > + shift = LP8720_TIMESTEP_S;
> > + time_usec = &lp8720_time_usec[0];
> > + size = ARRAY_SIZE(lp8720_time_usec);
> > + } else if (chip == LP8725) {
> > + mask = LP8725_TIMESTEP_M;
> > + shift = LP8725_TIMESTEP_S;
> > + time_usec = &lp8725_time_usec[0];
> > + size = ARRAY_SIZE(lp8725_time_usec);
> > + } else {
> > + return -EINVAL;
> > + }
>
> This should be a switch statement.
>
> > +static int lp8725_buck_set_current_limit(struct regulator_dev *rdev,
> > + int min_uA, int max_uA)
> > +{
> > + struct lp872x *lp = rdev_get_drvdata(rdev);
> > + enum lp872x_regulator_id buck = rdev_get_id(rdev);
> > + int i, max = ARRAY_SIZE(lp8725_buck_uA);
> > + u8 addr, val;
> > +
> > + if (buck == LP8725_ID_BUCK1)
> > + addr = LP8725_BUCK1_VOUT2;
> > + else if (buck == LP8725_ID_BUCK2)
> > + addr = LP8725_BUCK2_VOUT2;
> > + else
> > + return -EINVAL;
>
> Again, switch statement.
>

In patch v3, some if-statements will be replaced with switch-statements.
Thank you.

Best Regards,
Milo
--
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/