From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754039AbcAVTPg (ORCPT ); Fri, 22 Jan 2016 14:15:36 -0500 Received: from smtprelay0009.hostedemail.com ([216.40.44.9]:46179 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753778AbcAVTPc (ORCPT ); Fri, 22 Jan 2016 14:15:32 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:599:800:960:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:2691:2740:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:3874:4321:4385:5007:6261:10004:10400:10848:11026:11232:11658:11783:11914:12043:12114:12296:12438:12517:12519:12555:12740:13069:13138:13161:13229:13231:13311:13357:13894:14659:21080:30019:30054:30080:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: egg30_12dea88f15104 X-Filterd-Recvd-Size: 2049 Message-ID: <1453490128.13870.31.camel@perches.com> Subject: Re: [PATCH 1/2] regulator: core: Use a bitfield for continuous_voltage_range From: Joe Perches To: Mark Brown , Paul Kocialkowski Cc: Liam Girdwood , linux-kernel@vger.kernel.org Date: Fri, 22 Jan 2016 11:15:28 -0800 In-Reply-To: <1453407851-8039-1-git-send-email-broonie@kernel.org> References: <1453407851-8039-1-git-send-email-broonie@kernel.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.3-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- >  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;