* [PATCH 0/3] regmap: add 64-bit support @ 2015-12-03 9:31 Xiubo Li 2015-12-03 9:31 ` [PATCH 1/3] regmap: cache: Tidy up the code to suppress style check warnings Xiubo Li ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Xiubo Li @ 2015-12-03 9:31 UTC (permalink / raw) To: broonie; +Cc: linux-kernel, Xiubo Li This patch series add 64-bit support for 64 bit platform. Xiubo Li (3): regmap: cache: Tidy up the code to suppress style check warnings regmap: add 64-bit mode support regcache: add 64-bit mode support drivers/base/regmap/regcache.c | 45 +++++++++---------- drivers/base/regmap/regmap.c | 99 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+), 24 deletions(-) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] regmap: cache: Tidy up the code to suppress style check warnings 2015-12-03 9:31 [PATCH 0/3] regmap: add 64-bit support Xiubo Li @ 2015-12-03 9:31 ` Xiubo Li 2015-12-08 17:12 ` Mark Brown 2015-12-03 9:31 ` [PATCH 2/3] regmap: add 64-bit mode support Xiubo Li 2015-12-03 9:31 ` [PATCH 3/3] regcache: " Xiubo Li 2 siblings, 1 reply; 9+ messages in thread From: Xiubo Li @ 2015-12-03 9:31 UTC (permalink / raw) To: broonie; +Cc: linux-kernel, Xiubo Li There will be some warning like the following when checking new patches near this code: "WARNING: Missing a blank line after declarations" This patch will suppress this warning. Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com> --- drivers/base/regmap/regcache.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 4c07802..0905562 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -533,21 +533,15 @@ bool regcache_set_val(struct regmap *map, void *base, unsigned int idx, } switch (map->cache_word_size) { - case 1: { - u8 *cache = base; - cache[idx] = val; + case 1: + ((u8 *)base)[idx] = val; break; - } - case 2: { - u16 *cache = base; - cache[idx] = val; + case 2: + ((u16 *)base)[idx] = val; break; - } - case 4: { - u32 *cache = base; - cache[idx] = val; + case 4: + ((u32 *)base)[idx] = val; break; - } default: BUG(); } @@ -566,18 +560,12 @@ unsigned int regcache_get_val(struct regmap *map, const void *base, idx)); switch (map->cache_word_size) { - case 1: { - const u8 *cache = base; - return cache[idx]; - } - case 2: { - const u16 *cache = base; - return cache[idx]; - } - case 4: { - const u32 *cache = base; - return cache[idx]; - } + case 1: + return ((u8 *)base)[idx]; + case 2: + return ((u16 *)base)[idx]; + case 4: + return ((u32 *)base)[idx]; default: BUG(); } -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] regmap: cache: Tidy up the code to suppress style check warnings 2015-12-03 9:31 ` [PATCH 1/3] regmap: cache: Tidy up the code to suppress style check warnings Xiubo Li @ 2015-12-08 17:12 ` Mark Brown 2015-12-09 3:30 ` [PATCH 1/3] regmap: cache: Tidy up the code to suppress stylecheck warnings Xiubo Li 0 siblings, 1 reply; 9+ messages in thread From: Mark Brown @ 2015-12-08 17:12 UTC (permalink / raw) To: Xiubo Li; +Cc: linux-kernel [-- Attachment #1: Type: text/plain, Size: 596 bytes --] On Thu, Dec 03, 2015 at 05:31:51PM +0800, Xiubo Li wrote: > There will be some warning like the following when checking new > patches near this code: > "WARNING: Missing a blank line after declarations" > This patch will suppress this warning. > switch (map->cache_word_size) { > - case 1: { > - u8 *cache = base; > - cache[idx] = val; > + case 1: > + ((u8 *)base)[idx] = val; > break; > - } If there's a change to shut checkpatch up I'd rather just add the blank line it's asking for - the code is the way it is currently to avoid the casts since they're hard for people to read. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] regmap: cache: Tidy up the code to suppress stylecheck warnings 2015-12-08 17:12 ` Mark Brown @ 2015-12-09 3:30 ` Xiubo Li 0 siblings, 0 replies; 9+ messages in thread From: Xiubo Li @ 2015-12-09 3:30 UTC (permalink / raw) To: Mark Brown; +Cc: linux-kernel On 09/12/2015 01:12, Mark Brown wrote: > On Thu, Dec 03, 2015 at 05:31:51PM +0800, Xiubo Li wrote: > >> There will be some warning like the following when checking new >> patches near this code: >> "WARNING: Missing a blank line after declarations" >> This patch will suppress this warning. >> switch (map->cache_word_size) { >> - case 1: { >> - u8 *cache = base; >> - cache[idx] = val; >> + case 1: >> + ((u8 *)base)[idx] = val; >> break; >> - } > If there's a change to shut checkpatch up I'd rather just add the blank > line it's asking for - the code is the way it is currently to avoid the > casts since they're hard for people to read. Both of them are okay for me. I will send the v2 for these just adding one blank line. Thanks, BRs Xiubo ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/3] regmap: add 64-bit mode support 2015-12-03 9:31 [PATCH 0/3] regmap: add 64-bit support Xiubo Li 2015-12-03 9:31 ` [PATCH 1/3] regmap: cache: Tidy up the code to suppress style check warnings Xiubo Li @ 2015-12-03 9:31 ` Xiubo Li 2015-12-08 19:11 ` Applied "regmap: add 64-bit mode support" to the regmap tree Mark Brown 2015-12-09 8:45 ` [PATCH 2/3] regmap: add 64-bit mode support Arnd Bergmann 2015-12-03 9:31 ` [PATCH 3/3] regcache: " Xiubo Li 2 siblings, 2 replies; 9+ messages in thread From: Xiubo Li @ 2015-12-03 9:31 UTC (permalink / raw) To: broonie; +Cc: linux-kernel, Xiubo Li Since the mmio has support the 64-bit has been supported for the 64-bit platform, so should the regmap core too. Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com> --- drivers/base/regmap/regmap.c | 99 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 4ac63c0..1791180 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -245,6 +245,28 @@ static void regmap_format_32_native(void *buf, unsigned int val, *(u32 *)buf = val << shift; } +#ifdef CONFIG_64BIT +static void regmap_format_64_be(void *buf, unsigned int val, unsigned int shift) +{ + __be64 *b = buf; + + b[0] = cpu_to_be64(val << shift); +} + +static void regmap_format_64_le(void *buf, unsigned int val, unsigned int shift) +{ + __le64 *b = buf; + + b[0] = cpu_to_le64(val << shift); +} + +static void regmap_format_64_native(void *buf, unsigned int val, + unsigned int shift) +{ + *(u64 *)buf = val << shift; +} +#endif + static void regmap_parse_inplace_noop(void *buf) { } @@ -332,6 +354,41 @@ static unsigned int regmap_parse_32_native(const void *buf) return *(u32 *)buf; } +#ifdef CONFIG_64BIT +static unsigned int regmap_parse_64_be(const void *buf) +{ + const __be64 *b = buf; + + return be64_to_cpu(b[0]); +} + +static unsigned int regmap_parse_64_le(const void *buf) +{ + const __le64 *b = buf; + + return le64_to_cpu(b[0]); +} + +static void regmap_parse_64_be_inplace(void *buf) +{ + __be64 *b = buf; + + b[0] = be64_to_cpu(b[0]); +} + +static void regmap_parse_64_le_inplace(void *buf) +{ + __le64 *b = buf; + + b[0] = le64_to_cpu(b[0]); +} + +static unsigned int regmap_parse_64_native(const void *buf) +{ + return *(u64 *)buf; +} +#endif + static void regmap_lock_mutex(void *__map) { struct regmap *map = __map; @@ -712,6 +769,21 @@ struct regmap *__regmap_init(struct device *dev, } break; +#ifdef CONFIG_64BIT + case 64: + switch (reg_endian) { + case REGMAP_ENDIAN_BIG: + map->format.format_reg = regmap_format_64_be; + break; + case REGMAP_ENDIAN_NATIVE: + map->format.format_reg = regmap_format_64_native; + break; + default: + goto err_map; + } + break; +#endif + default: goto err_map; } @@ -771,6 +843,27 @@ struct regmap *__regmap_init(struct device *dev, goto err_map; } break; +#ifdef CONFIG_64BIT + switch (val_endian) { + case REGMAP_ENDIAN_BIG: + map->format.format_val = regmap_format_64_be; + map->format.parse_val = regmap_parse_64_be; + map->format.parse_inplace = regmap_parse_64_be_inplace; + break; + case REGMAP_ENDIAN_LITTLE: + map->format.format_val = regmap_format_64_le; + map->format.parse_val = regmap_parse_64_le; + map->format.parse_inplace = regmap_parse_64_le_inplace; + break; + case REGMAP_ENDIAN_NATIVE: + map->format.format_val = regmap_format_64_native; + map->format.parse_val = regmap_parse_64_native; + break; + default: + goto err_map; + } + break; +#endif } if (map->format.format_write) { @@ -2488,11 +2581,17 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, * we assume that the values are native * endian. */ + u64 *u64 = val; u32 *u32 = val; u16 *u16 = val; u8 *u8 = val; switch (map->format.val_bytes) { +#ifdef CONFIG_64BIT + case 8: + u64[i] = ival; + break; +#endif case 4: u32[i] = ival; break; -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Applied "regmap: add 64-bit mode support" to the regmap tree 2015-12-03 9:31 ` [PATCH 2/3] regmap: add 64-bit mode support Xiubo Li @ 2015-12-08 19:11 ` Mark Brown 2015-12-09 8:45 ` [PATCH 2/3] regmap: add 64-bit mode support Arnd Bergmann 1 sibling, 0 replies; 9+ messages in thread From: Mark Brown @ 2015-12-08 19:11 UTC (permalink / raw) To: Xiubo Li, Mark Brown; +Cc: linux-kernel The patch regmap: add 64-bit mode support has been applied to the regmap tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From afcc00b91f1865f6d0bbdb687dd642ce8a3c3c9e Mon Sep 17 00:00:00 2001 From: Xiubo Li <lixiubo@cmss.chinamobile.com> Date: Thu, 3 Dec 2015 17:31:52 +0800 Subject: [PATCH] regmap: add 64-bit mode support Since the mmio has support the 64-bit has been supported for the 64-bit platform, so should the regmap core too. Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com> Signed-off-by: Mark Brown <broonie@kernel.org> --- drivers/base/regmap/regmap.c | 99 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 4ac63c0e50c7..1791180dca02 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -245,6 +245,28 @@ static void regmap_format_32_native(void *buf, unsigned int val, *(u32 *)buf = val << shift; } +#ifdef CONFIG_64BIT +static void regmap_format_64_be(void *buf, unsigned int val, unsigned int shift) +{ + __be64 *b = buf; + + b[0] = cpu_to_be64(val << shift); +} + +static void regmap_format_64_le(void *buf, unsigned int val, unsigned int shift) +{ + __le64 *b = buf; + + b[0] = cpu_to_le64(val << shift); +} + +static void regmap_format_64_native(void *buf, unsigned int val, + unsigned int shift) +{ + *(u64 *)buf = val << shift; +} +#endif + static void regmap_parse_inplace_noop(void *buf) { } @@ -332,6 +354,41 @@ static unsigned int regmap_parse_32_native(const void *buf) return *(u32 *)buf; } +#ifdef CONFIG_64BIT +static unsigned int regmap_parse_64_be(const void *buf) +{ + const __be64 *b = buf; + + return be64_to_cpu(b[0]); +} + +static unsigned int regmap_parse_64_le(const void *buf) +{ + const __le64 *b = buf; + + return le64_to_cpu(b[0]); +} + +static void regmap_parse_64_be_inplace(void *buf) +{ + __be64 *b = buf; + + b[0] = be64_to_cpu(b[0]); +} + +static void regmap_parse_64_le_inplace(void *buf) +{ + __le64 *b = buf; + + b[0] = le64_to_cpu(b[0]); +} + +static unsigned int regmap_parse_64_native(const void *buf) +{ + return *(u64 *)buf; +} +#endif + static void regmap_lock_mutex(void *__map) { struct regmap *map = __map; @@ -712,6 +769,21 @@ struct regmap *__regmap_init(struct device *dev, } break; +#ifdef CONFIG_64BIT + case 64: + switch (reg_endian) { + case REGMAP_ENDIAN_BIG: + map->format.format_reg = regmap_format_64_be; + break; + case REGMAP_ENDIAN_NATIVE: + map->format.format_reg = regmap_format_64_native; + break; + default: + goto err_map; + } + break; +#endif + default: goto err_map; } @@ -771,6 +843,27 @@ struct regmap *__regmap_init(struct device *dev, goto err_map; } break; +#ifdef CONFIG_64BIT + switch (val_endian) { + case REGMAP_ENDIAN_BIG: + map->format.format_val = regmap_format_64_be; + map->format.parse_val = regmap_parse_64_be; + map->format.parse_inplace = regmap_parse_64_be_inplace; + break; + case REGMAP_ENDIAN_LITTLE: + map->format.format_val = regmap_format_64_le; + map->format.parse_val = regmap_parse_64_le; + map->format.parse_inplace = regmap_parse_64_le_inplace; + break; + case REGMAP_ENDIAN_NATIVE: + map->format.format_val = regmap_format_64_native; + map->format.parse_val = regmap_parse_64_native; + break; + default: + goto err_map; + } + break; +#endif } if (map->format.format_write) { @@ -2488,11 +2581,17 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, * we assume that the values are native * endian. */ + u64 *u64 = val; u32 *u32 = val; u16 *u16 = val; u8 *u8 = val; switch (map->format.val_bytes) { +#ifdef CONFIG_64BIT + case 8: + u64[i] = ival; + break; +#endif case 4: u32[i] = ival; break; -- 2.6.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] regmap: add 64-bit mode support 2015-12-03 9:31 ` [PATCH 2/3] regmap: add 64-bit mode support Xiubo Li 2015-12-08 19:11 ` Applied "regmap: add 64-bit mode support" to the regmap tree Mark Brown @ 2015-12-09 8:45 ` Arnd Bergmann 2015-12-09 9:01 ` Xiubo Li 1 sibling, 1 reply; 9+ messages in thread From: Arnd Bergmann @ 2015-12-09 8:45 UTC (permalink / raw) To: Xiubo Li; +Cc: broonie, linux-kernel On Thursday 03 December 2015 17:31:52 Xiubo Li wrote: > @@ -2488,11 +2581,17 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, > * we assume that the values are native > * endian. > */ > + u64 *u64 = val; > u32 *u32 = val; > u16 *u16 = val; > u8 *u8 = val; > > switch (map->format.val_bytes) { > +#ifdef CONFIG_64BIT > + case 8: > + u64[i] = ival; > + break; > +#endif > case 4: > u32[i] = ival; > break; > This now gives me: drivers/base/regmap/regmap.c: In function 'regmap_bulk_read': drivers/base/regmap/regmap.c:2584:10: warning: unused variable 'u64' [-Wunused-variable] u64 *u64 = val; ^ Arnd ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] regmap: add 64-bit mode support 2015-12-09 8:45 ` [PATCH 2/3] regmap: add 64-bit mode support Arnd Bergmann @ 2015-12-09 9:01 ` Xiubo Li 0 siblings, 0 replies; 9+ messages in thread From: Xiubo Li @ 2015-12-09 9:01 UTC (permalink / raw) To: Arnd Bergmann; +Cc: broonie, linux-kernel On 09/12/2015 16:45, Arnd Bergmann wrote: > On Thursday 03 December 2015 17:31:52 Xiubo Li wrote: >> @@ -2488,11 +2581,17 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, >> * we assume that the values are native >> * endian. >> */ >> + u64 *u64 = val; >> u32 *u32 = val; >> u16 *u16 = val; >> u8 *u8 = val; >> >> switch (map->format.val_bytes) { >> +#ifdef CONFIG_64BIT >> + case 8: >> + u64[i] = ival; >> + break; >> +#endif >> case 4: >> u32[i] = ival; >> break; >> > This now gives me: > > drivers/base/regmap/regmap.c: In function 'regmap_bulk_read': > drivers/base/regmap/regmap.c:2584:10: warning: unused variable 'u64' [-Wunused-variable] > u64 *u64 = val; > ^ > I will fix this. Thanks for your catch. BRs > Arnd ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/3] regcache: add 64-bit mode support 2015-12-03 9:31 [PATCH 0/3] regmap: add 64-bit support Xiubo Li 2015-12-03 9:31 ` [PATCH 1/3] regmap: cache: Tidy up the code to suppress style check warnings Xiubo Li 2015-12-03 9:31 ` [PATCH 2/3] regmap: add 64-bit mode support Xiubo Li @ 2015-12-03 9:31 ` Xiubo Li 2 siblings, 0 replies; 9+ messages in thread From: Xiubo Li @ 2015-12-03 9:31 UTC (permalink / raw) To: broonie; +Cc: linux-kernel, Xiubo Li Since the mmio has support the 64-bit has been supported for the 64-bit platform, so should the regcache core too. Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com> --- drivers/base/regmap/regcache.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 0905562..88c25ef 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -542,6 +542,11 @@ bool regcache_set_val(struct regmap *map, void *base, unsigned int idx, case 4: ((u32 *)base)[idx] = val; break; +#ifdef CONFIG_64BIT + case 8: + ((u64 *)base)[idx] = val; + break; +#endif default: BUG(); } @@ -566,6 +571,10 @@ unsigned int regcache_get_val(struct regmap *map, const void *base, return ((u16 *)base)[idx]; case 4: return ((u32 *)base)[idx]; +#ifdef CONFIG_64BIT + case 8: + return ((u64 *)base)[idx]; +#endif default: BUG(); } -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-12-09 9:01 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-12-03 9:31 [PATCH 0/3] regmap: add 64-bit support Xiubo Li 2015-12-03 9:31 ` [PATCH 1/3] regmap: cache: Tidy up the code to suppress style check warnings Xiubo Li 2015-12-08 17:12 ` Mark Brown 2015-12-09 3:30 ` [PATCH 1/3] regmap: cache: Tidy up the code to suppress stylecheck warnings Xiubo Li 2015-12-03 9:31 ` [PATCH 2/3] regmap: add 64-bit mode support Xiubo Li 2015-12-08 19:11 ` Applied "regmap: add 64-bit mode support" to the regmap tree Mark Brown 2015-12-09 8:45 ` [PATCH 2/3] regmap: add 64-bit mode support Arnd Bergmann 2015-12-09 9:01 ` Xiubo Li 2015-12-03 9:31 ` [PATCH 3/3] regcache: " Xiubo Li
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).