linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] regulator: pwm: Prints error number along with detail
@ 2016-03-14 12:50 Laxman Dewangan
  2016-03-15  9:29 ` Applied "regulator: pwm: Prints error number along with detail" to the regulator tree Mark Brown
  2016-03-16  7:40 ` [PATCH V2] regulator: pwm: Prints error number along with detail Lee Jones
  0 siblings, 2 replies; 3+ messages in thread
From: Laxman Dewangan @ 2016-03-14 12:50 UTC (permalink / raw)
  To: broonie; +Cc: lgirdwood, linux-kernel, Laxman Dewangan, Lee Jones

Prints the error number along with error message when any
error occurs. This help on getting the reason of failure
quickly from log without any code instrument.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Lee Jones <lee.jones@linaro.org>
---
This was part of the series:
regulator: pwm: Add supports for multiple instance and voltage linear step
But first 2 patches are already applied of this series, creating patch on top
of applied patches and resetting the patch count.

- Taken care of the comment for error print like it should be "foo: %d\n"
  style.
- Added error number on all possible places.

 drivers/regulator/pwm-regulator.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c
index 4689d62..f99a697 100644
--- a/drivers/regulator/pwm-regulator.c
+++ b/drivers/regulator/pwm-regulator.c
@@ -70,7 +70,7 @@ static int pwm_regulator_set_voltage_sel(struct regulator_dev *rdev,
 
 	ret = pwm_config(drvdata->pwm, dutycycle, pwm_reg_period);
 	if (ret) {
-		dev_err(&rdev->dev, "Failed to configure PWM\n");
+		dev_err(&rdev->dev, "Failed to configure PWM: %d\n", ret);
 		return ret;
 	}
 
@@ -146,13 +146,13 @@ static int pwm_regulator_set_voltage(struct regulator_dev *rdev,
 
 	ret = pwm_config(drvdata->pwm, (period / 100) * duty_cycle, period);
 	if (ret) {
-		dev_err(&rdev->dev, "Failed to configure PWM\n");
+		dev_err(&rdev->dev, "Failed to configure PWM: %d\n", ret);
 		return ret;
 	}
 
 	ret = pwm_enable(drvdata->pwm);
 	if (ret) {
-		dev_err(&rdev->dev, "Failed to enable PWM\n");
+		dev_err(&rdev->dev, "Failed to enable PWM: %d\n", ret);
 		return ret;
 	}
 	drvdata->volt_uV = min_uV;
@@ -200,8 +200,7 @@ static int pwm_regulator_init_table(struct platform_device *pdev,
 
 	if ((length < sizeof(*duty_cycle_table)) ||
 	    (length % sizeof(*duty_cycle_table))) {
-		dev_err(&pdev->dev,
-			"voltage-table length(%d) is invalid\n",
+		dev_err(&pdev->dev, "voltage-table length(%d) is invalid\n",
 			length);
 		return -EINVAL;
 	}
@@ -214,7 +213,7 @@ static int pwm_regulator_init_table(struct platform_device *pdev,
 					 (u32 *)duty_cycle_table,
 					 length / sizeof(u32));
 	if (ret) {
-		dev_err(&pdev->dev, "Failed to read voltage-table\n");
+		dev_err(&pdev->dev, "Failed to read voltage-table: %d\n", ret);
 		return ret;
 	}
 
@@ -277,16 +276,18 @@ static int pwm_regulator_probe(struct platform_device *pdev)
 
 	drvdata->pwm = devm_pwm_get(&pdev->dev, NULL);
 	if (IS_ERR(drvdata->pwm)) {
-		dev_err(&pdev->dev, "Failed to get PWM\n");
-		return PTR_ERR(drvdata->pwm);
+		ret = PTR_ERR(drvdata->pwm);
+		dev_err(&pdev->dev, "Failed to get PWM: %d\n", ret);
+		return ret;
 	}
 
 	regulator = devm_regulator_register(&pdev->dev,
 					    &drvdata->desc, &config);
 	if (IS_ERR(regulator)) {
-		dev_err(&pdev->dev, "Failed to register regulator %s\n",
-			drvdata->desc.name);
-		return PTR_ERR(regulator);
+		ret = PTR_ERR(regulator);
+		dev_err(&pdev->dev, "Failed to register regulator %s: %d\n",
+			drvdata->desc.name, ret);
+		return ret;
 	}
 
 	return 0;
-- 
2.1.4

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

* Applied "regulator: pwm: Prints error number along with detail" to the regulator tree
  2016-03-14 12:50 [PATCH V2] regulator: pwm: Prints error number along with detail Laxman Dewangan
@ 2016-03-15  9:29 ` Mark Brown
  2016-03-16  7:40 ` [PATCH V2] regulator: pwm: Prints error number along with detail Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2016-03-15  9:29 UTC (permalink / raw)
  To: Laxman Dewangan, Lee Jones, Mark Brown; +Cc: linux-kernel

The patch

   regulator: pwm: Prints error number along with detail

has been applied to the regulator tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 

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 5bf59bd5e9a5b262110df8c1ea5ad8820d7d524a Mon Sep 17 00:00:00 2001
From: Laxman Dewangan <ldewangan@nvidia.com>
Date: Mon, 14 Mar 2016 18:20:13 +0530
Subject: [PATCH] regulator: pwm: Prints error number along with detail

Prints the error number along with error message when any
error occurs. This help on getting the reason of failure
quickly from log without any code instrument.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/regulator/pwm-regulator.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c
index 4689d62f4841..f99a6970be29 100644
--- a/drivers/regulator/pwm-regulator.c
+++ b/drivers/regulator/pwm-regulator.c
@@ -70,7 +70,7 @@ static int pwm_regulator_set_voltage_sel(struct regulator_dev *rdev,
 
 	ret = pwm_config(drvdata->pwm, dutycycle, pwm_reg_period);
 	if (ret) {
-		dev_err(&rdev->dev, "Failed to configure PWM\n");
+		dev_err(&rdev->dev, "Failed to configure PWM: %d\n", ret);
 		return ret;
 	}
 
@@ -146,13 +146,13 @@ static int pwm_regulator_set_voltage(struct regulator_dev *rdev,
 
 	ret = pwm_config(drvdata->pwm, (period / 100) * duty_cycle, period);
 	if (ret) {
-		dev_err(&rdev->dev, "Failed to configure PWM\n");
+		dev_err(&rdev->dev, "Failed to configure PWM: %d\n", ret);
 		return ret;
 	}
 
 	ret = pwm_enable(drvdata->pwm);
 	if (ret) {
-		dev_err(&rdev->dev, "Failed to enable PWM\n");
+		dev_err(&rdev->dev, "Failed to enable PWM: %d\n", ret);
 		return ret;
 	}
 	drvdata->volt_uV = min_uV;
@@ -200,8 +200,7 @@ static int pwm_regulator_init_table(struct platform_device *pdev,
 
 	if ((length < sizeof(*duty_cycle_table)) ||
 	    (length % sizeof(*duty_cycle_table))) {
-		dev_err(&pdev->dev,
-			"voltage-table length(%d) is invalid\n",
+		dev_err(&pdev->dev, "voltage-table length(%d) is invalid\n",
 			length);
 		return -EINVAL;
 	}
@@ -214,7 +213,7 @@ static int pwm_regulator_init_table(struct platform_device *pdev,
 					 (u32 *)duty_cycle_table,
 					 length / sizeof(u32));
 	if (ret) {
-		dev_err(&pdev->dev, "Failed to read voltage-table\n");
+		dev_err(&pdev->dev, "Failed to read voltage-table: %d\n", ret);
 		return ret;
 	}
 
@@ -277,16 +276,18 @@ static int pwm_regulator_probe(struct platform_device *pdev)
 
 	drvdata->pwm = devm_pwm_get(&pdev->dev, NULL);
 	if (IS_ERR(drvdata->pwm)) {
-		dev_err(&pdev->dev, "Failed to get PWM\n");
-		return PTR_ERR(drvdata->pwm);
+		ret = PTR_ERR(drvdata->pwm);
+		dev_err(&pdev->dev, "Failed to get PWM: %d\n", ret);
+		return ret;
 	}
 
 	regulator = devm_regulator_register(&pdev->dev,
 					    &drvdata->desc, &config);
 	if (IS_ERR(regulator)) {
-		dev_err(&pdev->dev, "Failed to register regulator %s\n",
-			drvdata->desc.name);
-		return PTR_ERR(regulator);
+		ret = PTR_ERR(regulator);
+		dev_err(&pdev->dev, "Failed to register regulator %s: %d\n",
+			drvdata->desc.name, ret);
+		return ret;
 	}
 
 	return 0;
-- 
2.7.0

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

* Re: [PATCH V2] regulator: pwm: Prints error number along with detail
  2016-03-14 12:50 [PATCH V2] regulator: pwm: Prints error number along with detail Laxman Dewangan
  2016-03-15  9:29 ` Applied "regulator: pwm: Prints error number along with detail" to the regulator tree Mark Brown
@ 2016-03-16  7:40 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2016-03-16  7:40 UTC (permalink / raw)
  To: Laxman Dewangan; +Cc: broonie, lgirdwood, linux-kernel

On Mon, 14 Mar 2016, Laxman Dewangan wrote:

> Prints the error number along with error message when any
> error occurs. This help on getting the reason of failure
> quickly from log without any code instrument.
> 
> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> ---
> This was part of the series:
> regulator: pwm: Add supports for multiple instance and voltage linear step
> But first 2 patches are already applied of this series, creating patch on top
> of applied patches and resetting the patch count.
> 
> - Taken care of the comment for error print like it should be "foo: %d\n"
>   style.
> - Added error number on all possible places.
> 
>  drivers/regulator/pwm-regulator.c | 23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)

Acked-by: Lee Jones <lee.jones@linaro.org>

> diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c
> index 4689d62..f99a697 100644
> --- a/drivers/regulator/pwm-regulator.c
> +++ b/drivers/regulator/pwm-regulator.c
> @@ -70,7 +70,7 @@ static int pwm_regulator_set_voltage_sel(struct regulator_dev *rdev,
>  
>  	ret = pwm_config(drvdata->pwm, dutycycle, pwm_reg_period);
>  	if (ret) {
> -		dev_err(&rdev->dev, "Failed to configure PWM\n");
> +		dev_err(&rdev->dev, "Failed to configure PWM: %d\n", ret);
>  		return ret;
>  	}
>  
> @@ -146,13 +146,13 @@ static int pwm_regulator_set_voltage(struct regulator_dev *rdev,
>  
>  	ret = pwm_config(drvdata->pwm, (period / 100) * duty_cycle, period);
>  	if (ret) {
> -		dev_err(&rdev->dev, "Failed to configure PWM\n");
> +		dev_err(&rdev->dev, "Failed to configure PWM: %d\n", ret);
>  		return ret;
>  	}
>  
>  	ret = pwm_enable(drvdata->pwm);
>  	if (ret) {
> -		dev_err(&rdev->dev, "Failed to enable PWM\n");
> +		dev_err(&rdev->dev, "Failed to enable PWM: %d\n", ret);
>  		return ret;
>  	}
>  	drvdata->volt_uV = min_uV;
> @@ -200,8 +200,7 @@ static int pwm_regulator_init_table(struct platform_device *pdev,
>  
>  	if ((length < sizeof(*duty_cycle_table)) ||
>  	    (length % sizeof(*duty_cycle_table))) {
> -		dev_err(&pdev->dev,
> -			"voltage-table length(%d) is invalid\n",
> +		dev_err(&pdev->dev, "voltage-table length(%d) is invalid\n",
>  			length);
>  		return -EINVAL;
>  	}
> @@ -214,7 +213,7 @@ static int pwm_regulator_init_table(struct platform_device *pdev,
>  					 (u32 *)duty_cycle_table,
>  					 length / sizeof(u32));
>  	if (ret) {
> -		dev_err(&pdev->dev, "Failed to read voltage-table\n");
> +		dev_err(&pdev->dev, "Failed to read voltage-table: %d\n", ret);
>  		return ret;
>  	}
>  
> @@ -277,16 +276,18 @@ static int pwm_regulator_probe(struct platform_device *pdev)
>  
>  	drvdata->pwm = devm_pwm_get(&pdev->dev, NULL);
>  	if (IS_ERR(drvdata->pwm)) {
> -		dev_err(&pdev->dev, "Failed to get PWM\n");
> -		return PTR_ERR(drvdata->pwm);
> +		ret = PTR_ERR(drvdata->pwm);
> +		dev_err(&pdev->dev, "Failed to get PWM: %d\n", ret);
> +		return ret;
>  	}
>  
>  	regulator = devm_regulator_register(&pdev->dev,
>  					    &drvdata->desc, &config);
>  	if (IS_ERR(regulator)) {
> -		dev_err(&pdev->dev, "Failed to register regulator %s\n",
> -			drvdata->desc.name);
> -		return PTR_ERR(regulator);
> +		ret = PTR_ERR(regulator);
> +		dev_err(&pdev->dev, "Failed to register regulator %s: %d\n",
> +			drvdata->desc.name, ret);
> +		return ret;
>  	}
>  
>  	return 0;

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2016-03-16  7:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-14 12:50 [PATCH V2] regulator: pwm: Prints error number along with detail Laxman Dewangan
2016-03-15  9:29 ` Applied "regulator: pwm: Prints error number along with detail" to the regulator tree Mark Brown
2016-03-16  7:40 ` [PATCH V2] regulator: pwm: Prints error number along with detail Lee Jones

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