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: <20110308115640.GC20944@opensource.wolfsonmicro.com>
Date:	Tue, 8 Mar 2011 11:56:40 +0000
From:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
To:	Linus Walleij <linus.walleij@...ricsson.com>
Cc:	Liam Girdwood <lrg@...mlogic.co.uk>, linux-kernel@...r.kernel.org,
	Lee Jones <lee.jones@...aro.org>,
	Linus Walleij <linus.walleij@...aro.org>,
	Samuel Ortiz <samuel.ortiz@...el.com>,
	Ola Lilja <ola.o.lilja@...ricsson.com>
Subject: Re: [PATCH 2/3] regulator: add a subdriver for TI TPS6105x
 regulator portions

On Tue, Mar 08, 2011 at 10:42:00AM +0100, Linus Walleij wrote:

> +static int tps6105x_regulator_get_voltage(struct regulator_dev *rdev)
> +{

It'd probably simplify things to use the _sel variants for the voltage
operations.

> +static int __devinit tps6105x_regulator_probe(struct platform_device *pdev)
> +{
> +	struct tps6105x *tps6105x = platform_get_drvdata(pdev);
> +	struct tps6105x_platform_data *pdata = tps6105x->pdata;
> +	int ret;
> +
> +	/* This instance is not set for regulator mode so bail out */
> +	if (pdata->mode != TPS6105X_MODE_VOLTAGE)
> +		return 0;

-ENODEV?  Logging to explain why we're bombing out might be helpful too.

> +	/* Set lowest voltage 4.5V to begin */
> +	ret = tps6105x_mask_and_set(tps6105x, TPS6105X_REG_0,
> +		TPS6105X_REG0_VOLTAGE_MASK,
> +		TPS6105X_REG0_VOLTAGE_450 << TPS6105X_REG0_VOLTAGE_SHIFT);
> +	if (ret)
> +		return ret;

Don't do this, if the user wants to set a defualt voltage they can use
constraints but if the driver does it then it may disrupt a running
system.

> +#if 0
> +	/* Activate voltage mode - use to check if voltage comes out */
> +	ret = tps6105x_mask_and_set(tps6105x, TPS6105X_REG_0,
> +		TPS6105X_REG0_MODE_MASK,
> +		TPS6105X_REG0_MODE_VOLTAGE << TPS6105X_REG0_MODE_SHIFT);
> +	if (ret)
> +		return ret;
> +#endif

Don't include if 0 code.

> +subsys_initcall(tps6105x_regulator_init);
> +module_exit(tps6105x_regulator_exit);

These usually go next to the functions.
--
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