patch "iio: adc: stm32: fix stm32h7_adc_enable error handling" added to staging-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
iio: adc: stm32: fix stm32h7_adc_enable error handling
to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
Quoted 1 line
From
a3b5655ebdb501a98a45c0d3265dca9f2fe0218aMon Sep 17 00:00:00 2001
From: Fabrice Gasnier <[email protected]>
Date: Tue, 23 Jan 2018 17:04:56 +0100
Subject: iio: adc: stm32: fix stm32h7_adc_enable error handling
Error handling in stm32h7_adc_enable routine doesn't unwind enable sequence correctly. ADEN can only be cleared by hardware (e.g. by writing one to ADDIS).
It's also better to clear ADRDY just after it's been set by hardware.
--- drivers/iio/adc/stm32-adc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/iio/adc/stm32-adc.c +4 -3
@@ -722,8 +722,6 @@ static int stm32h7_adc_enable(struct stm32_adc *adc)int ret;u32 val; -/* Clear ADRDY by writing one, then enable ADC */ -stm32_adc_set_bits (adc,STM32H7_ADC_ISR ,STM32H7_ADRDY );stm32_adc_set_bits (adc,STM32H7_ADC_CR ,STM32H7_ADEN );/* Poll for ADRDY to be set (after adc startup time) */
@@ -731,8 +729,11 @@ static int stm32h7_adc_enable(struct stm32_adc *adc) val &STM32H7_ADRDY , 100, STM32_ADC_TIMEOUT_US);if (ret) { -stm32_adc_clr_bits (adc,STM32H7_ADC_CR ,STM32H7_ADEN ); +stm32_adc_set_bits (adc,STM32H7_ADC_CR ,STM32H7_ADDIS );dev_err (&indio_dev->dev,"Failed to enable ADC\n" ); + }else { +/* Clear ADRDY by writing one */ +stm32_adc_set_bits (adc,STM32H7_ADC_ISR ,STM32H7_ADRDY ); }return ret;
Signature · 1 line
2.16.2