File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 8
8
#include <linux/wait.h>
9
9
#include <linux/rcu_sync.h>
10
10
#include <linux/lockdep.h>
11
+ #include <linux/cleanup.h>
11
12
12
13
struct percpu_rw_semaphore {
13
14
struct rcu_sync rss ;
@@ -125,6 +126,13 @@ extern bool percpu_is_read_locked(struct percpu_rw_semaphore *);
125
126
extern void percpu_down_write (struct percpu_rw_semaphore * );
126
127
extern void percpu_up_write (struct percpu_rw_semaphore * );
127
128
129
+ DEFINE_GUARD (percpu_read , struct percpu_rw_semaphore * ,
130
+ percpu_down_read (_T ), percpu_up_read (_T ))
131
+ DEFINE_GUARD_COND (percpu_read , _try , percpu_down_read_trylock (_T ))
132
+
133
+ DEFINE_GUARD (percpu_write , struct percpu_rw_semaphore * ,
134
+ percpu_down_write (_T ), percpu_up_write (_T ))
135
+
128
136
static inline bool percpu_is_write_locked (struct percpu_rw_semaphore * sem )
129
137
{
130
138
return atomic_read (& sem -> block );
You can’t perform that action at this time.
0 commit comments