diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2012-05-21 07:25:17 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2012-11-14 10:38:15 -0500 |
commit | edba9bf99dfb20d316abd164d9027479010dbf9d (patch) | |
tree | 1107893971e521bc96dc4fd92bf0e3e5789be7d5 /drivers/spi/spi-bitbang.c | |
parent | b82b576bc7ffb9785ad3248825ab20496b018e0c (diff) |
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.c | 8 |
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) | |||
260 | struct spi_bitbang *bitbang = | 260 | struct spi_bitbang *bitbang = |
261 | container_of(work, struct spi_bitbang, work); | 261 | container_of(work, struct spi_bitbang, work); |
262 | unsigned long flags; | 262 | unsigned long flags; |
263 | struct spi_message *m, *_m; | ||
263 | 264 | ||
264 | spin_lock_irqsave(&bitbang->lock, flags); | 265 | spin_lock_irqsave(&bitbang->lock, flags); |
265 | bitbang->busy = 1; | 266 | bitbang->busy = 1; |
266 | while (!list_empty(&bitbang->queue)) { | 267 | list_for_each_entry_safe(m, _m, &bitbang->queue, queue) { |
267 | struct spi_message *m; | ||
268 | struct spi_device *spi; | 268 | struct spi_device *spi; |
269 | unsigned nsecs; | 269 | unsigned nsecs; |
270 | struct spi_transfer *t = NULL; | 270 | struct spi_transfer *t = NULL; |
@@ -273,9 +273,7 @@ static void bitbang_work(struct work_struct *work) | |||
273 | int status; | 273 | int status; |
274 | int do_setup = -1; | 274 | int do_setup = -1; |
275 | 275 | ||
276 | m = container_of(bitbang->queue.next, struct spi_message, | 276 | list_del(&m->queue); |
277 | queue); | ||
278 | list_del_init(&m->queue); | ||
279 | spin_unlock_irqrestore(&bitbang->lock, flags); | 277 | spin_unlock_irqrestore(&bitbang->lock, flags); |
280 | 278 | ||
281 | /* FIXME this is made-up ... the correct value is known to | 279 | /* FIXME this is made-up ... the correct value is known to |