From mboxrd@z Thu Jan 1 00:00:00 1970 From: Petr Mladek Subject: [RFC PATCH 06/14] kthread: Add kthread_worker_created() Date: Tue, 28 Jul 2015 16:39:23 +0200 Message-ID: <1438094371-8326-7-git-send-email-pmladek@suse.com> References: <1438094371-8326-1-git-send-email-pmladek@suse.com> Return-path: In-Reply-To: <1438094371-8326-1-git-send-email-pmladek@suse.com> Sender: owner-linux-mm@kvack.org To: Andrew Morton , Oleg Nesterov , Tejun Heo , Ingo Molnar , Peter Zijlstra Cc: Steven Rostedt , "Paul E. McKenney" , Josh Triplett , Thomas Gleixner , Linus Torvalds , Jiri Kosina , Borislav Petkov , Michal Hocko , linux-mm@kvack.org, Vlastimil Babka , live-patching@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Petr Mladek List-Id: linux-api@vger.kernel.org I would like to make cleaner kthread worker API and hide the definition of struct kthread_worker. It will prevent any custom hacks and make the API more secure. This patch provides an API to check if the worker has been created and hides the implementation details. Signed-off-by: Petr Mladek --- include/linux/kthread.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 24d72bac27db..02d3cc9ad923 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h @@ -122,6 +122,11 @@ extern void __init_kthread_worker(struct kthread_worker *worker, (work)->func = (fn); \ } while (0) +static inline bool kthread_worker_created(struct kthread_worker *worker) +{ + return (worker && worker->task); +} + int kthread_worker_fn(void *worker_ptr); __printf(3, 4) -- 1.8.5.6 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org