@@ -265,19 +265,19 @@ dpusm_provider_register(dpusm_t *dpusm, struct module *module, const dpusm_pf_t
265
265
return - EINVAL ;
266
266
}
267
267
268
- dpusm_provider_write_lock ( dpusm ) ;
268
+ mutex_lock ( & dpusm -> lock ); ;
269
269
270
270
dpusm_ph_t * * found = find_provider (dpusm , module_name (module ));
271
271
if (found ) {
272
272
printk ("%s: DPUSM Provider with the name \"%s\" (%p) already exists. %zu providers registered.\n" ,
273
273
__func__ , module_name (module ), * found , dpusm -> count );
274
- dpusm_provider_write_unlock ( dpusm ) ;
274
+ mutex_unlock ( & dpusm -> lock ); ;
275
275
return - EEXIST ;
276
276
}
277
277
278
278
dpusm_ph_t * provider = dpusmph_init (module , funcs );
279
279
if (!provider ) {
280
- dpusm_provider_write_unlock ( dpusm ) ;
280
+ mutex_unlock ( & dpusm -> lock ); ;
281
281
return - ECANCELED ;
282
282
}
283
283
@@ -286,7 +286,7 @@ dpusm_provider_register(dpusm_t *dpusm, struct module *module, const dpusm_pf_t
286
286
printk ("%s: DPUSM Provider \"%s\" (%p) added. Now %zu providers registered.\n" ,
287
287
__func__ , module_name (module ), provider , dpusm -> count );
288
288
289
- dpusm_provider_write_unlock ( dpusm ) ;
289
+ mutex_unlock ( & dpusm -> lock ); ;
290
290
291
291
return 0 ;
292
292
}
@@ -320,20 +320,20 @@ dpusm_provider_unregister_handle(dpusm_t *dpusm, dpusm_ph_t **provider) {
320
320
321
321
int
322
322
dpusm_provider_unregister (dpusm_t * dpusm , struct module * module ) {
323
- dpusm_provider_write_lock ( dpusm ) ;
323
+ mutex_lock ( & dpusm -> lock ); ;
324
324
325
325
dpusm_ph_t * * provider = find_provider (dpusm , module_name (module ));
326
326
if (!provider ) {
327
327
printk ("%s: Could not find provider with name \"%s\"\n" , __func__ , module_name (module ));
328
- dpusm_provider_write_unlock ( dpusm ) ;
328
+ mutex_unlock ( & dpusm -> lock ); ;
329
329
return DPUSM_ERROR ;
330
330
}
331
331
332
332
void * addr = * provider ;
333
333
const int rc = dpusm_provider_unregister_handle (dpusm , provider );
334
334
printk ("%s: Unregistered \"%s\" (%p): %d\n" , __func__ , module_name (module ), addr , rc );
335
335
336
- dpusm_provider_write_unlock ( dpusm ) ;
336
+ mutex_unlock ( & dpusm -> lock ); ;
337
337
return rc ;
338
338
}
339
339
@@ -345,7 +345,7 @@ dpusm_provider_unregister(dpusm_t *dpusm, struct module *module) {
345
345
/* get a provider by name */
346
346
dpusm_ph_t * *
347
347
dpusm_provider_get (dpusm_t * dpusm , const char * name ) {
348
- read_lock (& dpusm -> lock );
348
+ mutex_lock (& dpusm -> lock );
349
349
dpusm_ph_t * * provider = find_provider (dpusm , name );
350
350
if (provider ) {
351
351
struct module * module = (* provider )-> module ;
@@ -404,18 +404,8 @@ dpusm_provider_put(dpusm_t *dpusm, void *handle) {
404
404
return DPUSM_OK ;
405
405
}
406
406
407
- void
408
- dpusm_provider_write_lock (dpusm_t * dpusm ) {
409
- write_lock (& dpusm -> lock );
410
- }
411
-
412
- void
413
- dpusm_provider_write_unlock (dpusm_t * dpusm ) {
414
- write_unlock (& dpusm -> lock );
415
- }
416
-
417
407
void dpusm_provider_invalidate (dpusm_t * dpusm , const char * name ) {
418
- dpusm_provider_write_lock ( dpusm ) ;
408
+ mutex_lock ( & dpusm -> lock ); ;
419
409
dpusm_ph_t * * provider = find_provider (dpusm , name );
420
410
if (provider && * provider ) {
421
411
(* provider )-> funcs = NULL ;
@@ -428,5 +418,5 @@ void dpusm_provider_invalidate(dpusm_t *dpusm, const char *name) {
428
418
printk ("%s: Error: Did not find provider \"%s\"\n" ,
429
419
__func__ , name );
430
420
}
431
- dpusm_provider_write_unlock ( dpusm ) ;
421
+ mutex_unlock ( & dpusm -> lock ); ;
432
422
}
0 commit comments