diff options
author | Bryan O'Donoghue <pure.logic@nexus-software.ie> | 2016-12-22 00:37:28 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-03 16:45:01 +0100 |
commit | a072a72da96f8fedda3312686456c18c34ca179a (patch) | |
tree | 67340f7d94d4814d46d4823756dba17d54cade99 /drivers/staging/greybus | |
parent | af1550cce0b55a9c6fa37a84301bd893bdf6997e (diff) |
staging: greybus: loopback: use gb_loopback_async_wait_all don't spin
Currently the greybus-loopback thread logic spins around waiting for
send_count == iteration_max which on real hardware doesn't make a
difference to us but in simulation is excruciatingly slow, anti-social and
bad manners. Use the existing gb_loopback_async_wait_all() function to gate
continuing when the send_count == iteration_max and go to sleep until
there's something worthwhile to-do.
Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/greybus')
-rw-r--r-- | drivers/staging/greybus/loopback.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 7882306adeca..3184dd3999b5 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -1008,11 +1008,22 @@ static int gb_loopback_fn(void *data) /* Optionally terminate */ if (gb->send_count == gb->iteration_max) { + mutex_unlock(&gb->mutex); + + /* Wait for synchronous and asynchronus completion */ + gb_loopback_async_wait_all(gb); + + /* Mark complete unless user-space has poked us */ + mutex_lock(&gb->mutex); if (gb->iteration_count == gb->iteration_max) { gb->type = 0; gb->send_count = 0; sysfs_notify(&gb->dev->kobj, NULL, "iteration_count"); + dev_dbg(&bundle->dev, "load test complete\n"); + } else { + dev_dbg(&bundle->dev, + "continuing on with new test set\n"); } mutex_unlock(&gb->mutex); continue; |