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
|
@ -1023,17 +1023,15 @@ static int ab8500_btemp_probe(struct platform_device *pdev)
|
|||
/* Get ADC channels */
|
||||
di->btemp_ball = devm_iio_channel_get(dev, "btemp_ball");
|
||||
if (IS_ERR(di->btemp_ball)) {
|
||||
if (PTR_ERR(di->btemp_ball) == -ENODEV)
|
||||
return -EPROBE_DEFER;
|
||||
dev_err(dev, "failed to get BTEMP BALL ADC channel\n");
|
||||
return PTR_ERR(di->btemp_ball);
|
||||
ret = dev_err_probe(dev, PTR_ERR(di->btemp_ball),
|
||||
"failed to get BTEMP BALL ADC channel\n");
|
||||
return ret;
|
||||
}
|
||||
di->bat_ctrl = devm_iio_channel_get(dev, "bat_ctrl");
|
||||
if (IS_ERR(di->bat_ctrl)) {
|
||||
if (PTR_ERR(di->bat_ctrl) == -ENODEV)
|
||||
return -EPROBE_DEFER;
|
||||
dev_err(dev, "failed to get BAT CTRL ADC channel\n");
|
||||
return PTR_ERR(di->bat_ctrl);
|
||||
ret = dev_err_probe(dev, PTR_ERR(di->bat_ctrl),
|
||||
"failed to get BAT CTRL ADC channel\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
di->initialized = false;
|
||||
|
|
|
@ -3375,36 +3375,29 @@ static int ab8500_charger_probe(struct platform_device *pdev)
|
|||
di->parent = dev_get_drvdata(pdev->dev.parent);
|
||||
|
||||
/* Get ADC channels */
|
||||
di->adc_main_charger_v = devm_iio_channel_get(dev,
|
||||
"main_charger_v");
|
||||
di->adc_main_charger_v = devm_iio_channel_get(dev, "main_charger_v");
|
||||
if (IS_ERR(di->adc_main_charger_v)) {
|
||||
if (PTR_ERR(di->adc_main_charger_v) == -ENODEV)
|
||||
return -EPROBE_DEFER;
|
||||
dev_err(dev, "failed to get ADC main charger voltage\n");
|
||||
return PTR_ERR(di->adc_main_charger_v);
|
||||
ret = dev_err_probe(dev, PTR_ERR(di->adc_main_charger_v),
|
||||
"failed to get ADC main charger voltage\n");
|
||||
return ret;
|
||||
}
|
||||
di->adc_main_charger_c = devm_iio_channel_get(dev,
|
||||
"main_charger_c");
|
||||
di->adc_main_charger_c = devm_iio_channel_get(dev, "main_charger_c");
|
||||
if (IS_ERR(di->adc_main_charger_c)) {
|
||||
if (PTR_ERR(di->adc_main_charger_c) == -ENODEV)
|
||||
return -EPROBE_DEFER;
|
||||
dev_err(dev, "failed to get ADC main charger current\n");
|
||||
return PTR_ERR(di->adc_main_charger_c);
|
||||
ret = dev_err_probe(dev, PTR_ERR(di->adc_main_charger_c),
|
||||
"failed to get ADC main charger current\n");
|
||||
return ret;
|
||||
}
|
||||
di->adc_vbus_v = devm_iio_channel_get(dev, "vbus_v");
|
||||
if (IS_ERR(di->adc_vbus_v)) {
|
||||
if (PTR_ERR(di->adc_vbus_v) == -ENODEV)
|
||||
return -EPROBE_DEFER;
|
||||
dev_err(dev, "failed to get ADC USB charger voltage\n");
|
||||
return PTR_ERR(di->adc_vbus_v);
|
||||
ret = dev_err_probe(dev, PTR_ERR(di->adc_vbus_v),
|
||||
"failed to get ADC USB charger voltage\n");
|
||||
return ret;
|
||||
}
|
||||
di->adc_usb_charger_c = devm_iio_channel_get(dev,
|
||||
"usb_charger_c");
|
||||
di->adc_usb_charger_c = devm_iio_channel_get(dev, "usb_charger_c");
|
||||
if (IS_ERR(di->adc_usb_charger_c)) {
|
||||
if (PTR_ERR(di->adc_usb_charger_c) == -ENODEV)
|
||||
return -EPROBE_DEFER;
|
||||
dev_err(dev, "failed to get ADC USB charger current\n");
|
||||
return PTR_ERR(di->adc_usb_charger_c);
|
||||
ret = dev_err_probe(dev, PTR_ERR(di->adc_usb_charger_c),
|
||||
"failed to get ADC USB charger current\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 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");
|
||||
if (IS_ERR(di->main_bat_v)) {
|
||||
if (PTR_ERR(di->main_bat_v) == -ENODEV)
|
||||
return -EPROBE_DEFER;
|
||||
dev_err(dev, "failed to get main battery ADC channel\n");
|
||||
return PTR_ERR(di->main_bat_v);
|
||||
ret = dev_err_probe(dev, PTR_ERR(di->main_bat_v),
|
||||
"failed to get main battery ADC channel\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
psy_cfg.supplied_to = supply_interface;
|
||||
|
|
Loading…
Reference in New Issue