public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* mfd: tps65090: set regmap config reg counts properly
@ 2016-01-31 22:00 Maciej S. Szmigiero
  2016-02-11 17:06 ` Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Maciej S. Szmigiero @ 2016-01-31 22:00 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, vbyravarasu

Regmap config max_register field should contain number of
device last register, however num_reg_defaults_raw field
should be set to register count instead
(usually one register more than max_register).

tps65090 driver had both of these fields set to the same value,
fix this by introducing separate defines for max register
number and total count of registers.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
---
 drivers/mfd/tps65090.c       | 5 ++---
 include/linux/mfd/tps65090.h | 5 +++++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/tps65090.c b/drivers/mfd/tps65090.c
index f88085ad9772..d7ec318c40c3 100644
--- a/drivers/mfd/tps65090.c
+++ b/drivers/mfd/tps65090.c
@@ -30,7 +30,6 @@
 #include <linux/err.h>
 
 #define NUM_INT_REG 2
-#define TOTAL_NUM_REG 0x18
 
 #define TPS65090_INT1_MASK_VAC_STATUS_CHANGE		1
 #define TPS65090_INT1_MASK_VSYS_STATUS_CHANGE		2
@@ -161,8 +160,8 @@ static bool is_volatile_reg(struct device *dev, unsigned int reg)
 static const struct regmap_config tps65090_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
-	.max_register = TOTAL_NUM_REG,
-	.num_reg_defaults_raw = TOTAL_NUM_REG,
+	.max_register = TPS65090_MAX_REG,
+	.num_reg_defaults_raw = TPS65090_NUM_REGS,
 	.cache_type = REGCACHE_RBTREE,
 	.volatile_reg = is_volatile_reg,
 };
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
index 0bf2708df150..67d144b3b8f9 100644
--- a/include/linux/mfd/tps65090.h
+++ b/include/linux/mfd/tps65090.h
@@ -77,6 +77,11 @@ enum {
 #define TPS65090_REG_CG_CTRL5	0x09
 #define TPS65090_REG_CG_STATUS1	0x0a
 #define TPS65090_REG_CG_STATUS2	0x0b
+#define TPS65090_REG_AD_OUT1	0x17
+#define TPS65090_REG_AD_OUT2	0x18
+
+#define TPS65090_MAX_REG	TPS65090_REG_AD_OUT2
+#define TPS65090_NUM_REGS	(TPS65090_MAX_REG + 1)
 
 struct tps65090 {
 	struct device		*dev;

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

* Re: mfd: tps65090: set regmap config reg counts properly
  2016-01-31 22:00 mfd: tps65090: set regmap config reg counts properly Maciej S. Szmigiero
@ 2016-02-11 17:06 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2016-02-11 17:06 UTC (permalink / raw)
  To: Maciej S. Szmigiero; +Cc: linux-kernel, vbyravarasu

On Sun, 31 Jan 2016, Maciej S. Szmigiero wrote:

> Regmap config max_register field should contain number of
> device last register, however num_reg_defaults_raw field
> should be set to register count instead
> (usually one register more than max_register).
> 
> tps65090 driver had both of these fields set to the same value,
> fix this by introducing separate defines for max register
> number and total count of registers.
> 
> Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
> ---
>  drivers/mfd/tps65090.c       | 5 ++---
>  include/linux/mfd/tps65090.h | 5 +++++
>  2 files changed, 7 insertions(+), 3 deletions(-)

These 3 patches should really be submitted as a threaded set, so they
stay together in one's inbox.

Also, please submit patches using the subject line format expected by
the subsystem.

`git log --oneline -- <subsystem>` helps with this.

As you're a first time offender, I'll fix this for you this time.

Applied, thanks.

> diff --git a/drivers/mfd/tps65090.c b/drivers/mfd/tps65090.c
> index f88085ad9772..d7ec318c40c3 100644
> --- a/drivers/mfd/tps65090.c
> +++ b/drivers/mfd/tps65090.c
> @@ -30,7 +30,6 @@
>  #include <linux/err.h>
>  
>  #define NUM_INT_REG 2
> -#define TOTAL_NUM_REG 0x18
>  
>  #define TPS65090_INT1_MASK_VAC_STATUS_CHANGE		1
>  #define TPS65090_INT1_MASK_VSYS_STATUS_CHANGE		2
> @@ -161,8 +160,8 @@ static bool is_volatile_reg(struct device *dev, unsigned int reg)
>  static const struct regmap_config tps65090_regmap_config = {
>  	.reg_bits = 8,
>  	.val_bits = 8,
> -	.max_register = TOTAL_NUM_REG,
> -	.num_reg_defaults_raw = TOTAL_NUM_REG,
> +	.max_register = TPS65090_MAX_REG,
> +	.num_reg_defaults_raw = TPS65090_NUM_REGS,
>  	.cache_type = REGCACHE_RBTREE,
>  	.volatile_reg = is_volatile_reg,
>  };
> diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
> index 0bf2708df150..67d144b3b8f9 100644
> --- a/include/linux/mfd/tps65090.h
> +++ b/include/linux/mfd/tps65090.h
> @@ -77,6 +77,11 @@ enum {
>  #define TPS65090_REG_CG_CTRL5	0x09
>  #define TPS65090_REG_CG_STATUS1	0x0a
>  #define TPS65090_REG_CG_STATUS2	0x0b
> +#define TPS65090_REG_AD_OUT1	0x17
> +#define TPS65090_REG_AD_OUT2	0x18
> +
> +#define TPS65090_MAX_REG	TPS65090_REG_AD_OUT2
> +#define TPS65090_NUM_REGS	(TPS65090_MAX_REG + 1)
>  
>  struct tps65090 {
>  	struct device		*dev;

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2016-02-11 17:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-31 22:00 mfd: tps65090: set regmap config reg counts properly Maciej S. Szmigiero
2016-02-11 17:06 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox