[PATCH v3 2/2] regulator: mt6311: Add support for mt6311 regulator

Javier Martinez Canillas javier at dowhile0.org
Thu Jul 23 07:25:10 PDT 2015


Hello Henry,

On Thu, Jul 23, 2015 at 1:04 PM, Henry Chen <HenryC.Chen at mediatek.com> wrote:
> On Thu, 2015-07-23 at 11:07 +0200, Javier Martinez Canillas wrote:
>
>> > +
>> > +       if (ret < 0)
>> > +               dev_err(&i2c->dev, "Failed to initialize regulator: %d\n", ret);
>> > +
>>
>> I don't think this is necessary, you are already adding logs for all
>> the error conditions.
>
> Yes, I will remove it.
>
>>
>> > +       return ret;
>> > +}
>> > +
>> > +static const struct i2c_device_id mt6311_i2c_id[] = {
>> > +       {"mt6311", 0},
>> > +       {},
>> > +};
>> > +MODULE_DEVICE_TABLE(i2c, mt6311_i2c_id);
>> > +
>> > +#ifdef CONFIG_OF
>> > +static const struct of_device_id mt6311_dt_ids[] = {
>> > +       { .compatible = "mediatek,mt6311-regulator",
>> > +         .data = &mt6311_i2c_id[0] },
>> > +       {},
>> > +};
>> > +MODULE_DEVICE_TABLE(of, mt6311_dt_ids);
>> > +#endif
>> > +
>> > +static struct i2c_driver mt6311_regulator_driver = {
>> > +       .driver = {
>> > +               .name = "mt6311",
>> > +               .owner = THIS_MODULE,
>> > +               .of_match_table = of_match_ptr(mt6311_dt_ids),
>>
>> of_match_ptr() is NULL when CONFIG_OF is not defined so you don't need
>> the additional #ifdef
>> CONFIG_OF around mt6311_dt_ids.
>
> If CONFIG_OF is not defined and without #ifdef CONFIG_OF around
> mt6311_dt_ids, it will allocate a struct mt6311_dt_ids but no one used
> on here, right?
>

You are right, sorry for the noise.

> Henry
>

Best regards,
Javier



More information about the linux-arm-kernel mailing list