--- zzzz-none-000/linux-4.1.52/drivers/spi/spi.c 2018-05-28 02:26:45.000000000 +0000 +++ bcm63-7530ax-731/linux-4.1.52/drivers/spi/spi.c 2022-03-02 11:37:13.000000000 +0000 @@ -1963,6 +1963,24 @@ * which are wrappers around this core asynchronous primitive.) */ int spi_async(struct spi_device *spi, struct spi_message *message) +#if defined(CONFIG_BCM_KF_SPI) && !defined(CONFIG_SPI_BCM63XX_HSSPI) +{ + struct spi_master *master = spi->master; + unsigned long flags; + + /* 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(&master->bus_lock_spinlock, flags); + if (master->bus_lock_flag){ + spin_unlock_irqrestore(&master->bus_lock_spinlock, flags); + return -EBUSY; + } + spin_unlock_irqrestore(&master->bus_lock_spinlock, flags); + + return __spi_async(spi, message); +} +#else { struct spi_master *master = spi->master; int ret; @@ -1983,6 +2001,7 @@ return ret; } +#endif EXPORT_SYMBOL_GPL(spi_async); /**