--- zzzz-none-000/linux-4.1.38/drivers/spi/spi.c 2017-01-18 18:48:06.000000000 +0000 +++ bcm63-7582-715/linux-4.1.38/drivers/spi/spi.c 2020-11-25 10:06:48.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) +{ + 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); /**