public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Laxman Dewangan <ldewangan@nvidia.com>
Cc: broonie@kernel.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] regulator: pwm: Prints error number along with detail
Date: Wed, 16 Mar 2016 07:40:50 +0000	[thread overview]
Message-ID: <20160316074050.GS13692@x1> (raw)
In-Reply-To: <1457959813-1982-1-git-send-email-ldewangan@nvidia.com>

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

      parent reply	other threads:[~2016-03-16  7:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160316074050.GS13692@x1 \
    --to=lee.jones@linaro.org \
    --cc=broonie@kernel.org \
    --cc=ldewangan@nvidia.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox