2019-10-07 11:51:36

by Axel Lin

[permalink] [raw]
Subject: [RESEND][PATCH 1/2] regulator: da9062: Simplify the code iterating all regulators

It's more straightforward to use for statement here.

Signed-off-by: Axel Lin <[email protected]>
Acked-by: Steve Twiss <[email protected]>
---
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


2019-10-07 11:53:37

by Axel Lin

[permalink] [raw]
Subject: [RESEND][PATCH 2/2] 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 <[email protected]>
Reviewed-by: Adam Thomson <[email protected]>
---
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

2019-10-07 13:09:06

by Mark Brown

[permalink] [raw]
Subject: Applied "regulator: da9062: Simplify the code iterating all regulators" to the regulator tree

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 <[email protected]>
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 <[email protected]>
Acked-by: Steve Twiss <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
---
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

2019-10-08 10:42:07

by Axel Lin

[permalink] [raw]
Subject: Re: [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case

Axel Lin <[email protected]> 於 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 <[email protected]>
> Reviewed-by: Adam Thomson <[email protected]>
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

2019-10-08 10:44:56

by Mark Brown

[permalink] [raw]
Subject: Re: [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case

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.


Attachments:
(No filename) (235.00 B)
signature.asc (499.00 B)
Download all attachments

2019-10-08 10:49:49

by Axel Lin

[permalink] [raw]
Subject: Re: [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case

Mark Brown <[email protected]> 於 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?

2019-10-08 10:51:57

by Mark Brown

[permalink] [raw]
Subject: Re: [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case

On Tue, Oct 08, 2019 at 06:48:15PM +0800, Axel Lin wrote:
> Mark Brown <[email protected]> 於 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...


Attachments:
(No filename) (451.00 B)
signature.asc (499.00 B)
Download all attachments

2019-10-08 10:57:30

by Axel Lin

[permalink] [raw]
Subject: Re: [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case

Mark Brown <[email protected]> 於 2019年10月8日 週二 下午6:51寫道:
>
> On Tue, Oct 08, 2019 at 06:48:15PM +0800, Axel Lin wrote:
> > Mark Brown <[email protected]> 於 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.

2019-10-08 11:11:48

by Mark Brown

[permalink] [raw]
Subject: Re: [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case

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.


Attachments:
(No filename) (356.00 B)
signature.asc (499.00 B)
Download all attachments

2019-10-08 18:12:14

by Mark Brown

[permalink] [raw]
Subject: Applied "regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case" to the regulator tree

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 <[email protected]>
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 <[email protected]>
Reviewed-by: Adam Thomson <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
---
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