regulator: da9062: Simplify the code iterating all regulators
PATCH RESEND 1/2 regulator: da9062: Simplify the code iterating all regulators
It's more straightforward to use for statement here.
---
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(-)
drivers/regulator/da9062-regulator.c +1 -4
@@ -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 = ®ulators->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 */
Signature · 1 line
2.20.1
PATCH RESEND 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.
---
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(-)
drivers/regulator/da9062-regulator.c +3 -6
@@ -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 ; }/*
Signature · 1 line
2.20.1
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寫道:
Quoted 6 lines
The sleep flag bit decides the mode for
BUCK_MODE_MANUALcase, 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
Mark Brown
maintainerRe: [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case
Quoted 2 lines · Axel Lin
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.
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寫道:
Quoted 7 lines · Axel Lin
Quoted 3 lines
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?
Mark Brown
maintainerRe: [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case
Quoted 6 lines · Axel Lin
Mark Brown <[email protected]> 於 2019年10月8日 週二 下午6:44寫道:
Quoted 1 line
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...
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寫道:
Quoted 11 lines · Axel Lin
Quoted 6 lines
Mark Brown <[email protected]> 於 2019年10月8日 週二 下午6:44寫道:
Quoted 1 line
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.
Mark Brown
maintainerRe: [RESEND][PATCH 2/2] regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case
Quoted 2 lines · Axel Lin
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.
Mark Brown
maintainerApplied "regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case" to the regulator tree
In reply to Axel LinThe 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.
--- drivers/regulator/da9062-regulator.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/regulator/da9062-regulator.c +3 -6
@@ -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 ; }/*
Signature · 1 line
2.20.1
Mark Brown
maintainerApplied "regulator: da9062: Simplify the code iterating all regulators" to the regulator tree
In reply to Axel LinThe 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.
--- drivers/regulator/da9062-regulator.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/regulator/da9062-regulator.c +1 -4
@@ -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 = ®ulators->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 */
Signature · 1 line
2.20.1