Re: [PATCH 5/8] spi: stm32: defer probe for reset

2021-02-05 Thread Mark Brown
On Fri, Feb 05, 2021 at 12:08:59PM +0100, Alain Volmat wrote:
> Defer the probe operation when a reset controller device is expected
> but have not yet been probed.
> 
> This change replaces use of devm_reset_control_get_exclusive() with
> devm_reset_control_get_optional_exclusive() as reset controller is
> optional which is now explicitly stated.

This has trouble building an x86 allmodconfig build:

/mnt/kernel/drivers/spi/spi-stm32.c: In function 'stm32_spi_prepare_msg':
/mnt/kernel/drivers/spi/spi-stm32.c:1022:9: error: 'STM32H7_SPI_TSIZE_MAX' 
undeclared (first use in this function); did you mean 'STM32H7_SPI_CR1_MASRX'?
 STM32H7_SPI_TSIZE_MAX,
 ^
 STM32H7_SPI_CR1_MASRX
/mnt/kernel/drivers/spi/spi-stm32.c:1022:9: note: each undeclared identifier is 
reported only once for each function it appears in

This may be due to an earlier patch in the series, my script is working
back through the patch series.


signature.asc
Description: PGP signature


Re: [PATCH 5/8] spi: stm32: defer probe for reset

2021-02-05 Thread Alain Volmat
Hi Mark,

sorry about that, I've just noticed the issue. This is probably due to
modification of patches ordering I did. STM32H7_SPI_TSIZE_MAX is introduced
in the PATCH 6/8 and this is the reason why PATCH 5/8 doesn't build properly.
I'll rework that to ensure that all patches compile properly.

Sorry again,
Alain

On Fri, Feb 05, 2021 at 04:41:54PM +, Mark Brown wrote:
> On Fri, Feb 05, 2021 at 12:08:59PM +0100, Alain Volmat wrote:
> > Defer the probe operation when a reset controller device is expected
> > but have not yet been probed.
> > 
> > This change replaces use of devm_reset_control_get_exclusive() with
> > devm_reset_control_get_optional_exclusive() as reset controller is
> > optional which is now explicitly stated.
> 
> This has trouble building an x86 allmodconfig build:
> 
> /mnt/kernel/drivers/spi/spi-stm32.c: In function 'stm32_spi_prepare_msg':
> /mnt/kernel/drivers/spi/spi-stm32.c:1022:9: error: 'STM32H7_SPI_TSIZE_MAX' 
> undeclared (first use in this function); did you mean 'STM32H7_SPI_CR1_MASRX'?
>  STM32H7_SPI_TSIZE_MAX,
>  ^
>  STM32H7_SPI_CR1_MASRX
> /mnt/kernel/drivers/spi/spi-stm32.c:1022:9: note: each undeclared identifier 
> is reported only once for each function it appears in
> 
> This may be due to an earlier patch in the series, my script is working
> back through the patch series.




[PATCH 5/8] spi: stm32: defer probe for reset

2021-02-05 Thread Alain Volmat
Defer the probe operation when a reset controller device is expected
but have not yet been probed.

This change replaces use of devm_reset_control_get_exclusive() with
devm_reset_control_get_optional_exclusive() as reset controller is
optional which is now explicitly stated.

Signed-off-by: Alain Volmat 
---
 drivers/spi/spi-stm32.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 22bd3d1c8d69..c40cea0640e6 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -1891,8 +1891,14 @@ static int stm32_spi_probe(struct platform_device *pdev)
goto err_clk_disable;
}
 
-   rst = devm_reset_control_get_exclusive(>dev, NULL);
-   if (!IS_ERR(rst)) {
+   rst = devm_reset_control_get_optional_exclusive(>dev, NULL);
+   if (rst) {
+   if (IS_ERR(rst)) {
+   ret = dev_err_probe(>dev, PTR_ERR(rst),
+   "failed to get reset\n");
+   goto err_clk_disable;
+   }
+
reset_control_assert(rst);
udelay(2);
reset_control_deassert(rst);
-- 
2.17.1