Re: [PATCH v2] regulator: pfuze100: add pfuze100 regulator driver
From: Robin Gong
Date: Mon Jul 15 2013 - 02:36:14 EST
Shawn, Thanks for your carefully review and I will correct it and send the patch again. some comments below:
> > +
> > +struct pfuze_regulator {
> > + struct regulator_desc desc;
> > + unsigned char stby_reg;
> > + unsigned char stby_mask;
> > +};
> > +
> > +enum pfuze_id {
> > + PFUZE_ID_PFUZE100,
> > + PFUZE_ID_INVALID,
> > +};
>
> Have a blank line here.
>
> Is there any other valid ID other than PFUZE_ID_PFUZE100? If not, we
> may not need this pfuze_id at all. All the use of it is in
> pfuze_identify() for dev_info output.
>
Yes, Now there is only one chip PFUZE100 here, but I'm told before there will be a series of pfuze family such as PFUZE101,PFUZE102..etc, so I keep the place for future.
> > +struct pfuze_chip {
> > + struct pfuze_regulator *regulators_desc;
> > + int num_regulators;
> > + struct regmap *regmap;
> > + struct device *dev;
> > + enum pfuze_id chip; /*chip type*/
>
> /* comment */
>
> Also I do not see much necessity of this member. It's only used in
> function pfuze_identify(), from what I can see.
>
Ditto
> > + struct regulator_dev *regulators[];
> > +};
> > +
> > +static struct regulator_ops pfuze100_ldo_regulator_ops;
> > +static struct regulator_ops pfuze100_fixed_regulator_ops;
> > +static struct regulator_ops pfuze100_sw_regulator_ops;
> > +static struct regulator_ops pfuze100_swb_regulator_ops;
> > +
> > +static const int pfuze100_swbst[] = {
> > + 5000000, 5050000, 5100000, 5150000,
> > +};
> > +
> > +static const int pfuze100_vsnvs[] = {
> > + 1000000, 1100000, 1200000, 1300000, 1500000, 1800000, 3000000,
> > +};
> > +
> > +static const struct i2c_device_id pfuze_device_id[] = {
> > + {.name = "pfuze100", .driver_data = PFUZE_ID_PFUZE100},
>
> You do not use .driver_data in the driver at all, and can just drop it.
>
> > + {},
> > +};
> > +MODULE_DEVICE_TABLE(i2c, pfuze_device_id);
> > +
> > +
>
> Drop one blank line.
>
> > +static const struct of_device_id pfuze_dt_ids[] = {
> > + { .compatible = "fsl,pfuze100", .data = (void *)PFUZE_ID_PFUZE100},
>
> You do not use .data in the driver at all, and can just drop it.
>
good catch. .driver_data of i2c_device_id and .data of of_device_id are two different ways to let driver know which chip used now by DTS or not. I should use them to know which chip used now ,although I can know by reading chipid register.
--
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/