File tree Expand file tree Collapse file tree 1 file changed +15
-18
lines changed Expand file tree Collapse file tree 1 file changed +15
-18
lines changed Original file line number Diff line number Diff line change @@ -220,16 +220,15 @@ static int axp20x_usb_power_get_property(struct power_supply *psy,
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
@@ -253,16 +252,15 @@ static int axp20x_usb_power_get_property(struct power_supply *psy,
253
252
return 0 ;
254
253
case POWER_SUPPLY_PROP_CURRENT_NOW :
255
254
if (IS_ENABLED (CONFIG_AXP20X_ADC )) {
256
- ret = iio_read_channel_processed (power -> vbus_i ,
257
- & val -> intval );
258
- if (ret )
259
- return ret ;
260
-
261
255
/*
262
256
* IIO framework gives mA but Power Supply framework
263
257
* gives uA.
264
258
*/
265
- val -> intval *= 1000 ;
259
+ ret = iio_read_channel_processed_scale (power -> vbus_i ,
260
+ & val -> intval , 1000 );
261
+ if (ret )
262
+ return ret ;
263
+
266
264
return 0 ;
267
265
}
268
266
@@ -374,16 +372,15 @@ static int axp717_usb_power_get_property(struct power_supply *psy,
374
372
break ;
375
373
case POWER_SUPPLY_PROP_VOLTAGE_NOW :
376
374
if (IS_ENABLED (CONFIG_AXP20X_ADC )) {
377
- ret = iio_read_channel_processed (power -> vbus_v ,
378
- & val -> intval );
379
- if (ret )
380
- return ret ;
381
-
382
375
/*
383
376
* IIO framework gives mV but Power Supply framework
384
377
* gives uV.
385
378
*/
386
- val -> intval *= 1000 ;
379
+ ret = iio_read_channel_processed_scale (power -> vbus_v ,
380
+ & val -> intval , 1000 );
381
+ if (ret )
382
+ return ret ;
383
+
387
384
return 0 ;
388
385
}
389
386
You can’t perform that action at this time.
0 commit comments