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: <1453490128.13870.31.camel@perches.com>
Date:	Fri, 22 Jan 2016 11:15:28 -0800
From:	Joe Perches <joe@...ches.com>
To:	Mark Brown <broonie@...nel.org>,
	Paul Kocialkowski <contact@...lk.fr>
Cc:	Liam Girdwood <lgirdwood@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] regulator: core: Use a bitfield for
 continuous_voltage_range

On Thu, 2016-01-21 at 20:24 +0000, Mark Brown wrote:
> Using a bitfield enables the compiler to lay out the structure more
> efficiently when we have other boolean flags since multiple values can
> be included in a single byte.
> 
> Signed-off-by: Mark Brown <broonie@...nel.org>
> ---
>  include/linux/regulator/driver.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
> index 16ac9e108806..3ac0f306f033 100644
> --- a/include/linux/regulator/driver.h
> +++ b/include/linux/regulator/driver.h
> @@ -281,7 +281,7 @@ struct regulator_desc {
>  			    const struct regulator_desc *,
>  			    struct regulator_config *);
>  	int id;
> -	bool continuous_voltage_range;
> +	unsigned int continuous_voltage_range:1;

Is this really valuable?

There are already padding bytes that are unused
and adding a couple more bools would be space
cost-free and more readable.

I believe that read/write of bytes is also more
efficient on some architectures than bit field
read/modify/write uses.

>  	unsigned n_voltages;
>  	const struct regulator_ops *ops;
>  	int irq;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ