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: <20120125124250.GH3687@opensource.wolfsonmicro.com>
Date:	Wed, 25 Jan 2012 12:42:50 +0000
From:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
To:	Laxman Dewangan <ldewangan@...dia.com>
Cc:	lrg@...com, jedu@...mlogic.co.uk, sameo@...ux.intel.com,
	gg@...mlogic.co.uk, linux-kernel@...r.kernel.org,
	linux-tegra@...r.kernel.org
Subject: Re: [PATCH V2] regulator: tps65910: Sleep control through external
 inputs

On Wed, Jan 25, 2012 at 04:27:48PM +0530, Laxman Dewangan wrote:

> @@ -450,6 +489,29 @@ static int tps65910_set_mode(struct regulator_dev *dev, unsigned int mode)
>  	struct tps65910 *mfd = pmic->mfd;
>  	int reg, value, id = rdev_get_id(dev);
>  
> +	/*
> +	 * If regulator is controlled through external control then
> +	 * mode can be identified by the input level of EN1/EN2/EN3.
> +	 * If it is HIGH then regulators is on, full power.
> +	 * If it is LOW then:
> +	 *       - the regulator is set off if its corresponding Control
> +	 *         bit = 0 in SLEEP_KEEP_XXX_ON.
> +	 *       - the regulator is set in low-power mode if its corresponding
> +	 *         control bit = 1 in SLEEP_KEEP_XXX_ON register.
> +	 */

This really isn't what the set_mode() API is for - especially the fact
that it supports turning the regulator off which really isn't what
set_mode() is supposed to do.  A generic driver using this API isn't
going to play too well.

> +	if (pmic->board_ext_control[id]) {
> +		u8 regoffs = (pmic->ext_sleep_control[id] >> 8) & 0xFF;
> +		u8 bit_pos = (1 << pmic->ext_sleep_control[id] & 0xFF);
> +		int ret = 0;
> +		if ((mode == REGULATOR_MODE_IDLE) ||
> +			(mode == REGULATOR_MODE_STANDBY))
> +			ret = tps65910_set_bits(mfd,
> +				TPS65910_SLEEP_KEEP_LDO_ON + regoffs, bit_pos);

As a coding style thing this should be a switch statement.

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