dmatest: make dmatest threads freezable
Making dmatest threads freezable allows its use for system PM testing. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
This commit is contained in:
parent
57001a606f
commit
981ed70d8e
@ -10,6 +10,7 @@
|
|||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
#include <linux/dmaengine.h>
|
#include <linux/dmaengine.h>
|
||||||
|
#include <linux/freezer.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/kthread.h>
|
#include <linux/kthread.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
@ -251,6 +252,7 @@ static int dmatest_func(void *data)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
thread_name = current->comm;
|
thread_name = current->comm;
|
||||||
|
set_freezable_with_signal();
|
||||||
|
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
|
||||||
@ -305,7 +307,8 @@ static int dmatest_func(void *data)
|
|||||||
dma_addr_t dma_srcs[src_cnt];
|
dma_addr_t dma_srcs[src_cnt];
|
||||||
dma_addr_t dma_dsts[dst_cnt];
|
dma_addr_t dma_dsts[dst_cnt];
|
||||||
struct completion cmp;
|
struct completion cmp;
|
||||||
unsigned long tmo = msecs_to_jiffies(timeout);
|
unsigned long start, tmo, end = 0 /* compiler... */;
|
||||||
|
bool reload = true;
|
||||||
u8 align = 0;
|
u8 align = 0;
|
||||||
|
|
||||||
total_tests++;
|
total_tests++;
|
||||||
@ -404,7 +407,17 @@ static int dmatest_func(void *data)
|
|||||||
}
|
}
|
||||||
dma_async_issue_pending(chan);
|
dma_async_issue_pending(chan);
|
||||||
|
|
||||||
tmo = wait_for_completion_timeout(&cmp, tmo);
|
do {
|
||||||
|
start = jiffies;
|
||||||
|
if (reload)
|
||||||
|
end = start + msecs_to_jiffies(timeout);
|
||||||
|
else if (end <= start)
|
||||||
|
end = start + 1;
|
||||||
|
tmo = wait_for_completion_interruptible_timeout(&cmp,
|
||||||
|
end - start);
|
||||||
|
reload = try_to_freeze();
|
||||||
|
} while (tmo == -ERESTARTSYS);
|
||||||
|
|
||||||
status = dma_async_is_tx_complete(chan, cookie, NULL, NULL);
|
status = dma_async_is_tx_complete(chan, cookie, NULL, NULL);
|
||||||
|
|
||||||
if (tmo == 0) {
|
if (tmo == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user