Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Chris Morgan and committed by
Sebastian Reichel
9fdd97d6 c0f3a012

+15 -18
+15 -18
drivers/power/supply/axp20x_usb_power.c
··· 220 220 return 0; 221 221 case POWER_SUPPLY_PROP_VOLTAGE_NOW: 222 222 if (IS_ENABLED(CONFIG_AXP20X_ADC)) { 223 - ret = iio_read_channel_processed(power->vbus_v, 224 - &val->intval); 225 - if (ret) 226 - return ret; 227 - 228 223 /* 229 224 * IIO framework gives mV but Power Supply framework 230 225 * gives uV. 231 226 */ 232 - val->intval *= 1000; 227 + ret = iio_read_channel_processed_scale(power->vbus_v, 228 + &val->intval, 1000); 229 + if (ret) 230 + return ret; 231 + 233 232 return 0; 234 233 } 235 234 ··· 252 253 return 0; 253 254 case POWER_SUPPLY_PROP_CURRENT_NOW: 254 255 if (IS_ENABLED(CONFIG_AXP20X_ADC)) { 255 - ret = iio_read_channel_processed(power->vbus_i, 256 - &val->intval); 257 - if (ret) 258 - return ret; 259 - 260 256 /* 261 257 * IIO framework gives mA but Power Supply framework 262 258 * gives uA. 263 259 */ 264 - val->intval *= 1000; 260 + ret = iio_read_channel_processed_scale(power->vbus_i, 261 + &val->intval, 1000); 262 + if (ret) 263 + return ret; 264 + 265 265 return 0; 266 266 } 267 267 ··· 372 374 break; 373 375 case POWER_SUPPLY_PROP_VOLTAGE_NOW: 374 376 if (IS_ENABLED(CONFIG_AXP20X_ADC)) { 375 - ret = iio_read_channel_processed(power->vbus_v, 376 - &val->intval); 377 - if (ret) 378 - return ret; 379 - 380 377 /* 381 378 * IIO framework gives mV but Power Supply framework 382 379 * gives uV. 383 380 */ 384 - val->intval *= 1000; 381 + ret = iio_read_channel_processed_scale(power->vbus_v, 382 + &val->intval, 1000); 383 + if (ret) 384 + return ret; 385 + 385 386 return 0; 386 387 } 387 388