@@ -172,7 +172,7 @@ void hdcp_update_display(struct hdcp_workqueue *hdcp_work,
172
172
struct mod_hdcp_display_adjustment display_adjust ;
173
173
unsigned int conn_index = aconnector -> base .index ;
174
174
175
- mutex_lock (& hdcp_w -> mutex );
175
+ guard ( mutex ) (& hdcp_w -> mutex );
176
176
hdcp_w -> aconnector [conn_index ] = aconnector ;
177
177
178
178
memset (& link_adjust , 0 , sizeof (link_adjust ));
@@ -209,7 +209,6 @@ void hdcp_update_display(struct hdcp_workqueue *hdcp_work,
209
209
mod_hdcp_update_display (& hdcp_w -> hdcp , conn_index , & link_adjust , & display_adjust , & hdcp_w -> output );
210
210
211
211
process_output (hdcp_w );
212
- mutex_unlock (& hdcp_w -> mutex );
213
212
}
214
213
215
214
static void hdcp_remove_display (struct hdcp_workqueue * hdcp_work ,
@@ -220,7 +219,7 @@ static void hdcp_remove_display(struct hdcp_workqueue *hdcp_work,
220
219
struct drm_connector_state * conn_state = aconnector -> base .state ;
221
220
unsigned int conn_index = aconnector -> base .index ;
222
221
223
- mutex_lock (& hdcp_w -> mutex );
222
+ guard ( mutex ) (& hdcp_w -> mutex );
224
223
hdcp_w -> aconnector [conn_index ] = aconnector ;
225
224
226
225
/* the removal of display will invoke auth reset -> hdcp destroy and
@@ -239,15 +238,14 @@ static void hdcp_remove_display(struct hdcp_workqueue *hdcp_work,
239
238
mod_hdcp_remove_display (& hdcp_w -> hdcp , aconnector -> base .index , & hdcp_w -> output );
240
239
241
240
process_output (hdcp_w );
242
- mutex_unlock (& hdcp_w -> mutex );
243
241
}
244
242
245
243
void hdcp_reset_display (struct hdcp_workqueue * hdcp_work , unsigned int link_index )
246
244
{
247
245
struct hdcp_workqueue * hdcp_w = & hdcp_work [link_index ];
248
246
unsigned int conn_index ;
249
247
250
- mutex_lock (& hdcp_w -> mutex );
248
+ guard ( mutex ) (& hdcp_w -> mutex );
251
249
252
250
mod_hdcp_reset_connection (& hdcp_w -> hdcp , & hdcp_w -> output );
253
251
@@ -259,8 +257,6 @@ void hdcp_reset_display(struct hdcp_workqueue *hdcp_work, unsigned int link_inde
259
257
}
260
258
261
259
process_output (hdcp_w );
262
-
263
- mutex_unlock (& hdcp_w -> mutex );
264
260
}
265
261
266
262
void hdcp_handle_cpirq (struct hdcp_workqueue * hdcp_work , unsigned int link_index )
@@ -277,16 +273,14 @@ static void event_callback(struct work_struct *work)
277
273
hdcp_work = container_of (to_delayed_work (work ), struct hdcp_workqueue ,
278
274
callback_dwork );
279
275
280
- mutex_lock (& hdcp_work -> mutex );
276
+ guard ( mutex ) (& hdcp_work -> mutex );
281
277
282
278
cancel_delayed_work (& hdcp_work -> callback_dwork );
283
279
284
280
mod_hdcp_process_event (& hdcp_work -> hdcp , MOD_HDCP_EVENT_CALLBACK ,
285
281
& hdcp_work -> output );
286
282
287
283
process_output (hdcp_work );
288
-
289
- mutex_unlock (& hdcp_work -> mutex );
290
284
}
291
285
292
286
static void event_property_update (struct work_struct * work )
@@ -323,7 +317,7 @@ static void event_property_update(struct work_struct *work)
323
317
continue ;
324
318
325
319
drm_modeset_lock (& dev -> mode_config .connection_mutex , NULL );
326
- mutex_lock (& hdcp_work -> mutex );
320
+ guard ( mutex ) (& hdcp_work -> mutex );
327
321
328
322
if (conn_state -> commit ) {
329
323
ret = wait_for_completion_interruptible_timeout (& conn_state -> commit -> hw_done ,
@@ -355,7 +349,6 @@ static void event_property_update(struct work_struct *work)
355
349
drm_hdcp_update_content_protection (connector ,
356
350
DRM_MODE_CONTENT_PROTECTION_DESIRED );
357
351
}
358
- mutex_unlock (& hdcp_work -> mutex );
359
352
drm_modeset_unlock (& dev -> mode_config .connection_mutex );
360
353
}
361
354
}
@@ -368,7 +361,7 @@ static void event_property_validate(struct work_struct *work)
368
361
struct amdgpu_dm_connector * aconnector ;
369
362
unsigned int conn_index ;
370
363
371
- mutex_lock (& hdcp_work -> mutex );
364
+ guard ( mutex ) (& hdcp_work -> mutex );
372
365
373
366
for (conn_index = 0 ; conn_index < AMDGPU_DM_MAX_DISPLAY_INDEX ;
374
367
conn_index ++ ) {
@@ -408,8 +401,6 @@ static void event_property_validate(struct work_struct *work)
408
401
schedule_work (& hdcp_work -> property_update_work );
409
402
}
410
403
}
411
-
412
- mutex_unlock (& hdcp_work -> mutex );
413
404
}
414
405
415
406
static void event_watchdog_timer (struct work_struct * work )
@@ -420,7 +411,7 @@ static void event_watchdog_timer(struct work_struct *work)
420
411
struct hdcp_workqueue ,
421
412
watchdog_timer_dwork );
422
413
423
- mutex_lock (& hdcp_work -> mutex );
414
+ guard ( mutex ) (& hdcp_work -> mutex );
424
415
425
416
cancel_delayed_work (& hdcp_work -> watchdog_timer_dwork );
426
417
@@ -429,8 +420,6 @@ static void event_watchdog_timer(struct work_struct *work)
429
420
& hdcp_work -> output );
430
421
431
422
process_output (hdcp_work );
432
-
433
- mutex_unlock (& hdcp_work -> mutex );
434
423
}
435
424
436
425
static void event_cpirq (struct work_struct * work )
@@ -439,13 +428,11 @@ static void event_cpirq(struct work_struct *work)
439
428
440
429
hdcp_work = container_of (work , struct hdcp_workqueue , cpirq_work );
441
430
442
- mutex_lock (& hdcp_work -> mutex );
431
+ guard ( mutex ) (& hdcp_work -> mutex );
443
432
444
433
mod_hdcp_process_event (& hdcp_work -> hdcp , MOD_HDCP_EVENT_CPIRQ , & hdcp_work -> output );
445
434
446
435
process_output (hdcp_work );
447
-
448
- mutex_unlock (& hdcp_work -> mutex );
449
436
}
450
437
451
438
void hdcp_destroy (struct kobject * kobj , struct hdcp_workqueue * hdcp_work )
@@ -479,7 +466,7 @@ static bool enable_assr(void *handle, struct dc_link *link)
479
466
480
467
dtm_cmd = (struct ta_dtm_shared_memory * )psp -> dtm_context .context .mem_context .shared_buf ;
481
468
482
- mutex_lock (& psp -> dtm_context .mutex );
469
+ guard ( mutex ) (& psp -> dtm_context .mutex );
483
470
memset (dtm_cmd , 0 , sizeof (struct ta_dtm_shared_memory ));
484
471
485
472
dtm_cmd -> cmd_id = TA_DTM_COMMAND__TOPOLOGY_ASSR_ENABLE ;
@@ -494,8 +481,6 @@ static bool enable_assr(void *handle, struct dc_link *link)
494
481
res = false;
495
482
}
496
483
497
- mutex_unlock (& psp -> dtm_context .mutex );
498
-
499
484
return res ;
500
485
}
501
486
@@ -557,13 +542,11 @@ static void update_config(void *handle, struct cp_psp_stream_config *config)
557
542
(!!aconnector -> base .state ) ?
558
543
aconnector -> base .state -> hdcp_content_type : -1 );
559
544
560
- mutex_lock (& hdcp_w -> mutex );
545
+ guard ( mutex ) (& hdcp_w -> mutex );
561
546
562
547
mod_hdcp_add_display (& hdcp_w -> hdcp , link , display , & hdcp_w -> output );
563
548
564
549
process_output (hdcp_w );
565
- mutex_unlock (& hdcp_w -> mutex );
566
-
567
550
}
568
551
569
552
/**
0 commit comments