* properly format/comment all patches * merge debloat patches * merge Kconfig patches * merge swconfig patches * merge hotplug patches * drop 200-fix_localversion.patch - upstream * drop 222-arm_zimage_none.patch - unused * drop 252-mv_cesa_depends.patch - no longer required * drop 410-mtd-move-forward-declaration-of-struct-mtd_info.patch - unused * drop 661-fq_codel_keep_dropped_stats.patch - outdated * drop 702-phy_add_aneg_done_function.patch - upstream * drop 840-rtc7301.patch - unused * drop 841-rtc_pt7c4338.patch - upstream * drop 921-use_preinit_as_init.patch - unused * drop spio-gpio-old and gpio-mmc - unused Signed-off-by: John Crispin <john@phrozen.org>
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
From: Mark Brown <broonie@kernel.org>
 | 
						|
Date: Tue, 9 Dec 2014 19:46:56 +0000
 | 
						|
Subject: [PATCH] spi: Check to see if the device is processing a message
 | 
						|
 before we idle
 | 
						|
 | 
						|
cur_msg is updated under the queue lock and holds the message we are
 | 
						|
currently processing. Since currently we only ever do removals in the
 | 
						|
pump kthread it doesn't matter in what order we do things but we want
 | 
						|
to be able to push things out from the submitting thread so pull the
 | 
						|
check to see if we're currently handling a message before we check to
 | 
						|
see if the queue is idle.
 | 
						|
 | 
						|
Signed-off-by: Mark Brown <broonie@kernel.org>
 | 
						|
---
 | 
						|
 | 
						|
--- a/drivers/spi/spi.c
 | 
						|
+++ b/drivers/spi/spi.c
 | 
						|
@@ -891,8 +891,16 @@ static void spi_pump_messages(struct kth
 | 
						|
 	bool was_busy = false;
 | 
						|
 	int ret;
 | 
						|
 
 | 
						|
-	/* Lock queue and check for queue work */
 | 
						|
+	/* Lock queue */
 | 
						|
 	spin_lock_irqsave(&master->queue_lock, flags);
 | 
						|
+
 | 
						|
+	/* Make sure we are not already running a message */
 | 
						|
+	if (master->cur_msg) {
 | 
						|
+		spin_unlock_irqrestore(&master->queue_lock, flags);
 | 
						|
+		return;
 | 
						|
+	}
 | 
						|
+
 | 
						|
+	/* Check if the queue is idle */
 | 
						|
 	if (list_empty(&master->queue) || !master->running) {
 | 
						|
 		if (!master->busy) {
 | 
						|
 			spin_unlock_irqrestore(&master->queue_lock, flags);
 | 
						|
@@ -916,11 +924,6 @@ static void spi_pump_messages(struct kth
 | 
						|
 		return;
 | 
						|
 	}
 | 
						|
 
 | 
						|
-	/* Make sure we are not already running a message */
 | 
						|
-	if (master->cur_msg) {
 | 
						|
-		spin_unlock_irqrestore(&master->queue_lock, flags);
 | 
						|
-		return;
 | 
						|
-	}
 | 
						|
 	/* Extract head of queue */
 | 
						|
 	master->cur_msg =
 | 
						|
 		list_first_entry(&master->queue, struct spi_message, queue);
 |