linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] regmap: change bool to 1 bit variable in struct regmap
@ 2015-10-08  4:24 yalin wang
  2015-10-08  8:15 ` Mark Brown
  2015-10-08 15:49 ` Pavel Machek
  0 siblings, 2 replies; 5+ messages in thread
From: yalin wang @ 2015-10-08  4:24 UTC (permalink / raw)
  To: broonie, gregkh, linux-kernel; +Cc: yalin wang

This patch change some bool variables in struct regmap {  }
to be u8 v : 1 type, so that we can shrink the sizeof of struct regmap.

Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
---
 drivers/base/regmap/internal.h | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
index 873ddf9..f4a5f7b 100644
--- a/drivers/base/regmap/internal.h
+++ b/drivers/base/regmap/internal.h
@@ -67,7 +67,6 @@ struct regmap {
 	void *bus_context;
 	const char *name;
 
-	bool async;
 	spinlock_t async_lock;
 	wait_queue_head_t async_waitq;
 	struct list_head async_list;
@@ -99,7 +98,16 @@ struct regmap {
 	int (*reg_read)(void *context, unsigned int reg, unsigned int *val);
 	int (*reg_write)(void *context, unsigned int reg, unsigned int val);
 
-	bool defer_caching;
+	u8 async : 1,
+	defer_caching : 1,
+	/* if set, remember to free reg_defaults_raw */
+	cache_free : 1,
+	/* if set, the HW registers are known to match map->reg_defaults */
+	no_sync_defaults : 1,
+	/* if set, converts bulk rw to single rw */
+	use_single_rw : 1,
+	/* if set, the device supports multi write mode */
+	can_multi_write : 1;
 
 	u8 read_flag_mask;
 	u8 write_flag_mask;
@@ -125,25 +133,16 @@ struct regmap {
 	u32 cache_only;
 	/* if set, only the HW is modified not the cache */
 	u32 cache_bypass;
-	/* if set, remember to free reg_defaults_raw */
-	bool cache_free;
 
 	struct reg_default *reg_defaults;
 	const void *reg_defaults_raw;
 	void *cache;
 	/* if set, the cache contains newer data than the HW */
 	u32 cache_dirty;
-	/* if set, the HW registers are known to match map->reg_defaults */
-	bool no_sync_defaults;
 
 	struct reg_sequence *patch;
 	int patch_regs;
 
-	/* if set, converts bulk rw to single rw */
-	bool use_single_rw;
-	/* if set, the device supports multi write mode */
-	bool can_multi_write;
-
 	struct rb_root range_tree;
 	void *selector_work_buf;	/* Scratch buffer used for selector */
 };
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RFC] regmap: change bool to 1 bit variable in struct regmap
  2015-10-08  4:24 [RFC] regmap: change bool to 1 bit variable in struct regmap yalin wang
@ 2015-10-08  8:15 ` Mark Brown
  2015-10-08  8:23   ` yalin wang
  2015-10-08 15:49 ` Pavel Machek
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Brown @ 2015-10-08  8:15 UTC (permalink / raw)
  To: yalin wang; +Cc: gregkh, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 140 bytes --]

On Thu, Oct 08, 2015 at 12:24:02PM +0800, yalin wang wrote:

> +	u8 async : 1,

Please use the kernel coding style, no spaces around the :.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC] regmap: change bool to 1 bit variable in struct regmap
  2015-10-08  8:15 ` Mark Brown
@ 2015-10-08  8:23   ` yalin wang
       [not found]     ` <31A5ED34-0EE0-43A3-8F01-E7A5FE28CAA3@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: yalin wang @ 2015-10-08  8:23 UTC (permalink / raw)
  To: Mark Brown; +Cc: gregkh, linux-kernel

ok, i will send V2 patch
> On Oct 8, 2015, at 16:15, Mark Brown <broonie@kernel.org> wrote:
> 
> On Thu, Oct 08, 2015 at 12:24:02PM +0800, yalin wang wrote:
> 
>> +	u8 async : 1,
> 
> Please use the kernel coding style, no spaces around the :.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC] regmap: change bool to 1 bit variable in struct regmap
       [not found]     ` <31A5ED34-0EE0-43A3-8F01-E7A5FE28CAA3@gmail.com>
@ 2015-10-08 10:31       ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2015-10-08 10:31 UTC (permalink / raw)
  To: yalin wang; +Cc: gregkh, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

On Thu, Oct 08, 2015 at 04:42:42PM +0800, yalin wang wrote:

> i also found lots of code use this wrong coding style by search source code :
> $ egrep -H ' : [0-9]+' `find . -name *.h`  | grep -v '?'   > ~/result.txt

Mostly old and/or obscure code, or code that's shared with other things.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC] regmap: change bool to 1 bit variable in struct regmap
  2015-10-08  4:24 [RFC] regmap: change bool to 1 bit variable in struct regmap yalin wang
  2015-10-08  8:15 ` Mark Brown
@ 2015-10-08 15:49 ` Pavel Machek
  1 sibling, 0 replies; 5+ messages in thread
From: Pavel Machek @ 2015-10-08 15:49 UTC (permalink / raw)
  To: yalin wang; +Cc: broonie, gregkh, linux-kernel

On Thu 2015-10-08 12:24:02, yalin wang wrote:
> This patch change some bool variables in struct regmap {  }
> to be u8 v : 1 type, so that we can shrink the sizeof of struct regmap.

Are there any atomicity/locking implications?


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-08 15:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-08  4:24 [RFC] regmap: change bool to 1 bit variable in struct regmap yalin wang
2015-10-08  8:15 ` Mark Brown
2015-10-08  8:23   ` yalin wang
     [not found]     ` <31A5ED34-0EE0-43A3-8F01-E7A5FE28CAA3@gmail.com>
2015-10-08 10:31       ` Mark Brown
2015-10-08 15:49 ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).