diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2013-03-04 11:09:31 +0200 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2013-04-15 09:51:17 +0530 |
commit | 3e5ccd866fdf3a1e1d4d2c08c81f861ad6798d32 (patch) | |
tree | 7ef2a3270021ef71912e1970683ec429f93d38b7 /drivers/dma/dmatest.c | |
parent | 851b7e16a07dfda6178d4e35fea9a9e3eb8954ae (diff) |
dmatest: return actual state in 'run' file
The following command should return actual state of the test.
% cat /sys/kernel/debug/dmatest/run
To wait for test done the user may perform a busy loop that checks the state.
% while [ $(cat /sys/kernel/debug/dmatest/run) = "Y" ]
> do
> echo -n "."
> sleep 1
> done
> echo
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/dmatest.c')
-rw-r--r-- | drivers/dma/dmatest.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index fc31542e720..d19234b0834 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -93,6 +93,7 @@ struct dmatest_thread { u8 **srcs; u8 **dsts; enum dma_transaction_type type; + bool done; }; struct dmatest_chan { @@ -603,6 +604,8 @@ err_thread_type: if (ret) dmaengine_terminate_all(chan); + thread->done = true; + if (params->iterations > 0) while (!kthread_should_stop()) { DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wait_dmatest_exit); @@ -884,12 +887,28 @@ static ssize_t dtf_read_run(struct file *file, char __user *user_buf, { struct dmatest_info *info = file->private_data; char buf[3]; + struct dmatest_chan *dtc; + bool alive = false; mutex_lock(&info->lock); - if (info->nr_channels) + list_for_each_entry(dtc, &info->channels, node) { + struct dmatest_thread *thread; + + list_for_each_entry(thread, &dtc->threads, node) { + if (!thread->done) { + alive = true; + break; + } + } + } + + if (alive) { buf[0] = 'Y'; - else + } else { + __stop_threaded_test(info); buf[0] = 'N'; + } + mutex_unlock(&info->lock); buf[1] = '\n'; buf[2] = 0x00; |