aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/dmatest.txt12
-rw-r--r--drivers/dma/dmatest.c23
2 files changed, 33 insertions, 2 deletions
diff --git a/Documentation/dmatest.txt b/Documentation/dmatest.txt
index 9a90729bdee6..3e17b55a8ba3 100644
--- a/Documentation/dmatest.txt
+++ b/Documentation/dmatest.txt
@@ -36,6 +36,18 @@ in the original code.
36 36
37Note that running a new test will stop any in progress test. 37Note that running a new test will stop any in progress test.
38 38
39The following command should return actual state of the test.
40 % cat /sys/kernel/debug/dmatest/run
41
42To wait for test done the user may perform a busy loop that checks the state.
43
44 % while [ $(cat /sys/kernel/debug/dmatest/run) = "Y" ]
45 > do
46 > echo -n "."
47 > sleep 1
48 > done
49 > echo
50
39 Part 3 - When built-in in the kernel... 51 Part 3 - When built-in in the kernel...
40 52
41The module parameters that is supplied to the kernel command line will be used 53The module parameters that is supplied to the kernel command line will be used
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
98struct dmatest_chan { 99struct 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;