Thread (26 messages) 26 messages, 4 authors, 8d ago

Re: [PATCH v2 05/14] iio: adc: stm32-adc: rework internal channels data

flat view

From: sashiko-bot@kernel.org
Date: 2026-09-23 15:51:18

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] iio: adc: unintended functional change in stm32 internal channel delays
--

commit 1797bf77d1751b7e9502bd851d9e50359e42d644
Author: Fabrice Gasnier [off-list ref]

iio: adc: stm32-adc: rework internal channels data

This commit reworks the internal channel data structures for STM32 ADCs by
using designated initializers mapped to explicit channel enumerations. This
removes zeroed data entries and the need for static assertions.
quoted hunk ↗ jump to hunk
diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index ddf74c674da6f..ac60c31de7a5b 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -2737,8 +2730,11 @@ static const struct stm32_adc_cfg stm32h7_adc_cfg = {
 	.vref_charac_mv = 3300,
 };
 
-static const unsigned int stm32_adc_min_ts_mp1[] = { 100, 100, 100, 4300, 9800 };
-static_assert(ARRAY_SIZE(stm32_adc_min_ts_mp1) == STM32_ADC_INT_CH_NB);
+static const unsigned int stm32_adc_min_ts_mp1[STM32_ADC_INT_CH_NB] = {
+	[STM32_ADC_INT_CH_VDDCORE] = 100,
+	[STM32_ADC_INT_CH_VREFINT] = 4300,
+	[STM32_ADC_INT_CH_VBAT] = 9800
+};
[Severity: Medium]
Does this unintentionally alter the minimum sampling times for the VDDCPU and
VDDQ_DDR channels? The commit message states "No functional change intended",
but the previous array initialized these values to 100, whereas omitting
them from the designated initializer will now implicitly set them to 0.
 
 static const struct stm32_adc_cfg stm32mp1_adc_cfg = {
 	.regs = &stm32mp1_adc_regspec,
[ ... ]
quoted hunk ↗ jump to hunk
@@ -2760,8 +2756,13 @@ static const struct stm32_adc_cfg stm32mp1_adc_cfg = {
 	.vref_charac_mv = 3300,
 };
 
-static const unsigned int stm32_adc_min_ts_mp13[] = { 100, 0, 0, 4300, 9800 };
-static_assert(ARRAY_SIZE(stm32_adc_min_ts_mp13) == STM32_ADC_INT_CH_NB);
+static const unsigned int stm32_adc_min_ts_mp13[STM32_ADC_INT_CH_NB] = {
+	[STM32_ADC_INT_CH_VDDCORE] = 1000,
+	[STM32_ADC_INT_CH_VDDCPU] = 1000,
+	[STM32_ADC_INT_CH_VDDQ_DDR] = 1000,
+	[STM32_ADC_INT_CH_VREFINT] = 4300,
+	[STM32_ADC_INT_CH_VBAT] = 9800
+};
[Severity: Medium]
Is the minimum sampling time increase for the VDD channels intended? The
previous array initialized VDDCORE to 100, and VDDCPU and VDDQ_DDR to 0.
The new designated initializer explicitly sets all three to 1000. This
seems to conflict with the note in the commit message that no functional
change is intended.
 
 static const struct stm32_adc_cfg stm32mp13_adc_cfg = {
 	.regs = &stm32mp13_adc_regspec,
-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260923-adc-stm32mp25-v1-v2-0-46bc019537c6@foss.st.com?part=5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help