diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2017-05-11 16:51:10 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-05-24 07:55:36 -0400 |
commit | a7e6a8cf51e567878ef2a78b184892755969223c (patch) | |
tree | 775abf26605f415c3551d4bf05536888474e293c /drivers | |
parent | b03afb6d5c4bbca5a26cc95027491c816e5e1f6d (diff) |
gpu: nvgpu: Add query nvgpu_thread_is_running
Add query nvgpu_thread_is_running(). It returns true if thread has
already been started.
JIRA NVGPU-14
Change-Id: If3bed6f9ffe181703134ae1b92b0b275db364195
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1480257
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/thread.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/thread.h | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/thread.c b/drivers/gpu/nvgpu/common/linux/thread.c index d37b2a10..ef783bbe 100644 --- a/drivers/gpu/nvgpu/common/linux/thread.c +++ b/drivers/gpu/nvgpu/common/linux/thread.c | |||
@@ -34,9 +34,15 @@ int nvgpu_thread_create(struct nvgpu_thread *thread, | |||
34 | void nvgpu_thread_stop(struct nvgpu_thread *thread) | 34 | void nvgpu_thread_stop(struct nvgpu_thread *thread) |
35 | { | 35 | { |
36 | kthread_stop(thread->task); | 36 | kthread_stop(thread->task); |
37 | thread->task = NULL; | ||
37 | }; | 38 | }; |
38 | 39 | ||
39 | bool nvgpu_thread_should_stop(struct nvgpu_thread *thread) | 40 | bool nvgpu_thread_should_stop(struct nvgpu_thread *thread) |
40 | { | 41 | { |
41 | return kthread_should_stop(); | 42 | return kthread_should_stop(); |
42 | }; | 43 | }; |
44 | |||
45 | bool nvgpu_thread_is_running(struct nvgpu_thread *thread) | ||
46 | { | ||
47 | return thread->task != NULL; | ||
48 | }; | ||
diff --git a/drivers/gpu/nvgpu/include/nvgpu/thread.h b/drivers/gpu/nvgpu/include/nvgpu/thread.h index 81dac7ca..1e946119 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/thread.h +++ b/drivers/gpu/nvgpu/include/nvgpu/thread.h | |||
@@ -59,4 +59,13 @@ void nvgpu_thread_stop(struct nvgpu_thread *thread); | |||
59 | */ | 59 | */ |
60 | bool nvgpu_thread_should_stop(struct nvgpu_thread *thread); | 60 | bool nvgpu_thread_should_stop(struct nvgpu_thread *thread); |
61 | 61 | ||
62 | /** | ||
63 | * nvgpu_thread_is_running - Query if thread is running | ||
64 | * | ||
65 | * @thread | ||
66 | * | ||
67 | * Return true if thread is started. | ||
68 | */ | ||
69 | bool nvgpu_thread_is_running(struct nvgpu_thread *thread); | ||
70 | |||
62 | #endif /* __NVGPU_THREAD_H__ */ | 71 | #endif /* __NVGPU_THREAD_H__ */ |