aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-01-02 02:16:40 -0500
committerMark Brown <broonie@linaro.org>2014-01-02 06:57:26 -0500
commit1cfd97f93e36b3f8b5d2a26147aaccae0c847a9c (patch)
tree4b05b4acdd1ab493a55eba62a1e87d68ea7f112e /drivers/spi/spi.c
parent368ca4e0c75612c0a4d6bbcef7efb944604340c2 (diff)
spi: core: Use list_first_entry_or_null() instead of open-coded
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>
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 2cd9fdc9c7f9..401cd66770f9 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -791,11 +791,8 @@ struct spi_message *spi_get_next_queued_message(struct spi_master *master)
791 791
792 /* get a pointer to the next message, if any */ 792 /* get a pointer to the next message, if any */
793 spin_lock_irqsave(&master->queue_lock, flags); 793 spin_lock_irqsave(&master->queue_lock, flags);
794 if (list_empty(&master->queue)) 794 next = list_first_entry_or_null(&master->queue, struct spi_message,
795 next = NULL; 795 queue);
796 else
797 next = list_entry(master->queue.next,
798 struct spi_message, queue);
799 spin_unlock_irqrestore(&master->queue_lock, flags); 796 spin_unlock_irqrestore(&master->queue_lock, flags);
800 797
801 return next; 798 return next;