From e09c594711d2d7c961f6dca7143884b6044403a5 Mon Sep 17 00:00:00 2001 From: Guillaume Gautier Date: Thu, 7 Sep 2023 16:37:13 +0200 Subject: [PATCH] drivers: adc: stm32: remove channel count limit Remove CHANNEL_COUNT limit used to check the channel bitmask. This value was not applicable on STM32L1 where channel can go up to 31. Signed-off-by: Guillaume Gautier --- drivers/adc/adc_stm32.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/adc/adc_stm32.c b/drivers/adc/adc_stm32.c index e254a7fb572..ec73d80e239 100644 --- a/drivers/adc/adc_stm32.c +++ b/drivers/adc/adc_stm32.c @@ -154,9 +154,6 @@ static const uint32_t table_seq_len[] = { }; #endif /* ANY_ADC_SEQUENCER_TYPE_IS(FULLY_CONFIGURABLE) */ -/* External channels (maximum). */ -#define STM32_CHANNEL_COUNT 20 - /* Number of different sampling time values */ #define STM32_NB_SAMPLING_TIME 8 @@ -839,11 +836,6 @@ static int start_read(const struct device *dev, return -EINVAL; } - if (data->channels > BIT(STM32_CHANNEL_COUNT) - 1) { - LOG_ERR("Channels bitmask uses out of range channel"); - return -EINVAL; - } - #if ANY_ADC_SEQUENCER_TYPE_IS(FULLY_CONFIGURABLE) if (data->channel_count > ARRAY_SIZE(table_seq_len)) { LOG_ERR("Too many channels for sequencer. Max: %d", ARRAY_SIZE(table_seq_len)); @@ -1113,11 +1105,6 @@ static int adc_stm32_channel_setup(const struct device *dev, struct adc_stm32_data *data = dev->data; int acq_time_index; - if (channel_cfg->channel_id >= STM32_CHANNEL_COUNT) { - LOG_ERR("Channel %d is not valid", channel_cfg->channel_id); - return -EINVAL; - } - acq_time_index = adc_stm32_check_acq_time(dev, channel_cfg->acquisition_time); if (acq_time_index < 0) {