Message ID | 1388647000.28565.1.camel@phoenix (mailing list archive) |
---|---|
State | Accepted |
Commit | 1cfd97f93e36b3f8b5d2a26147aaccae0c847a9c |
Headers | show |
On Thu, Jan 02, 2014 at 03:16:40PM +0800, Axel Lin wrote:
> Use list_first_entry_or_null() to save a few lines.
Applied, thanks.
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 98f4b77..a1a7f78 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) /* 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;
Use list_first_entry_or_null() to save a few lines. Signed-off-by: Axel Lin <axel.lin@ingics.com> --- drivers/spi/spi.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)