]> Pileus Git - ~andy/linux/commitdiff
spi: core: Use list_first_entry_or_null() instead of open-coded
authorAxel Lin <axel.lin@ingics.com>
Thu, 2 Jan 2014 07:16:40 +0000 (15:16 +0800)
committerMark Brown <broonie@linaro.org>
Thu, 2 Jan 2014 11:57:26 +0000 (11:57 +0000)
Use list_first_entry_or_null() to save a few lines.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi.c

index 2cd9fdc9c7f98bc19c62d6ce6f350b3c6210a124..401cd66770f9e756d2f6a0ad2b70583b430a6ec2 100644 (file)
@@ -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;