Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1243097 > unrolled thread

[RFC V3] regmap: change bool to 1 bit variable in struct regmap

Started byyalin wang <yalin.wang2010@gmail.com>
First post2015-10-09 10:00 +0200
Last post2015-10-12 18:30 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [RFC V3] regmap: change bool to 1 bit variable in struct regmap yalin wang <yalin.wang2010@gmail.com> - 2015-10-09 10:00 +0200
    Re: [RFC V3] regmap: change bool to 1 bit variable in struct regmap Mark Brown <broonie@kernel.org> - 2015-10-09 13:40 +0200
      Re: [RFC V3] regmap: change bool to 1 bit variable in struct regmap yalin wang <yalin.wang2010@gmail.com> - 2015-10-10 03:30 +0200
    Re: [RFC V3] regmap: change bool to 1 bit variable in struct regmap Markus Pargmann <mpa@pengutronix.de> - 2015-10-12 12:50 +0200
      Re: [RFC V3] regmap: change bool to 1 bit variable in struct regmap Mark Brown <broonie@kernel.org> - 2015-10-12 18:30 +0200

#1243097 — [RFC V3] regmap: change bool to 1 bit variable in struct regmap

Fromyalin wang <yalin.wang2010@gmail.com>
Date2015-10-09 10:00 +0200
Subject[RFC V3] regmap: change bool to 1 bit variable in struct regmap
Message-ID<qhAKS-4hU-7@gated-at.bofh.it>
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 | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
index 3df9770..dac341c 100644
--- a/drivers/base/regmap/internal.h
+++ b/drivers/base/regmap/internal.h
@@ -68,7 +68,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;
@@ -102,8 +101,26 @@ struct regmap {
 	int (*reg_update_bits)(void *context, unsigned int reg,
 			       unsigned int mask, unsigned int val);
 
-	bool defer_caching;
+	u8 async:1;
+	u8 defer_caching:1;
+	/* if set, remember to free reg_defaults_raw */
+	u8 cache_free:1;
+	/* if set, the HW registers are known to match map->reg_defaults */
+	u8 no_sync_defaults:1;
 
+	/* if set, converts bulk read to single read */
+	u8 use_single_read:1;
+	/* if set, converts bulk read to single read */
+	u8 use_single_write:1;
+	/* if set, the device supports multi write mode */
+	u8 can_multi_write:1;
+
+	/* if set, only the cache is modified not the HW */
+	bool cache_only;
+	/* if set, only the HW is modified not the cache */
+	bool cache_bypass;
+	/* if set, the cache contains newer data than the HW */
+	bool cache_dirty;
 	u8 read_flag_mask;
 	u8 write_flag_mask;
 
@@ -124,31 +141,13 @@ struct regmap {
 	/* number of entries in reg_defaults_raw */
 	unsigned int num_reg_defaults_raw;
 
-	/* if set, only the cache is modified not the HW */
-	bool cache_only;
-	/* if set, only the HW is modified not the cache */
-	bool 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 */
-	bool 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 read to single read */
-	bool use_single_read;
-	/* if set, converts bulk read to single read */
-	bool use_single_write;
-	/* if set, the device supports multi write mode */
-	bool can_multi_write;
-
 	/* if set, raw reads/writes are limited to this size */
 	size_t max_raw_read;
 	size_t max_raw_write;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1243277

FromMark Brown <broonie@kernel.org>
Date2015-10-09 13:40 +0200
Message-ID<qhEbN-R9-21@gated-at.bofh.it>
In reply to#1243097

[Multipart message — attachments visible in raw view] — view raw

On Fri, Oct 09, 2015 at 03:51:22PM +0800, 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.

This still doesn't apply against current code - I'm looking for
something that applies at least against

  git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next

[toc] | [prev] | [next] | [standalone]


#1243781

Fromyalin wang <yalin.wang2010@gmail.com>
Date2015-10-10 03:30 +0200
Message-ID<qhR90-2DS-1@gated-at.bofh.it>
In reply to#1243277
hi 

i have sync this branch,
but see my patch have been merged :)
seems correct.

Thanks
> On Oct 9, 2015, at 19:35, Mark Brown <broonie@kernel.org> wrote:
> 
> On Fri, Oct 09, 2015 at 03:51:22PM +0800, 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.
> 
> This still doesn't apply against current code - I'm looking for
> something that applies at least against
> 
>  git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1244587

FromMarkus Pargmann <mpa@pengutronix.de>
Date2015-10-12 12:50 +0200
Message-ID<qiIQ1-4TF-17@gated-at.bofh.it>
In reply to#1243097

[Multipart message — attachments visible in raw view] — view raw

Hi,

On Fri, Oct 09, 2015 at 03:51:22PM +0800, 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.
> 
> Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
> ---
>  drivers/base/regmap/internal.h | 39 +++++++++++++++++++--------------------
>  1 file changed, 19 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
> index 3df9770..dac341c 100644
> --- a/drivers/base/regmap/internal.h
> +++ b/drivers/base/regmap/internal.h
> @@ -68,7 +68,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;
> @@ -102,8 +101,26 @@ struct regmap {
>  	int (*reg_update_bits)(void *context, unsigned int reg,
>  			       unsigned int mask, unsigned int val);
>  
> -	bool defer_caching;
> +	u8 async:1;
> +	u8 defer_caching:1;
> +	/* if set, remember to free reg_defaults_raw */
> +	u8 cache_free:1;
> +	/* if set, the HW registers are known to match map->reg_defaults */
> +	u8 no_sync_defaults:1;
>  
> +	/* if set, converts bulk read to single read */
> +	u8 use_single_read:1;
> +	/* if set, converts bulk read to single read */
> +	u8 use_single_write:1;
> +	/* if set, the device supports multi write mode */
> +	u8 can_multi_write:1;
> +
> +	/* if set, only the cache is modified not the HW */
> +	bool cache_only;
> +	/* if set, only the HW is modified not the cache */
> +	bool cache_bypass;
> +	/* if set, the cache contains newer data than the HW */
> +	bool cache_dirty;

Why are these last three variables just moved and not changed to u8 of
size 1?

Regards,

Markus

>  	u8 read_flag_mask;
>  	u8 write_flag_mask;
>  
> @@ -124,31 +141,13 @@ struct regmap {
>  	/* number of entries in reg_defaults_raw */
>  	unsigned int num_reg_defaults_raw;
>  
> -	/* if set, only the cache is modified not the HW */
> -	bool cache_only;
> -	/* if set, only the HW is modified not the cache */
> -	bool 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 */
> -	bool 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 read to single read */
> -	bool use_single_read;
> -	/* if set, converts bulk read to single read */
> -	bool use_single_write;
> -	/* if set, the device supports multi write mode */
> -	bool can_multi_write;
> -
>  	/* if set, raw reads/writes are limited to this size */
>  	size_t max_raw_read;
>  	size_t max_raw_write;
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

[toc] | [prev] | [next] | [standalone]


#1244889

FromMark Brown <broonie@kernel.org>
Date2015-10-12 18:30 +0200
Message-ID<qiO96-4kn-53@gated-at.bofh.it>
In reply to#1244587

[Multipart message — attachments visible in raw view] — view raw

On Mon, Oct 12, 2015 at 12:48:58PM +0200, Markus Pargmann wrote:
> On Fri, Oct 09, 2015 at 03:51:22PM +0800, yalin wang wrote:

> > +	/* if set, only the cache is modified not the HW */
> > +	bool cache_only;
> > +	/* if set, only the HW is modified not the cache */
> > +	bool cache_bypass;
> > +	/* if set, the cache contains newer data than the HW */
> > +	bool cache_dirty;

> Why are these last three variables just moved and not changed to u8 of
> size 1?

They're exported to debugfs and the relevant debugfs helpers take bool
as an argument (actually I've got a feeling the relevant API is changed
in -next which is likely to be an issue here...).

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web