drivers: regulator: improve regulator_count_voltages specs

- Interface guarantees that voltage indices start from zero to
  regulator_count_voltages()
- Function always return an unsigned number. If the device doesn't
  implement the API returned value is zero, as expected.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-12-01 11:14:21 +01:00 committed by Carles Cufí
commit 9a73be82c4
2 changed files with 8 additions and 14 deletions

View file

@ -263,12 +263,7 @@ static int regulator_set_voltage_mode(const struct device *dev,
config->desc->vsel_mask, (uint8_t)idx);
}
/**
* Part of the extended regulator consumer API
* Returns the number of supported voltages
*/
static int regulator_pca9420_count_voltages(const struct device *dev)
static unsigned int regulator_pca9420_count_voltages(const struct device *dev)
{
const struct regulator_pca9420_config *config = dev->config;