--- zzzz-none-000/linux-4.19.183/drivers/spi/spi.c 2021-03-24 10:07:39.000000000 +0000 +++ bcm63-7530ax-756/linux-4.19.183/drivers/spi/spi.c 2023-06-28 08:54:19.000000000 +0000 @@ -3075,6 +3075,28 @@ * Return: zero on success, else a negative error code. */ int spi_async(struct spi_device *spi, struct spi_message *message) +#if defined(CONFIG_BCM_KF_SPI) && !defined(CONFIG_SPI_BCM63XX_HSSPI) +{ + struct spi_controller *ctlr = spi->controller; + int ret; + unsigned long flags; + + ret = __spi_validate(spi, message); + if (ret != 0) + return ret; + + /* holding the spinlock and disabling irqs for the duration of the transfer is problematic + the controller driver manages the locking so call __spi_async without the lock */ + spin_lock_irqsave(&ctlr->bus_lock_spinlock, flags); + if (ctlr->bus_lock_flag){ + spin_unlock_irqrestore(&ctlr->bus_lock_spinlock, flags); + return -EBUSY; + } + spin_unlock_irqrestore(&ctlr->bus_lock_spinlock, flags); + + return __spi_async(spi, message); +} +#else { struct spi_controller *ctlr = spi->controller; int ret; @@ -3095,6 +3117,7 @@ return ret; } +#endif EXPORT_SYMBOL_GPL(spi_async); /**