mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 02:39:48 +00:00
power: supply: ab8500: Use dev_err_probe() for IIO channels
The code obtaining the ADC channels is outdated: it is trying to work around the IIO subsystem not returning the right -EPROBE_DEFER error code. Fix this up by using the dev_err_probe() helper so we defer silently where appropriate and not bail out if the IIO core returns -EPROBE_DEFER as happens now. Cc: Marcus Cooper <codekipper@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
parent
807042539d
commit
36f1de0d5c
3 changed files with 24 additions and 34 deletions
|
@ -1023,17 +1023,15 @@ static int ab8500_btemp_probe(struct platform_device *pdev)
|
||||||
/* Get ADC channels */
|
/* Get ADC channels */
|
||||||
di->btemp_ball = devm_iio_channel_get(dev, "btemp_ball");
|
di->btemp_ball = devm_iio_channel_get(dev, "btemp_ball");
|
||||||
if (IS_ERR(di->btemp_ball)) {
|
if (IS_ERR(di->btemp_ball)) {
|
||||||
if (PTR_ERR(di->btemp_ball) == -ENODEV)
|
ret = dev_err_probe(dev, PTR_ERR(di->btemp_ball),
|
||||||
return -EPROBE_DEFER;
|
"failed to get BTEMP BALL ADC channel\n");
|
||||||
dev_err(dev, "failed to get BTEMP BALL ADC channel\n");
|
return ret;
|
||||||
return PTR_ERR(di->btemp_ball);
|
|
||||||
}
|
}
|
||||||
di->bat_ctrl = devm_iio_channel_get(dev, "bat_ctrl");
|
di->bat_ctrl = devm_iio_channel_get(dev, "bat_ctrl");
|
||||||
if (IS_ERR(di->bat_ctrl)) {
|
if (IS_ERR(di->bat_ctrl)) {
|
||||||
if (PTR_ERR(di->bat_ctrl) == -ENODEV)
|
ret = dev_err_probe(dev, PTR_ERR(di->bat_ctrl),
|
||||||
return -EPROBE_DEFER;
|
"failed to get BAT CTRL ADC channel\n");
|
||||||
dev_err(dev, "failed to get BAT CTRL ADC channel\n");
|
return ret;
|
||||||
return PTR_ERR(di->bat_ctrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
di->initialized = false;
|
di->initialized = false;
|
||||||
|
|
|
@ -3375,36 +3375,29 @@ static int ab8500_charger_probe(struct platform_device *pdev)
|
||||||
di->parent = dev_get_drvdata(pdev->dev.parent);
|
di->parent = dev_get_drvdata(pdev->dev.parent);
|
||||||
|
|
||||||
/* Get ADC channels */
|
/* Get ADC channels */
|
||||||
di->adc_main_charger_v = devm_iio_channel_get(dev,
|
di->adc_main_charger_v = devm_iio_channel_get(dev, "main_charger_v");
|
||||||
"main_charger_v");
|
|
||||||
if (IS_ERR(di->adc_main_charger_v)) {
|
if (IS_ERR(di->adc_main_charger_v)) {
|
||||||
if (PTR_ERR(di->adc_main_charger_v) == -ENODEV)
|
ret = dev_err_probe(dev, PTR_ERR(di->adc_main_charger_v),
|
||||||
return -EPROBE_DEFER;
|
"failed to get ADC main charger voltage\n");
|
||||||
dev_err(dev, "failed to get ADC main charger voltage\n");
|
return ret;
|
||||||
return PTR_ERR(di->adc_main_charger_v);
|
|
||||||
}
|
}
|
||||||
di->adc_main_charger_c = devm_iio_channel_get(dev,
|
di->adc_main_charger_c = devm_iio_channel_get(dev, "main_charger_c");
|
||||||
"main_charger_c");
|
|
||||||
if (IS_ERR(di->adc_main_charger_c)) {
|
if (IS_ERR(di->adc_main_charger_c)) {
|
||||||
if (PTR_ERR(di->adc_main_charger_c) == -ENODEV)
|
ret = dev_err_probe(dev, PTR_ERR(di->adc_main_charger_c),
|
||||||
return -EPROBE_DEFER;
|
"failed to get ADC main charger current\n");
|
||||||
dev_err(dev, "failed to get ADC main charger current\n");
|
return ret;
|
||||||
return PTR_ERR(di->adc_main_charger_c);
|
|
||||||
}
|
}
|
||||||
di->adc_vbus_v = devm_iio_channel_get(dev, "vbus_v");
|
di->adc_vbus_v = devm_iio_channel_get(dev, "vbus_v");
|
||||||
if (IS_ERR(di->adc_vbus_v)) {
|
if (IS_ERR(di->adc_vbus_v)) {
|
||||||
if (PTR_ERR(di->adc_vbus_v) == -ENODEV)
|
ret = dev_err_probe(dev, PTR_ERR(di->adc_vbus_v),
|
||||||
return -EPROBE_DEFER;
|
"failed to get ADC USB charger voltage\n");
|
||||||
dev_err(dev, "failed to get ADC USB charger voltage\n");
|
return ret;
|
||||||
return PTR_ERR(di->adc_vbus_v);
|
|
||||||
}
|
}
|
||||||
di->adc_usb_charger_c = devm_iio_channel_get(dev,
|
di->adc_usb_charger_c = devm_iio_channel_get(dev, "usb_charger_c");
|
||||||
"usb_charger_c");
|
|
||||||
if (IS_ERR(di->adc_usb_charger_c)) {
|
if (IS_ERR(di->adc_usb_charger_c)) {
|
||||||
if (PTR_ERR(di->adc_usb_charger_c) == -ENODEV)
|
ret = dev_err_probe(dev, PTR_ERR(di->adc_usb_charger_c),
|
||||||
return -EPROBE_DEFER;
|
"failed to get ADC USB charger current\n");
|
||||||
dev_err(dev, "failed to get ADC USB charger current\n");
|
return ret;
|
||||||
return PTR_ERR(di->adc_usb_charger_c);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize lock */
|
/* initialize lock */
|
||||||
|
|
|
@ -3059,10 +3059,9 @@ static int ab8500_fg_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
di->main_bat_v = devm_iio_channel_get(dev, "main_bat_v");
|
di->main_bat_v = devm_iio_channel_get(dev, "main_bat_v");
|
||||||
if (IS_ERR(di->main_bat_v)) {
|
if (IS_ERR(di->main_bat_v)) {
|
||||||
if (PTR_ERR(di->main_bat_v) == -ENODEV)
|
ret = dev_err_probe(dev, PTR_ERR(di->main_bat_v),
|
||||||
return -EPROBE_DEFER;
|
"failed to get main battery ADC channel\n");
|
||||||
dev_err(dev, "failed to get main battery ADC channel\n");
|
return ret;
|
||||||
return PTR_ERR(di->main_bat_v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
psy_cfg.supplied_to = supply_interface;
|
psy_cfg.supplied_to = supply_interface;
|
||||||
|
|
Loading…
Reference in a new issue