drivers: regulator: improve regulator_get_current_limit

- Function returns now the value by reference, similar to voltage
  counterparts.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-12-01 13:51:42 +01:00 committed by Carles Cufí
commit 2bd6d50934
3 changed files with 15 additions and 9 deletions

View file

@ -85,6 +85,7 @@ static int cmd_set_vol(const struct shell *sh, size_t argc, char **argv)
static int cmd_set_ilim(const struct shell *sh, size_t argc, char **argv)
{
int lcur, ucur, ret;
int32_t curr_ua;
const struct device *reg_dev;
reg_dev = device_get_binding(argv[1]);
@ -101,12 +102,12 @@ static int cmd_set_ilim(const struct shell *sh, size_t argc, char **argv)
shell_error(sh, "failed to set current, error %d", ret);
return ret;
}
ret = regulator_get_current_limit(reg_dev);
ret = regulator_get_current_limit(reg_dev, &curr_ua);
if (ret < 0) {
shell_error(sh, "failed to read current, error %d", ret);
return ret;
}
shell_print(sh, "set current limit to %d uA", ret);
shell_print(sh, "set current limit to %d uA", curr_ua);
return 0;
}