linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: da9121: Return REGULATOR_MODE_INVALID for invalid mode
@ 2021-05-17  5:27 Axel Lin
  2021-05-17 14:08 ` Adam Ward
  2021-05-18 16:31 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2021-05-17  5:27 UTC (permalink / raw)
  To: Mark Brown
  Cc: Adam Ward, Vincent Whitchurch, Liam Girdwood, linux-kernel, Axel Lin

-EINVAL is not a valid return value for .of_map_mode, return
REGULATOR_MODE_INVALID instead.

Fixes: 65ac97042d4e ("regulator: da9121: add mode support")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/da9121-regulator.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-regulator.c
index 08cbf688e14d..e66925090258 100644
--- a/drivers/regulator/da9121-regulator.c
+++ b/drivers/regulator/da9121-regulator.c
@@ -280,7 +280,7 @@ static unsigned int da9121_map_mode(unsigned int mode)
 	case DA9121_BUCK_MODE_FORCE_PFM:
 		return REGULATOR_MODE_STANDBY;
 	default:
-		return -EINVAL;
+		return REGULATOR_MODE_INVALID;
 	}
 }
 
@@ -317,7 +317,7 @@ static unsigned int da9121_buck_get_mode(struct regulator_dev *rdev)
 {
 	struct da9121 *chip = rdev_get_drvdata(rdev);
 	int id = rdev_get_id(rdev);
-	unsigned int val;
+	unsigned int val, mode;
 	int ret = 0;
 
 	ret = regmap_read(chip->regmap, da9121_mode_field[id].reg, &val);
@@ -326,7 +326,11 @@ static unsigned int da9121_buck_get_mode(struct regulator_dev *rdev)
 		return -EINVAL;
 	}
 
-	return da9121_map_mode(val & da9121_mode_field[id].msk);
+	mode = da9121_map_mode(val & da9121_mode_field[id].msk);
+	if (mode == REGULATOR_MODE_INVALID)
+		return -EINVAL;
+
+	return mode;
 }
 
 static const struct regulator_ops da9121_buck_ops = {
-- 
2.25.1


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

* RE: [PATCH] regulator: da9121: Return REGULATOR_MODE_INVALID for invalid mode
  2021-05-17  5:27 [PATCH] regulator: da9121: Return REGULATOR_MODE_INVALID for invalid mode Axel Lin
@ 2021-05-17 14:08 ` Adam Ward
  2021-05-18 16:31 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Adam Ward @ 2021-05-17 14:08 UTC (permalink / raw)
  To: Axel Lin, Mark Brown
  Cc: Adam Ward, Vincent Whitchurch, Liam Girdwood, linux-kernel

On 17 May 2021 06:27, Axel Lin wrote:

> -EINVAL is not a valid return value for .of_map_mode, return
> REGULATOR_MODE_INVALID instead.
> 
> Fixes: 65ac97042d4e ("regulator: da9121: add mode support")
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---

Acked-by: Adam Ward <Adam.Ward.opensource@diasemi.com>


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

* Re: [PATCH] regulator: da9121: Return REGULATOR_MODE_INVALID for invalid mode
  2021-05-17  5:27 [PATCH] regulator: da9121: Return REGULATOR_MODE_INVALID for invalid mode Axel Lin
  2021-05-17 14:08 ` Adam Ward
@ 2021-05-18 16:31 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-05-18 16:31 UTC (permalink / raw)
  To: Axel Lin
  Cc: Mark Brown, Adam Ward, Vincent Whitchurch, linux-kernel, Liam Girdwood

On Mon, 17 May 2021 13:27:21 +0800, Axel Lin wrote:
> -EINVAL is not a valid return value for .of_map_mode, return
> REGULATOR_MODE_INVALID instead.

Applied to

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

Thanks!

[1/1] regulator: da9121: Return REGULATOR_MODE_INVALID for invalid mode
      commit: 0b1e552673724832b08d49037cdeeac634a3b319

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

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

end of thread, other threads:[~2021-05-18 16:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17  5:27 [PATCH] regulator: da9121: Return REGULATOR_MODE_INVALID for invalid mode Axel Lin
2021-05-17 14:08 ` Adam Ward
2021-05-18 16:31 ` 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).