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]
Message-ID: <20130621144423.GX27646@sirena.org.uk>
Date:	Fri, 21 Jun 2013 15:44:23 +0100
From:	Mark Brown <broonie@...nel.org>
To:	Guennadi Liakhovetski <g.liakhovetski@....de>
Cc:	linux-kernel@...r.kernel.org, Liam Girdwood <lgirdwood@...il.com>,
	Magnus Damm <magnus.damm@...il.com>, linux-sh@...r.kernel.org
Subject: Re: [PATCH 2/2] regulators: max8973: initial DT support

On Fri, Jun 21, 2013 at 08:30:26AM +0200, Guennadi Liakhovetski wrote:

> +Required properties:
> +
> +- compatible:	must be "maxium,max8973"
> +- reg:		the i2c slave address of the regulator. It should be 0x1b.
> +- regulators:	a subnode with a single regulator descriptor in it called "dcdc"

Why make this a subnode - if there's only one regulator on the device
then it may as well just put all the regulator properties there?

> +	if (!regulators) {
> +		dev_err(dev, "regulator node not found\n");
> +		return -ENODEV;
> +	}
> +
> +	ret = of_regulator_match(dev, regulators,
> +				 &max8973_regulator_match, 1);
> +	of_node_put(regulators);
> +	if (ret < 0) {
> +		dev_err(dev, "Error parsing regulator init data: %d\n", ret);
> +		return ret;
> +	}
> +	if (!ret) {
> +		dev_err(dev, "No regulator configuration found\n");
> +		return -ENODEV;
> +	}
> +
> +	return 0;

This would simplify the code here, the driver can just call
of_get_regulator_init_data() directly with the node.

> -	if (!pdata->enable_ext_control) {
> +	if (!pdata || !pdata->enable_ext_control) {
>  		max->desc.enable_reg = MAX8973_VOUT;
>  		max->desc.enable_mask = MAX8973_VOUT_ENABLE;
>  		max->ops.enable = regulator_enable_regmap;

A common approach here is just to embed the platform data in the
driver data then copy actual platform data in there or parse the device
tree bindings (when added) into the structure.  This means that most of
the driver can just assume there's platform data which makes life a bit
simpler.

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ