drivers: adc: lmp90xxx: prevent SPI transactions from ISR context
Add checks to prevent SPI transactions from being run in ISR context. This affects both the LMP90xxx ADC and GPIO drivers. Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
parent
ee97ab2bd8
commit
3de3ad0ffc
1 changed files with 10 additions and 0 deletions
|
@ -193,6 +193,11 @@ static int lmp90xxx_read_reg(struct device *dev, u8_t addr, u8_t *dptr,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (k_is_in_isr()) {
|
||||||
|
/* Prevent SPI transactions from an ISR */
|
||||||
|
return -EWOULDBLOCK;
|
||||||
|
}
|
||||||
|
|
||||||
k_mutex_lock(&data->ura_lock, K_FOREVER);
|
k_mutex_lock(&data->ura_lock, K_FOREVER);
|
||||||
|
|
||||||
if (ura != data->ura) {
|
if (ura != data->ura) {
|
||||||
|
@ -259,6 +264,11 @@ static int lmp90xxx_write_reg(struct device *dev, u8_t addr, u8_t *dptr,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (k_is_in_isr()) {
|
||||||
|
/* Prevent SPI transactions from an ISR */
|
||||||
|
return -EWOULDBLOCK;
|
||||||
|
}
|
||||||
|
|
||||||
k_mutex_lock(&data->ura_lock, K_FOREVER);
|
k_mutex_lock(&data->ura_lock, K_FOREVER);
|
||||||
|
|
||||||
if (ura != data->ura) {
|
if (ura != data->ura) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue