lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 31 Jul 2013 12:56:30 +0100
From:	Lee Jones <lee.jones@...aro.org>
To:	"Kim, Milo" <Milo.Kim@...com>
Cc:	"Samuel Ortiz (sameo@...ux.intel.com)" <sameo@...ux.intel.com>,
	"broonie@...nel.org" <broonie@...nel.org>,
	"linus.walleij@...aro.org" <linus.walleij@...aro.org>,
	"thierry.reding@...il.com" <thierry.reding@...il.com>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-pwm@...r.kernel.org" <linux-pwm@...r.kernel.org>
Subject: Re: [PATCH v2 1/4] mfd: add LP3943 MFD driver


> Cc: Lee Jones <lee.jones@...aro.org>
> Cc: Linus Walleij <linus.walleij@...aro.org>
> Cc: Mark Brown <broonie@...nel.org>
> Cc: Samuel Ortiz <sameo@...ux.intel.com>
> Cc: Thierry Reding <thierry.reding@...il.com>
> Signed-off-by: Milo Kim <milo.kim@...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 majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ