linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND][PATCH 1/2] regulator: da9062: Simplify the code iterating all regulators
@ 2019-10-07 11:50 Axel Lin
  2019-10-07 11:50 ` [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case Axel Lin
  2019-10-07 13:03 ` Applied "regulator: da9062: Simplify the code iterating all regulators" " Mark Brown
  0 siblings, 2 replies; 10+ messages in thread
From: Axel Lin @ 2019-10-07 11:50 UTC (permalink / raw)
  To: Mark Brown
  Cc: Steve Twiss, Support Opensource, Liam Girdwood, linux-kernel, Axel Lin

It's more straightforward to use for statement here.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
This was sent on https://lkml.org/lkml/2019/7/11/208 with Adam's Ack.
 drivers/regulator/da9062-regulator.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-regulator.c
index 710e67081d53..9bb895006455 100644
--- a/drivers/regulator/da9062-regulator.c
+++ b/drivers/regulator/da9062-regulator.c
@@ -942,8 +942,7 @@ static int da9062_regulator_probe(struct platform_device *pdev)
 	regulators->n_regulators = max_regulators;
 	platform_set_drvdata(pdev, regulators);
 
-	n = 0;
-	while (n < regulators->n_regulators) {
+	for (n = 0; n < regulators->n_regulators; n++) {
 		/* Initialise regulator structure */
 		regl = &regulators->regulator[n];
 		regl->hw = chip;
@@ -1002,8 +1001,6 @@ static int da9062_regulator_probe(struct platform_device *pdev)
 				regl->desc.name);
 			return PTR_ERR(regl->rdev);
 		}
-
-		n++;
 	}
 
 	/* LDOs overcurrent event support */
-- 
2.20.1


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

* [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case
  2019-10-07 11:50 [RESEND][PATCH 1/2] regulator: da9062: Simplify the code iterating all regulators Axel Lin
@ 2019-10-07 11:50 ` Axel Lin
  2019-10-08 10:41   ` Axel Lin
  2019-10-08 18:09   ` Applied "regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case" to the regulator tree Mark Brown
  2019-10-07 13:03 ` Applied "regulator: da9062: Simplify the code iterating all regulators" " Mark Brown
  1 sibling, 2 replies; 10+ messages in thread
From: Axel Lin @ 2019-10-07 11:50 UTC (permalink / raw)
  To: Mark Brown
  Cc: Steve Twiss, Support Opensource, Liam Girdwood, linux-kernel,
	Axel Lin, Adam Thomson

The sleep flag bit decides the mode for BUCK_MODE_MANUAL case, simplify
the logic as the result is the same.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
---
This was sent on https://lkml.org/lkml/2019/9/26/24 with Adam's Review.
 drivers/regulator/da9062-regulator.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-regulator.c
index 9bb895006455..4b24518f75b5 100644
--- a/drivers/regulator/da9062-regulator.c
+++ b/drivers/regulator/da9062-regulator.c
@@ -136,7 +136,7 @@ static int da9062_buck_set_mode(struct regulator_dev *rdev, unsigned mode)
 static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
 {
 	struct da9062_regulator *regl = rdev_get_drvdata(rdev);
-	unsigned int val, mode = 0;
+	unsigned int val;
 	int ret;
 
 	ret = regmap_field_read(regl->mode, &val);
@@ -146,7 +146,6 @@ static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
 	switch (val) {
 	default:
 	case BUCK_MODE_MANUAL:
-		mode = REGULATOR_MODE_FAST | REGULATOR_MODE_STANDBY;
 		/* Sleep flag bit decides the mode */
 		break;
 	case BUCK_MODE_SLEEP:
@@ -162,11 +161,9 @@ static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
 		return 0;
 
 	if (val)
-		mode &= REGULATOR_MODE_STANDBY;
+		return REGULATOR_MODE_STANDBY;
 	else
-		mode &= REGULATOR_MODE_NORMAL | REGULATOR_MODE_FAST;
-
-	return mode;
+		return REGULATOR_MODE_FAST;
 }
 
 /*
-- 
2.20.1


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

* Applied "regulator: da9062: Simplify the code iterating all regulators" to the regulator tree
  2019-10-07 11:50 [RESEND][PATCH 1/2] regulator: da9062: Simplify the code iterating all regulators Axel Lin
  2019-10-07 11:50 ` [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case Axel Lin
@ 2019-10-07 13:03 ` Mark Brown
  1 sibling, 0 replies; 10+ messages in thread
From: Mark Brown @ 2019-10-07 13:03 UTC (permalink / raw)
  To: Axel Lin
  Cc: Liam Girdwood, linux-kernel, Mark Brown, Steve Twiss, Support Opensource

The patch

   regulator: da9062: Simplify the code iterating all regulators

has been applied to the regulator tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-5.5

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 151b03791e4acb09bb9a9af2a87bca1240937d6c Mon Sep 17 00:00:00 2001
From: Axel Lin <axel.lin@ingics.com>
Date: Mon, 7 Oct 2019 19:50:08 +0800
Subject: [PATCH] regulator: da9062: Simplify the code iterating all regulators

It's more straightforward to use for statement here.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Steve Twiss <stwiss.opensource@diasemi.com>
Link: https://lore.kernel.org/r/20191007115009.25672-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/regulator/da9062-regulator.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-regulator.c
index 56f3f72d7707..1028db242f91 100644
--- a/drivers/regulator/da9062-regulator.c
+++ b/drivers/regulator/da9062-regulator.c
@@ -966,8 +966,7 @@ static int da9062_regulator_probe(struct platform_device *pdev)
 	regulators->n_regulators = max_regulators;
 	platform_set_drvdata(pdev, regulators);
 
-	n = 0;
-	while (n < regulators->n_regulators) {
+	for (n = 0; n < regulators->n_regulators; n++) {
 		/* Initialise regulator structure */
 		regl = &regulators->regulator[n];
 		regl->hw = chip;
@@ -1026,8 +1025,6 @@ static int da9062_regulator_probe(struct platform_device *pdev)
 				regl->desc.name);
 			return PTR_ERR(regl->rdev);
 		}
-
-		n++;
 	}
 
 	/* LDOs overcurrent event support */
-- 
2.20.1


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

* Re: [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case
  2019-10-07 11:50 ` [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case Axel Lin
@ 2019-10-08 10:41   ` Axel Lin
  2019-10-08 10:44     ` Mark Brown
  2019-10-08 18:09   ` Applied "regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case" to the regulator tree Mark Brown
  1 sibling, 1 reply; 10+ messages in thread
From: Axel Lin @ 2019-10-08 10:41 UTC (permalink / raw)
  To: Mark Brown
  Cc: Steve Twiss, Support Opensource, Liam Girdwood, LKML, Adam Thomson

Axel Lin <axel.lin@ingics.com> 於 2019年10月7日 週一 下午7:50寫道:
>
> The sleep flag bit decides the mode for BUCK_MODE_MANUAL case, simplify
> the logic as the result is the same.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Hi Mark,

I'm wondering if any issue with this patch?
Note, this patch is for da9062 (not for da9063 which is already applied).

Regards,
Axel

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

* Re: [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case
  2019-10-08 10:41   ` Axel Lin
@ 2019-10-08 10:44     ` Mark Brown
  2019-10-08 10:48       ` Axel Lin
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2019-10-08 10:44 UTC (permalink / raw)
  To: Axel Lin
  Cc: Steve Twiss, Support Opensource, Liam Girdwood, LKML, Adam Thomson

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

On Tue, Oct 08, 2019 at 06:41:21PM +0800, Axel Lin wrote:

> I'm wondering if any issue with this patch?
> Note, this patch is for da9062 (not for da9063 which is already applied).

It doesn't seem to apply against current code.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case
  2019-10-08 10:44     ` Mark Brown
@ 2019-10-08 10:48       ` Axel Lin
  2019-10-08 10:51         ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Axel Lin @ 2019-10-08 10:48 UTC (permalink / raw)
  To: Mark Brown
  Cc: Steve Twiss, Support Opensource, Liam Girdwood, LKML, Adam Thomson

Mark Brown <broonie@kernel.org> 於 2019年10月8日 週二 下午6:44寫道:
>
> On Tue, Oct 08, 2019 at 06:41:21PM +0800, Axel Lin wrote:
>
> > I'm wondering if any issue with this patch?
> > Note, this patch is for da9062 (not for da9063 which is already applied).
>
> It doesn't seem to apply against current code.
I just test apply it and It looks fine to be applied by linux-next tree.
Or which branch of regulator tree should I generate the patch?

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

* Re: [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case
  2019-10-08 10:48       ` Axel Lin
@ 2019-10-08 10:51         ` Mark Brown
  2019-10-08 10:53           ` Axel Lin
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2019-10-08 10:51 UTC (permalink / raw)
  To: Axel Lin
  Cc: Steve Twiss, Support Opensource, Liam Girdwood, LKML, Adam Thomson

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

On Tue, Oct 08, 2019 at 06:48:15PM +0800, Axel Lin wrote:
> Mark Brown <broonie@kernel.org> 於 2019年10月8日 週二 下午6:44寫道:

> > It doesn't seem to apply against current code.

> I just test apply it and It looks fine to be applied by linux-next tree.
> Or which branch of regulator tree should I generate the patch?

Well, I queued it for 5.5.  I've not seen if it's got dependencies
against 5.4 yet but you chased me so...

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case
  2019-10-08 10:51         ` Mark Brown
@ 2019-10-08 10:53           ` Axel Lin
  2019-10-08 11:07             ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Axel Lin @ 2019-10-08 10:53 UTC (permalink / raw)
  To: Mark Brown
  Cc: Steve Twiss, Support Opensource, Liam Girdwood, LKML, Adam Thomson

Mark Brown <broonie@kernel.org> 於 2019年10月8日 週二 下午6:51寫道:
>
> On Tue, Oct 08, 2019 at 06:48:15PM +0800, Axel Lin wrote:
> > Mark Brown <broonie@kernel.org> 於 2019年10月8日 週二 下午6:44寫道:
>
> > > It doesn't seem to apply against current code.
>
> > I just test apply it and It looks fine to be applied by linux-next tree.
> > Or which branch of regulator tree should I generate the patch?
>
> Well, I queued it for 5.5.  I've not seen if it's got dependencies
> against 5.4 yet but you chased me so...

Ok, I see the problem.
commit a72865f05782 ("regulator: da9062: fix suspend_enable/disable
preparation") is in for-5.4 branch
but not in for-5.5 branch. So it does not apply to for-5.5 branch.

But if I generate the patch on for-5.5 branch, I think you will get
conflict when merge for-5.4 and for-5.5 to for-next.

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

* Re: [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case
  2019-10-08 10:53           ` Axel Lin
@ 2019-10-08 11:07             ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2019-10-08 11:07 UTC (permalink / raw)
  To: Axel Lin
  Cc: Steve Twiss, Support Opensource, Liam Girdwood, LKML, Adam Thomson

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

On Tue, Oct 08, 2019 at 06:53:22PM +0800, Axel Lin wrote:

> But if I generate the patch on for-5.5 branch, I think you will get
> conflict when merge for-5.4 and for-5.5 to for-next.

Right.  I will probably merge the 5.4 branch into the 5.5 branch at some
point, if something doesn't apply I will say so.  Like I say I've not
looked at that yet.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Applied "regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case" to the regulator tree
  2019-10-07 11:50 ` [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case Axel Lin
  2019-10-08 10:41   ` Axel Lin
@ 2019-10-08 18:09   ` Mark Brown
  1 sibling, 0 replies; 10+ messages in thread
From: Mark Brown @ 2019-10-08 18:09 UTC (permalink / raw)
  To: Axel Lin
  Cc: Adam Thomson, Liam Girdwood, linux-kernel, Mark Brown,
	Steve Twiss, Support Opensource

The patch

   regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case

has been applied to the regulator tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-5.5

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 be446f183ae35a8c76687ea8203fdd86f3f9678e Mon Sep 17 00:00:00 2001
From: Axel Lin <axel.lin@ingics.com>
Date: Mon, 7 Oct 2019 19:50:09 +0800
Subject: [PATCH] regulator: da9062: Simplify da9062_buck_set_mode for
 BUCK_MODE_MANUAL case

The sleep flag bit decides the mode for BUCK_MODE_MANUAL case, simplify
the logic as the result is the same.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/20191007115009.25672-2-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/regulator/da9062-regulator.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-regulator.c
index 9bb895006455..4b24518f75b5 100644
--- a/drivers/regulator/da9062-regulator.c
+++ b/drivers/regulator/da9062-regulator.c
@@ -136,7 +136,7 @@ static int da9062_buck_set_mode(struct regulator_dev *rdev, unsigned mode)
 static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
 {
 	struct da9062_regulator *regl = rdev_get_drvdata(rdev);
-	unsigned int val, mode = 0;
+	unsigned int val;
 	int ret;
 
 	ret = regmap_field_read(regl->mode, &val);
@@ -146,7 +146,6 @@ static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
 	switch (val) {
 	default:
 	case BUCK_MODE_MANUAL:
-		mode = REGULATOR_MODE_FAST | REGULATOR_MODE_STANDBY;
 		/* Sleep flag bit decides the mode */
 		break;
 	case BUCK_MODE_SLEEP:
@@ -162,11 +161,9 @@ static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
 		return 0;
 
 	if (val)
-		mode &= REGULATOR_MODE_STANDBY;
+		return REGULATOR_MODE_STANDBY;
 	else
-		mode &= REGULATOR_MODE_NORMAL | REGULATOR_MODE_FAST;
-
-	return mode;
+		return REGULATOR_MODE_FAST;
 }
 
 /*
-- 
2.20.1


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

end of thread, other threads:[~2019-10-08 18:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-07 11:50 [RESEND][PATCH 1/2] regulator: da9062: Simplify the code iterating all regulators Axel Lin
2019-10-07 11:50 ` [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case Axel Lin
2019-10-08 10:41   ` Axel Lin
2019-10-08 10:44     ` Mark Brown
2019-10-08 10:48       ` Axel Lin
2019-10-08 10:51         ` Mark Brown
2019-10-08 10:53           ` Axel Lin
2019-10-08 11:07             ` Mark Brown
2019-10-08 18:09   ` Applied "regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case" to the regulator tree Mark Brown
2019-10-07 13:03 ` Applied "regulator: da9062: Simplify the code iterating all regulators" " Mark Brown

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).