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>
This commit is contained in:
Laxman Dewangan 2016-03-14 18:20:13 +05:30 committed by Mark Brown
parent f907a0a949
commit 5bf59bd5e9
1 changed files with 12 additions and 11 deletions

View File

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