summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Morgan <macromorgan@hotmail.com>2024-10-23 13:47:59 -0500
committerSebastian Reichel <sebastian.reichel@collabora.com>2024-11-11 22:55:49 +0100
commit9fdd97d63fe2be2ab890240cce0a5790e0ef9877 (patch)
treea39966c6c3cf075b7601330cce7f5634c269f5f7
parentc0f3a0124d3f1dfed700d2871f9d37f418999af2 (diff)
power: supply: axp20x_usb_power: Use scaled iio_read_channel
Change iio_read_channel_processed to iio_read_channel_processed_scale where appropriate. Signed-off-by: Chris Morgan <macromorgan@hotmail.com> Link: https://lore.kernel.org/r/20241023184800.109376-2-macroalpha82@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-rw-r--r--drivers/power/supply/axp20x_usb_power.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/power/supply/axp20x_usb_power.c b/drivers/power/supply/axp20x_usb_power.c
index 2766352ab737..9722912268fe 100644
--- a/drivers/power/supply/axp20x_usb_power.c
+++ b/drivers/power/supply/axp20x_usb_power.c
@@ -220,16 +220,15 @@ static int axp20x_usb_power_get_property(struct power_supply *psy,
return 0;
case POWER_SUPPLY_PROP_VOLTAGE_NOW:
if (IS_ENABLED(CONFIG_AXP20X_ADC)) {
- ret = iio_read_channel_processed(power->vbus_v,
- &val->intval);
- if (ret)
- return ret;
-
/*
* IIO framework gives mV but Power Supply framework
* gives uV.
*/
- val->intval *= 1000;
+ ret = iio_read_channel_processed_scale(power->vbus_v,
+ &val->intval, 1000);
+ if (ret)
+ return ret;
+
return 0;
}
@@ -253,16 +252,15 @@ static int axp20x_usb_power_get_property(struct power_supply *psy,
return 0;
case POWER_SUPPLY_PROP_CURRENT_NOW:
if (IS_ENABLED(CONFIG_AXP20X_ADC)) {
- ret = iio_read_channel_processed(power->vbus_i,
- &val->intval);
- if (ret)
- return ret;
-
/*
* IIO framework gives mA but Power Supply framework
* gives uA.
*/
- val->intval *= 1000;
+ ret = iio_read_channel_processed_scale(power->vbus_i,
+ &val->intval, 1000);
+ if (ret)
+ return ret;
+
return 0;
}
@@ -374,16 +372,15 @@ static int axp717_usb_power_get_property(struct power_supply *psy,
break;
case POWER_SUPPLY_PROP_VOLTAGE_NOW:
if (IS_ENABLED(CONFIG_AXP20X_ADC)) {
- ret = iio_read_channel_processed(power->vbus_v,
- &val->intval);
- if (ret)
- return ret;
-
/*
* IIO framework gives mV but Power Supply framework
* gives uV.
*/
- val->intval *= 1000;
+ ret = iio_read_channel_processed_scale(power->vbus_v,
+ &val->intval, 1000);
+ if (ret)
+ return ret;
+
return 0;
}