@@ -143,12 +143,6 @@ static inline void seqcount_lockdep_reader_access(const seqcount_t *s)
143
143
__SEQ_LOCK(.lock = (assoc_lock)) \
144
144
}
145
145
146
- #define seqcount_locktype_init (s , assoc_lock ) \
147
- do { \
148
- seqcount_init(&(s)->seqcount); \
149
- __SEQ_LOCK((s)->lock = (assoc_lock)); \
150
- } while (0)
151
-
152
146
/**
153
147
* SEQCNT_SPINLOCK_ZERO - static initializer for seqcount_spinlock_t
154
148
* @name: Name of the seqcount_spinlock_t instance
@@ -157,14 +151,6 @@ do { \
157
151
#define SEQCNT_SPINLOCK_ZERO (name , lock ) \
158
152
SEQCOUNT_LOCKTYPE_ZERO(name, lock)
159
153
160
- /**
161
- * seqcount_spinlock_init - runtime initializer for seqcount_spinlock_t
162
- * @s: Pointer to the seqcount_spinlock_t instance
163
- * @lock: Pointer to the associated spinlock
164
- */
165
- #define seqcount_spinlock_init (s , lock ) \
166
- seqcount_locktype_init(s, lock)
167
-
168
154
/**
169
155
* SEQCNT_RAW_SPINLOCK_ZERO - static initializer for seqcount_raw_spinlock_t
170
156
* @name: Name of the seqcount_raw_spinlock_t instance
@@ -173,14 +159,6 @@ do { \
173
159
#define SEQCNT_RAW_SPINLOCK_ZERO (name , lock ) \
174
160
SEQCOUNT_LOCKTYPE_ZERO(name, lock)
175
161
176
- /**
177
- * seqcount_raw_spinlock_init - runtime initializer for seqcount_raw_spinlock_t
178
- * @s: Pointer to the seqcount_raw_spinlock_t instance
179
- * @lock: Pointer to the associated raw_spinlock
180
- */
181
- #define seqcount_raw_spinlock_init (s , lock ) \
182
- seqcount_locktype_init(s, lock)
183
-
184
162
/**
185
163
* SEQCNT_RWLOCK_ZERO - static initializer for seqcount_rwlock_t
186
164
* @name: Name of the seqcount_rwlock_t instance
@@ -189,14 +167,6 @@ do { \
189
167
#define SEQCNT_RWLOCK_ZERO (name , lock ) \
190
168
SEQCOUNT_LOCKTYPE_ZERO(name, lock)
191
169
192
- /**
193
- * seqcount_rwlock_init - runtime initializer for seqcount_rwlock_t
194
- * @s: Pointer to the seqcount_rwlock_t instance
195
- * @lock: Pointer to the associated rwlock
196
- */
197
- #define seqcount_rwlock_init (s , lock ) \
198
- seqcount_locktype_init(s, lock)
199
-
200
170
/**
201
171
* SEQCNT_MUTEX_ZERO - static initializer for seqcount_mutex_t
202
172
* @name: Name of the seqcount_mutex_t instance
@@ -205,14 +175,6 @@ do { \
205
175
#define SEQCNT_MUTEX_ZERO (name , lock ) \
206
176
SEQCOUNT_LOCKTYPE_ZERO(name, lock)
207
177
208
- /**
209
- * seqcount_mutex_init - runtime initializer for seqcount_mutex_t
210
- * @s: Pointer to the seqcount_mutex_t instance
211
- * @lock: Pointer to the associated mutex
212
- */
213
- #define seqcount_mutex_init (s , lock ) \
214
- seqcount_locktype_init(s, lock)
215
-
216
178
/**
217
179
* SEQCNT_WW_MUTEX_ZERO - static initializer for seqcount_ww_mutex_t
218
180
* @name: Name of the seqcount_ww_mutex_t instance
@@ -222,15 +184,7 @@ do { \
222
184
SEQCOUNT_LOCKTYPE_ZERO(name, lock)
223
185
224
186
/**
225
- * seqcount_ww_mutex_init - runtime initializer for seqcount_ww_mutex_t
226
- * @s: Pointer to the seqcount_ww_mutex_t instance
227
- * @lock: Pointer to the associated ww_mutex
228
- */
229
- #define seqcount_ww_mutex_init (s , lock ) \
230
- seqcount_locktype_init(s, lock)
231
-
232
- /**
233
- * typedef seqcount_LOCKNAME_t - sequence counter with spinlock associated
187
+ * typedef seqcount_LOCKNAME_t - sequence counter with LOCKTYPR associated
234
188
* @seqcount: The real sequence counter
235
189
* @lock: Pointer to the associated spinlock
236
190
*
@@ -240,6 +194,12 @@ do { \
240
194
* that the write side critical section is properly serialized.
241
195
*/
242
196
197
+ /**
198
+ * seqcount_LOCKNAME_init() - runtime initializer for seqcount_LOCKNAME_t
199
+ * @s: Pointer to the seqcount_LOCKNAME_t instance
200
+ * @lock: Pointer to the associated LOCKTYPE
201
+ */
202
+
243
203
/*
244
204
* SEQCOUNT_LOCKTYPE() - Instantiate seqcount_LOCKNAME_t and helpers
245
205
* @locktype: actual typename
@@ -253,6 +213,13 @@ typedef struct seqcount_##lockname { \
253
213
__SEQ_LOCK(locktype *lock); \
254
214
} seqcount_##lockname##_t; \
255
215
\
216
+ static __always_inline void \
217
+ seqcount_##lockname##_init(seqcount_##lockname##_t *s, locktype *lock) \
218
+ { \
219
+ seqcount_init(&s->seqcount); \
220
+ __SEQ_LOCK(s->lock = lock); \
221
+ } \
222
+ \
256
223
static __always_inline seqcount_t * \
257
224
__seqcount_##lockname##_ptr(seqcount_##lockname##_t *s) \
258
225
{ \
0 commit comments