Skip to contentSkip to conversation

spi: core: Use list_first_entry_or_null() instead of open-coded

PATCH Applied Axel Lin 2 participants 2 messages Jan 2, 2014 SPI

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 spi: core: Use list_first_entry_or_null() instead of open-coded

Use list_first_entry_or_null() to save a few lines.

---
 drivers/spi/spi.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/spi/spi.c +2 -5
index 98f4b77..a1a7f78 100644
@@ -791,11 +791,8 @@ struct spi_message *spi_get_next_queued_message(struct spi_master *master)
 
 	/* get a pointer to the next message, if any */
 	spin_lock_irqsave(&master->queue_lock, flags);
-	if (list_empty(&master->queue))
-		next = NULL;
-	else
-		next = list_entry(master->queue.next,
-				  struct spi_message, queue);
+	next = list_first_entry_or_null(&master->queue, struct spi_message,
+					queue);
 	spin_unlock_irqrestore(&master->queue_lock, flags);
 
 	return next;
Signature · 8 lines
1.8.1.2



--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Applied
#1 lore raw
Quoted 1 line · Axel Lin

Use list_first_entry_or_null() to save a few lines.

Applied, thanks.