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: <516D321F.5090704@stericsson.com>
Date:	Tue, 16 Apr 2013 13:12:31 +0200
From:	Bengt Jönsson <bengt.g.jonsson@...ricsson.com>
To:	Axel Lin <axel.lin@...ics.com>
Cc:	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Lee Jones <lee.jones@...aro.org>,
	Yvan FILLION <yvan.fillion@...ricsson.com>,
	Liam Girdwood <lgirdwood@...il.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RFT 2/2] regulator: ab8500: Optimize ab8540_aux3_regulator_get_voltage_sel

On 04/10/2013 08:46 AM, Axel Lin wrote:
> We can save a register read operation in some case if read
> expand_register first.
> If info->expand_register.voltage_mask bit is set, no need to read
> voltage_reg.
>
> Signed-off-by: Axel Lin <axel.lin@...ics.com>
Looks good.

Acked-by: Bengt Jonsson <bengt.g.jonsson@...ricsson.com>
> ---
>   drivers/regulator/ab8500.c |   42 ++++++++++++++++++------------------------
>   1 file changed, 18 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
> index 222a63e..7a86fe6 100644
> --- a/drivers/regulator/ab8500.c
> +++ b/drivers/regulator/ab8500.c
> @@ -521,7 +521,7 @@ static int ab8500_regulator_get_voltage_sel(struct regulator_dev *rdev)
>   
>   static int ab8540_aux3_regulator_get_voltage_sel(struct regulator_dev *rdev)
>   {
> -	int ret, val;
> +	int ret;
>   	struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
>   	u8 regval, regval_expand;
>   
> @@ -531,18 +531,25 @@ static int ab8540_aux3_regulator_get_voltage_sel(struct regulator_dev *rdev)
>   	}
>   
>   	ret = abx500_get_register_interruptible(info->dev,
> -			info->voltage_bank, info->voltage_reg, &regval);
> -
> +			info->expand_register.voltage_bank,
> +			info->expand_register.voltage_reg, &regval_expand);
>   	if (ret < 0) {
>   		dev_err(rdev_get_dev(rdev),
> -			"couldn't read voltage reg for regulator\n");
> +			"couldn't read voltage expand reg for regulator\n");
>   		return ret;
>   	}
>   
> -	ret = abx500_get_register_interruptible(info->dev,
> -			info->expand_register.voltage_bank,
> -			info->expand_register.voltage_reg, &regval_expand);
> +	dev_vdbg(rdev_get_dev(rdev),
> +		 "%s-get_voltage expand (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
> +		 info->desc.name, info->expand_register.voltage_bank,
> +		 info->expand_register.voltage_reg,
> +		 info->expand_register.voltage_mask, regval_expand);
> +
> +	if (regval_expand & info->expand_register.voltage_mask)
> +		return info->expand_register.voltage_limit;
>   
> +	ret = abx500_get_register_interruptible(info->dev,
> +			info->voltage_bank, info->voltage_reg, &regval);
>   	if (ret < 0) {
>   		dev_err(rdev_get_dev(rdev),
>   			"couldn't read voltage reg for regulator\n");
> @@ -550,24 +557,11 @@ static int ab8540_aux3_regulator_get_voltage_sel(struct regulator_dev *rdev)
>   	}
>   
>   	dev_vdbg(rdev_get_dev(rdev),
> -		"%s-get_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
> -		" 0x%x\n",
> -		info->desc.name, info->voltage_bank, info->voltage_reg,
> -		info->voltage_mask, regval);
> -	dev_vdbg(rdev_get_dev(rdev),
> -		"%s-get_voltage expand (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
> -		" 0x%x\n",
> -		info->desc.name, info->expand_register.voltage_bank,
> -		info->expand_register.voltage_reg,
> -		info->expand_register.voltage_mask, regval_expand);
> -
> -	if (regval_expand&(info->expand_register.voltage_mask))
> -		/* Vaux3 has a different layout */
> -		val = info->expand_register.voltage_limit;
> -	else
> -		val = (regval & info->voltage_mask) >> info->voltage_shift;
> +		 "%s-get_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
> +		 info->desc.name, info->voltage_bank, info->voltage_reg,
> +		 info->voltage_mask, regval);
>   
> -	return val;
> +	return (regval & info->voltage_mask) >> info->voltage_shift;
>   }
>   
>   static int ab8500_regulator_set_voltage_sel(struct regulator_dev *rdev,

--
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