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


Groups > linux.kernel > #1664891 > unrolled thread

[PATCH 1/2] regulator: tps65910: check TPS65910_NUM_REGS at build time

Started byMichał Mirosław <mirq-linux@rere.qmqm.pl>
First post2017-06-13 16:00 +0200
Last post2017-06-13 19:50 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] regulator: tps65910: check TPS65910_NUM_REGS at build  time Michał Mirosław <mirq-linux@rere.qmqm.pl> - 2017-06-13 16:00 +0200
    Re: [PATCH 1/2] regulator: tps65910: check TPS65910_NUM_REGS at build  time Keerthy <j-keerthy@ti.com> - 2017-06-13 16:10 +0200
      Re: [PATCH 1/2] regulator: tps65910: check TPS65910_NUM_REGS at  build time Michał Mirosław <mirq-linux@rere.qmqm.pl> - 2017-06-13 16:40 +0200
    [PATCH v2 1/2] regulator: tps65910: check TPS65910_NUM_REGS at build  time Michał Mirosław <mirq-linux@rere.qmqm.pl> - 2017-06-13 16:50 +0200
      Re: [PATCH v2 1/2] regulator: tps65910: check TPS65910_NUM_REGS at  build time Mark Brown <broonie@kernel.org> - 2017-06-13 19:50 +0200

#1664891 — [PATCH 1/2] regulator: tps65910: check TPS65910_NUM_REGS at build time

FromMichał Mirosław <mirq-linux@rere.qmqm.pl>
Date2017-06-13 16:00 +0200
Subject[PATCH 1/2] regulator: tps65910: check TPS65910_NUM_REGS at build time
Message-ID<tRUwp-dH-13@gated-at.bofh.it>
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/regulator/tps65910-regulator.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c
index 696116ebdf50a..81672a58fcc23 100644
--- a/drivers/regulator/tps65910-regulator.c
+++ b/drivers/regulator/tps65910-regulator.c
@@ -1107,6 +1107,7 @@ static int tps65910_probe(struct platform_device *pdev)
 
 	switch (tps65910_chip_id(tps65910)) {
 	case TPS65910:
+		BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65910_regs));
 		pmic->get_ctrl_reg = &tps65910_get_ctrl_register;
 		pmic->num_regulators = ARRAY_SIZE(tps65910_regs);
 		pmic->ext_sleep_control = tps65910_ext_sleep_control;
@@ -1119,6 +1120,7 @@ static int tps65910_probe(struct platform_device *pdev)
 					DCDCCTRL_DCDCCKSYNC_MASK);
 		break;
 	case TPS65911:
+		BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65911_regs));
 		pmic->get_ctrl_reg = &tps65911_get_ctrl_register;
 		pmic->num_regulators = ARRAY_SIZE(tps65911_regs);
 		pmic->ext_sleep_control = tps65911_ext_sleep_control;
@@ -1144,8 +1146,7 @@ static int tps65910_probe(struct platform_device *pdev)
 	if (!pmic->rdev)
 		return -ENOMEM;
 
-	for (i = 0; i < pmic->num_regulators && i < TPS65910_NUM_REGS;
-			i++, info++) {
+	for (i = 0; i < pmic->num_regulators; i++, info++) {
 		/* Register the regulators */
 		pmic->info[i] = info;
 
-- 
2.11.0

[toc] | [next] | [standalone]


#1664910

FromKeerthy <j-keerthy@ti.com>
Date2017-06-13 16:10 +0200
Message-ID<tRUG7-w3-43@gated-at.bofh.it>
In reply to#1664891

On Tuesday 13 June 2017 07:28 PM, Michał Mirosław wrote:

Missing commit log?

> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
>  drivers/regulator/tps65910-regulator.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c
> index 696116ebdf50a..81672a58fcc23 100644
> --- a/drivers/regulator/tps65910-regulator.c
> +++ b/drivers/regulator/tps65910-regulator.c
> @@ -1107,6 +1107,7 @@ static int tps65910_probe(struct platform_device *pdev)
>  
>  	switch (tps65910_chip_id(tps65910)) {
>  	case TPS65910:
> +		BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65910_regs));
>  		pmic->get_ctrl_reg = &tps65910_get_ctrl_register;
>  		pmic->num_regulators = ARRAY_SIZE(tps65910_regs);
>  		pmic->ext_sleep_control = tps65910_ext_sleep_control;
> @@ -1119,6 +1120,7 @@ static int tps65910_probe(struct platform_device *pdev)
>  					DCDCCTRL_DCDCCKSYNC_MASK);
>  		break;
>  	case TPS65911:
> +		BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65911_regs));
>  		pmic->get_ctrl_reg = &tps65911_get_ctrl_register;
>  		pmic->num_regulators = ARRAY_SIZE(tps65911_regs);
>  		pmic->ext_sleep_control = tps65911_ext_sleep_control;
> @@ -1144,8 +1146,7 @@ static int tps65910_probe(struct platform_device *pdev)
>  	if (!pmic->rdev)
>  		return -ENOMEM;
>  
> -	for (i = 0; i < pmic->num_regulators && i < TPS65910_NUM_REGS;
> -			i++, info++) {
> +	for (i = 0; i < pmic->num_regulators; i++, info++) {
>  		/* Register the regulators */
>  		pmic->info[i] = info;
>  
> 

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


#1664927 — Re: [PATCH 1/2] regulator: tps65910: check TPS65910_NUM_REGS at build time

FromMichał Mirosław <mirq-linux@rere.qmqm.pl>
Date2017-06-13 16:40 +0200
SubjectRe: [PATCH 1/2] regulator: tps65910: check TPS65910_NUM_REGS at build time
Message-ID<tRV97-Fy-11@gated-at.bofh.it>
In reply to#1664910
On Tue, Jun 13, 2017 at 07:31:21PM +0530, Keerthy wrote:
> On Tuesday 13 June 2017 07:28 PM, Michał Mirosław wrote:
> 
> Missing commit log?
[...]

Oh, indeed. I'll fix this in a moment.

Best Regards,
Michał Mirosław

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


#1664939 — [PATCH v2 1/2] regulator: tps65910: check TPS65910_NUM_REGS at build time

FromMichał Mirosław <mirq-linux@rere.qmqm.pl>
Date2017-06-13 16:50 +0200
Subject[PATCH v2 1/2] regulator: tps65910: check TPS65910_NUM_REGS at build time
Message-ID<tRViO-Jw-15@gated-at.bofh.it>
In reply to#1664891
Check TPS65910_NUM_REGS at build time instead of silently registering
not all regulators at runtime.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
v2:
  - added commit message

 drivers/regulator/tps65910-regulator.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c
index 696116ebdf50a..81672a58fcc23 100644
--- a/drivers/regulator/tps65910-regulator.c
+++ b/drivers/regulator/tps65910-regulator.c
@@ -1107,6 +1107,7 @@ static int tps65910_probe(struct platform_device *pdev)
 
 	switch (tps65910_chip_id(tps65910)) {
 	case TPS65910:
+		BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65910_regs));
 		pmic->get_ctrl_reg = &tps65910_get_ctrl_register;
 		pmic->num_regulators = ARRAY_SIZE(tps65910_regs);
 		pmic->ext_sleep_control = tps65910_ext_sleep_control;
@@ -1119,6 +1120,7 @@ static int tps65910_probe(struct platform_device *pdev)
 					DCDCCTRL_DCDCCKSYNC_MASK);
 		break;
 	case TPS65911:
+		BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65911_regs));
 		pmic->get_ctrl_reg = &tps65911_get_ctrl_register;
 		pmic->num_regulators = ARRAY_SIZE(tps65911_regs);
 		pmic->ext_sleep_control = tps65911_ext_sleep_control;
@@ -1144,8 +1146,7 @@ static int tps65910_probe(struct platform_device *pdev)
 	if (!pmic->rdev)
 		return -ENOMEM;
 
-	for (i = 0; i < pmic->num_regulators && i < TPS65910_NUM_REGS;
-			i++, info++) {
+	for (i = 0; i < pmic->num_regulators; i++, info++) {
 		/* Register the regulators */
 		pmic->info[i] = info;
 
-- 
2.11.0

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


#1665064 — Re: [PATCH v2 1/2] regulator: tps65910: check TPS65910_NUM_REGS at build time

FromMark Brown <broonie@kernel.org>
Date2017-06-13 19:50 +0200
SubjectRe: [PATCH v2 1/2] regulator: tps65910: check TPS65910_NUM_REGS at build time
Message-ID<tRY70-2tP-27@gated-at.bofh.it>
In reply to#1664939

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

On Tue, Jun 13, 2017 at 04:41:56PM +0200, Michał Mirosław wrote:
> Check TPS65910_NUM_REGS at build time instead of silently registering
> not all regulators at runtime.

Please don't send new versions of patches in reply to existing threads,
it makes it hard to figure out what the current versions of things are.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web