nrfx_spi and nrfx_spim: Fix SPI assert and busy error
This removes a semaphore unlock in init_spi function which causes risks of competitive access Signed-off-by: Clotilde Sattler <clotilde.sattler@stimio.fr>
This commit is contained in:
parent
237b34ef2d
commit
168f8bec6d
2 changed files with 6 additions and 4 deletions
|
@ -279,7 +279,6 @@ static int init_spi(const struct device *dev)
|
|||
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
||||
dev_data->pm_state = DEVICE_PM_ACTIVE_STATE;
|
||||
#endif
|
||||
spi_context_unlock_unconditionally(&dev_data->ctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -361,7 +360,9 @@ static int spi_nrfx_pm_control(const struct device *dev,
|
|||
{ \
|
||||
IRQ_CONNECT(DT_IRQN(SPI(idx)), DT_IRQ(SPI(idx), priority), \
|
||||
nrfx_isr, nrfx_spi_##idx##_irq_handler, 0); \
|
||||
return init_spi(dev); \
|
||||
int err = init_spi(dev); \
|
||||
spi_context_unlock_unconditionally(&get_dev_data(dev)->ctx); \
|
||||
return err; \
|
||||
} \
|
||||
static struct spi_nrfx_data spi_##idx##_data = { \
|
||||
SPI_CONTEXT_INIT_LOCK(spi_##idx##_data, ctx), \
|
||||
|
|
|
@ -321,7 +321,6 @@ static int init_spim(const struct device *dev)
|
|||
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
||||
data->pm_state = DEVICE_PM_ACTIVE_STATE;
|
||||
#endif
|
||||
spi_context_unlock_unconditionally(&data->ctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -412,7 +411,9 @@ static int spim_nrfx_pm_control(const struct device *dev,
|
|||
IRQ_CONNECT(NRFX_IRQ_NUMBER_GET(NRF_SPIM##idx), \
|
||||
DT_IRQ(SPIM(idx), priority), \
|
||||
nrfx_isr, nrfx_spim_##idx##_irq_handler, 0); \
|
||||
return init_spim(dev); \
|
||||
int err = init_spim(dev); \
|
||||
spi_context_unlock_unconditionally(&get_dev_data(dev)->ctx); \
|
||||
return err; \
|
||||
} \
|
||||
static struct spi_nrfx_data spi_##idx##_data = { \
|
||||
SPI_CONTEXT_INIT_LOCK(spi_##idx##_data, ctx), \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue