aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/spi/spi.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index b81ccdb1bc16..0bc752d17be5 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -891,8 +891,16 @@ static void spi_pump_messages(struct kthread_work *work)
891 bool was_busy = false; 891 bool was_busy = false;
892 int ret; 892 int ret;
893 893
894 /* Lock queue and check for queue work */ 894 /* Lock queue */
895 spin_lock_irqsave(&master->queue_lock, flags); 895 spin_lock_irqsave(&master->queue_lock, flags);
896
897 /* Make sure we are not already running a message */
898 if (master->cur_msg) {
899 spin_unlock_irqrestore(&master->queue_lock, flags);
900 return;
901 }
902
903 /* Check if the queue is idle */
896 if (list_empty(&master->queue) || !master->running) { 904 if (list_empty(&master->queue) || !master->running) {
897 if (!master->busy) { 905 if (!master->busy) {
898 spin_unlock_irqrestore(&master->queue_lock, flags); 906 spin_unlock_irqrestore(&master->queue_lock, flags);
@@ -916,11 +924,6 @@ static void spi_pump_messages(struct kthread_work *work)
916 return; 924 return;
917 } 925 }
918 926
919 /* Make sure we are not already running a message */
920 if (master->cur_msg) {
921 spin_unlock_irqrestore(&master->queue_lock, flags);
922 return;
923 }
924 /* Extract head of queue */ 927 /* Extract head of queue */
925 master->cur_msg = 928 master->cur_msg =
926 list_first_entry(&master->queue, struct spi_message, queue); 929 list_first_entry(&master->queue, struct spi_message, queue);