]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/staging/android/sync_debug.h
Merge branch 'for-4.8/core' of git://git.kernel.dk/linux-block
[karo-tx-linux.git] / drivers / staging / android / sync_debug.h
1 /*
2  * include/linux/sync.h
3  *
4  * Copyright (C) 2012 Google, Inc.
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9  * GNU General Public License for more details.
10  *
11  */
12
13 #ifndef _LINUX_SYNC_H
14 #define _LINUX_SYNC_H
15
16 #include <linux/list.h>
17 #include <linux/spinlock.h>
18 #include <linux/fence.h>
19
20 #include <linux/sync_file.h>
21 #include <uapi/linux/sync_file.h>
22
23 /**
24  * struct sync_timeline - sync object
25  * @kref:               reference count on fence.
26  * @name:               name of the sync_timeline. Useful for debugging
27  * @child_list_head:    list of children sync_pts for this sync_timeline
28  * @child_list_lock:    lock protecting @child_list_head and fence.status
29  * @active_list_head:   list of active (unsignaled/errored) sync_pts
30  * @sync_timeline_list: membership in global sync_timeline_list
31  */
32 struct sync_timeline {
33         struct kref             kref;
34         char                    name[32];
35
36         /* protected by child_list_lock */
37         int                     context, value;
38
39         struct list_head        child_list_head;
40         spinlock_t              child_list_lock;
41
42         struct list_head        active_list_head;
43
44         struct list_head        sync_timeline_list;
45 };
46
47 static inline struct sync_timeline *fence_parent(struct fence *fence)
48 {
49         return container_of(fence->lock, struct sync_timeline,
50                             child_list_lock);
51 }
52
53 /**
54  * struct sync_pt - sync_pt object
55  * @base: base fence object
56  * @child_list: sync timeline child's list
57  * @active_list: sync timeline active child's list
58  */
59 struct sync_pt {
60         struct fence base;
61         struct list_head child_list;
62         struct list_head active_list;
63 };
64
65 #ifdef CONFIG_SW_SYNC
66
67 extern const struct file_operations sw_sync_debugfs_fops;
68
69 void sync_timeline_debug_add(struct sync_timeline *obj);
70 void sync_timeline_debug_remove(struct sync_timeline *obj);
71 void sync_file_debug_add(struct sync_file *fence);
72 void sync_file_debug_remove(struct sync_file *fence);
73 void sync_dump(void);
74
75 #else
76 # define sync_timeline_debug_add(obj)
77 # define sync_timeline_debug_remove(obj)
78 # define sync_file_debug_add(fence)
79 # define sync_file_debug_remove(fence)
80 # define sync_dump()
81 #endif
82
83 #endif /* _LINUX_SYNC_H */