> Cc: Lee Jones <lee.jo...@linaro.org>
> Cc: Linus Walleij <linus.wall...@linaro.org>
> Cc: Mark Brown <broo...@kernel.org>
> Cc: Samuel Ortiz <sa...@linux.intel.com>
> Cc: Thierry Reding <thierry.red...@gmail.com>
> Signed-off-by: Milo Kim <milo....@ti.com>
> ---
>  drivers/mfd/Kconfig        |   11 +++
>  drivers/mfd/Makefile       |    1 +
>  drivers/mfd/lp3943.c       |  165 
> ++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/lp3943.h |  115 ++++++++++++++++++++++++++++++
>  4 files changed, 292 insertions(+)
>  create mode 100644 drivers/mfd/lp3943.c
>  create mode 100644 include/linux/mfd/lp3943.h

<snip> * looks good up to me up to here *

Although, I think the 0 = 1, 1 = 2 ... stuff is really confusing. Is
there nothing we can do about that?

> +static int lp3943_probe(struct i2c_client *cl, const struct i2c_device_id 
> *id)
> +{
> +     struct lp3943 *lp3943;
> +     int ret;
> +
> +     lp3943 = devm_kzalloc(&cl->dev, sizeof(*lp3943), GFP_KERNEL);
> +     if (!lp3943)
> +             return -ENOMEM;
> +
> +     lp3943->regmap = devm_regmap_init_i2c(cl, &lp3943_regmap_config);
> +     if (IS_ERR(lp3943->regmap)) {
> +             ret = PTR_ERR(lp3943->regmap);

Bit of a nit. 

Why don't you: return PTR_ERR(lp3943->regmap);

> +             dev_err(&cl->dev, "Regmap init error: %d\n", ret);
> +             return ret;
> +     }
> +
> +     lp3943->pdata = cl->dev.platform_data;

Can you change this to use the helper?

dev_get_platdata()

> +     lp3943->dev = &cl->dev;
> +     lp3943->mux_cfg = lp3943_mux_cfg;
> +     i2c_set_clientdata(cl, lp3943);
> +
> +     ret = mfd_add_devices(lp3943->dev, -1, lp3943_devs,
> +                     ARRAY_SIZE(lp3943_devs), NULL, 0, NULL);
> +     if (ret) {
> +             dev_err(lp3943->dev, "failed to add MFD devices: %d\n", ret);
> +             return ret;
> +     }
> +
> +     return 0;
> +}
> +
> +static int lp3943_remove(struct i2c_client *cl)
> +{
> +     struct lp3943 *lp3943 = i2c_get_clientdata(cl);
> +
> +     mfd_remove_devices(lp3943->dev);
> +     return 0;
> +}
> +
> +static const struct i2c_device_id lp3943_ids[] = {
> +     { "lp3943", 0 },
> +     { }
> +};
> +MODULE_DEVICE_TABLE(i2c, lp3943_ids);

Are we expecting this driver to support more devices?

> +static const struct of_device_id lp3943_dt_ids[] = {
> +     { .compatible = "ti,lp3943", },
> +     { }
> +};
> +MODULE_DEVICE_TABLE(of, lp3943_dt_ids);
> +
> +static struct i2c_driver lp3943_driver = {
> +     .driver = {
> +             .name = "lp3943",
> +             .owner = THIS_MODULE,
> +             .of_match_table = of_match_ptr(lp3943_dt_ids),
> +     },
> +     .probe = lp3943_probe,
> +     .remove = lp3943_remove,
> +     .id_table = lp3943_ids,
> +};
> +
> +static int __init lp3943_init(void)
> +{
> +     return i2c_add_driver(&lp3943_driver);
> +}
> +subsys_initcall(lp3943_init);
> +
> +static void __exit lp3943_exit(void)
> +{
> +     i2c_del_driver(&lp3943_driver);
> +}
> +module_exit(lp3943_exit);

I think you want to replace:
  lp3943_init()
  lp3943_exit

With:
  module_i2c_driver()

> +MODULE_DESCRIPTION("LP3943 MFD Core Driver");
> +MODULE_AUTHOR("Milo Kim");
> +MODULE_LICENSE("GPL");

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to