xref: /dflybsd-src/sys/dev/drm/include/linux/async.h (revision 39cfddd200eb8d85143e41642616278b0d1e29f0)
1796e1f6bSFrançois Tigeot /*
2*39cfddd2SFrançois Tigeot  * Copyright (c) 2015-2017 François Tigeot <ftigeot@wolfpond.org>
3796e1f6bSFrançois Tigeot  * All rights reserved.
4796e1f6bSFrançois Tigeot  *
5796e1f6bSFrançois Tigeot  * Redistribution and use in source and binary forms, with or without
6796e1f6bSFrançois Tigeot  * modification, are permitted provided that the following conditions
7796e1f6bSFrançois Tigeot  * are met:
8796e1f6bSFrançois Tigeot  * 1. Redistributions of source code must retain the above copyright
9796e1f6bSFrançois Tigeot  *    notice unmodified, this list of conditions, and the following
10796e1f6bSFrançois Tigeot  *    disclaimer.
11796e1f6bSFrançois Tigeot  * 2. Redistributions in binary form must reproduce the above copyright
12796e1f6bSFrançois Tigeot  *    notice, this list of conditions and the following disclaimer in the
13796e1f6bSFrançois Tigeot  *    documentation and/or other materials provided with the distribution.
14796e1f6bSFrançois Tigeot  *
15796e1f6bSFrançois Tigeot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16796e1f6bSFrançois Tigeot  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17796e1f6bSFrançois Tigeot  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18796e1f6bSFrançois Tigeot  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19796e1f6bSFrançois Tigeot  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20796e1f6bSFrançois Tigeot  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21796e1f6bSFrançois Tigeot  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22796e1f6bSFrançois Tigeot  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23796e1f6bSFrançois Tigeot  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24796e1f6bSFrançois Tigeot  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25796e1f6bSFrançois Tigeot  */
26796e1f6bSFrançois Tigeot 
27796e1f6bSFrançois Tigeot #ifndef _LINUX_ASYNC_H_
28796e1f6bSFrançois Tigeot #define _LINUX_ASYNC_H_
29796e1f6bSFrançois Tigeot 
30796e1f6bSFrançois Tigeot #include <linux/types.h>
31796e1f6bSFrançois Tigeot #include <linux/list.h>
32796e1f6bSFrançois Tigeot 
33796e1f6bSFrançois Tigeot typedef u64 async_cookie_t;
34796e1f6bSFrançois Tigeot typedef void (*async_func_t) (void *data, async_cookie_t cookie);
35796e1f6bSFrançois Tigeot 
36796e1f6bSFrançois Tigeot extern async_cookie_t async_schedule(async_func_t func, void *data);
37796e1f6bSFrançois Tigeot 
38796e1f6bSFrançois Tigeot static inline void async_synchronize_full(void) {
39796e1f6bSFrançois Tigeot 	/*
40796e1f6bSFrançois Tigeot 	 * XXX: This function is supposed to wait until all asynchronous
41796e1f6bSFrançois Tigeot 	 * function calls have been done
42796e1f6bSFrançois Tigeot 	 */
43796e1f6bSFrançois Tigeot }
44796e1f6bSFrançois Tigeot 
45*39cfddd2SFrançois Tigeot /*
46*39cfddd2SFrançois Tigeot  * This function is supposed to wait until all asynchronous function calls
47*39cfddd2SFrançois Tigeot  * prior to cookie have finished
48*39cfddd2SFrançois Tigeot  *
49*39cfddd2SFrançois Tigeot  */
50*39cfddd2SFrançois Tigeot static inline void
51*39cfddd2SFrançois Tigeot async_synchronize_cookie(async_cookie_t cookie)
52*39cfddd2SFrançois Tigeot {
53*39cfddd2SFrançois Tigeot }
54*39cfddd2SFrançois Tigeot 
55796e1f6bSFrançois Tigeot #endif	/* _LINUX_ASYNC_H_ */
56