diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2013-03-04 04:09:31 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2013-04-15 00:21:17 -0400 |
commit | 3e5ccd866fdf3a1e1d4d2c08c81f861ad6798d32 (patch) | |
tree | 7ef2a3270021ef71912e1970683ec429f93d38b7 /drivers/dma | |
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')
-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 fc31542e7200..d19234b08342 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c | |||
@@ -93,6 +93,7 @@ struct dmatest_thread { | |||
93 | u8 **srcs; | 93 | u8 **srcs; |
94 | u8 **dsts; | 94 | u8 **dsts; |
95 | enum dma_transaction_type type; | 95 | enum dma_transaction_type type; |
96 | bool done; | ||
96 | }; | 97 | }; |
97 | 98 | ||
98 | struct dmatest_chan { | 99 | struct dmatest_chan { |
@@ -603,6 +604,8 @@ err_thread_type: | |||
603 | if (ret) | 604 | if (ret) |
604 | dmaengine_terminate_all(chan); | 605 | dmaengine_terminate_all(chan); |
605 | 606 | ||
607 | thread->done = true; | ||
608 | |||
606 | if (params->iterations > 0) | 609 | if (params->iterations > 0) |
607 | while (!kthread_should_stop()) { | 610 | while (!kthread_should_stop()) { |
608 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wait_dmatest_exit); | 611 | 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, | |||
884 | { | 887 | { |
885 | struct dmatest_info *info = file->private_data; | 888 | struct dmatest_info *info = file->private_data; |
886 | char buf[3]; | 889 | char buf[3]; |
890 | struct dmatest_chan *dtc; | ||
891 | bool alive = false; | ||
887 | 892 | ||
888 | mutex_lock(&info->lock); | 893 | mutex_lock(&info->lock); |
889 | if (info->nr_channels) | 894 | list_for_each_entry(dtc, &info->channels, node) { |
895 | struct dmatest_thread *thread; | ||
896 | |||
897 | list_for_each_entry(thread, &dtc->threads, node) { | ||
898 | if (!thread->done) { | ||
899 | alive = true; | ||
900 | break; | ||
901 | } | ||
902 | } | ||
903 | } | ||
904 | |||
905 | if (alive) { | ||
890 | buf[0] = 'Y'; | 906 | buf[0] = 'Y'; |
891 | else | 907 | } else { |
908 | __stop_threaded_test(info); | ||
892 | buf[0] = 'N'; | 909 | buf[0] = 'N'; |
910 | } | ||
911 | |||
893 | mutex_unlock(&info->lock); | 912 | mutex_unlock(&info->lock); |
894 | buf[1] = '\n'; | 913 | buf[1] = '\n'; |
895 | buf[2] = 0x00; | 914 | buf[2] = 0x00; |