summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-bitbang.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2012-05-21 15:25:17 +0400
committerGrant Likely <grant.likely@secretlab.ca>2012-11-14 19:38:15 +0400
commitedba9bf99dfb20d316abd164d9027479010dbf9d (patch)
tree1107893971e521bc96dc4fd92bf0e3e5789be7d5 /drivers/spi/spi-bitbang.c
parentb82b576bc7ffb9785ad3248825ab20496b018e0c (diff)
downloadlinux-edba9bf99dfb20d316abd164d9027479010dbf9d.tar.xz
spi/bitbang: (cosmetic) simplify list manipulation
Use a proper list iterator instead of an open-coded loop and remove a superfluous list head initialisation. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi/spi-bitbang.c')
-rw-r--r--drivers/spi/spi-bitbang.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c
index f5ae6e960c7e..8b3d8efafd3c 100644
--- a/drivers/spi/spi-bitbang.c
+++ b/drivers/spi/spi-bitbang.c
@@ -260,11 +260,11 @@ static void bitbang_work(struct work_struct *work)
struct spi_bitbang *bitbang =
container_of(work, struct spi_bitbang, work);
unsigned long flags;
+ struct spi_message *m, *_m;
spin_lock_irqsave(&bitbang->lock, flags);
bitbang->busy = 1;
- while (!list_empty(&bitbang->queue)) {
- struct spi_message *m;
+ list_for_each_entry_safe(m, _m, &bitbang->queue, queue) {
struct spi_device *spi;
unsigned nsecs;
struct spi_transfer *t = NULL;
@@ -273,9 +273,7 @@ static void bitbang_work(struct work_struct *work)
int status;
int do_setup = -1;
- m = container_of(bitbang->queue.next, struct spi_message,
- queue);
- list_del_init(&m->queue);
+ list_del(&m->queue);
spin_unlock_irqrestore(&bitbang->lock, flags);
/* FIXME this is made-up ... the correct value is known to