@@ -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 )
@@ -326,7 +320,7 @@ static void event_property_update(struct work_struct *work)
326
320
continue ;
327
321
328
322
drm_modeset_lock (& dev -> mode_config .connection_mutex , NULL );
329
- mutex_lock (& hdcp_work -> mutex );
323
+ guard ( mutex ) (& hdcp_work -> mutex );
330
324
331
325
if (conn_state -> commit ) {
332
326
ret = wait_for_completion_interruptible_timeout (& conn_state -> commit -> hw_done ,
@@ -358,7 +352,6 @@ static void event_property_update(struct work_struct *work)
358
352
drm_hdcp_update_content_protection (connector ,
359
353
DRM_MODE_CONTENT_PROTECTION_DESIRED );
360
354
}
361
- mutex_unlock (& hdcp_work -> mutex );
362
355
drm_modeset_unlock (& dev -> mode_config .connection_mutex );
363
356
}
364
357
}
@@ -371,7 +364,7 @@ static void event_property_validate(struct work_struct *work)
371
364
struct amdgpu_dm_connector * aconnector ;
372
365
unsigned int conn_index ;
373
366
374
- mutex_lock (& hdcp_work -> mutex );
367
+ guard ( mutex ) (& hdcp_work -> mutex );
375
368
376
369
for (conn_index = 0 ; conn_index < AMDGPU_DM_MAX_DISPLAY_INDEX ;
377
370
conn_index ++ ) {
@@ -415,8 +408,6 @@ static void event_property_validate(struct work_struct *work)
415
408
schedule_work (& hdcp_work -> property_update_work );
416
409
}
417
410
}
418
-
419
- mutex_unlock (& hdcp_work -> mutex );
420
411
}
421
412
422
413
static void event_watchdog_timer (struct work_struct * work )
@@ -427,7 +418,7 @@ static void event_watchdog_timer(struct work_struct *work)
427
418
struct hdcp_workqueue ,
428
419
watchdog_timer_dwork );
429
420
430
- mutex_lock (& hdcp_work -> mutex );
421
+ guard ( mutex ) (& hdcp_work -> mutex );
431
422
432
423
cancel_delayed_work (& hdcp_work -> watchdog_timer_dwork );
433
424
@@ -436,8 +427,6 @@ static void event_watchdog_timer(struct work_struct *work)
436
427
& hdcp_work -> output );
437
428
438
429
process_output (hdcp_work );
439
-
440
- mutex_unlock (& hdcp_work -> mutex );
441
430
}
442
431
443
432
static void event_cpirq (struct work_struct * work )
@@ -446,13 +435,11 @@ static void event_cpirq(struct work_struct *work)
446
435
447
436
hdcp_work = container_of (work , struct hdcp_workqueue , cpirq_work );
448
437
449
- mutex_lock (& hdcp_work -> mutex );
438
+ guard ( mutex ) (& hdcp_work -> mutex );
450
439
451
440
mod_hdcp_process_event (& hdcp_work -> hdcp , MOD_HDCP_EVENT_CPIRQ , & hdcp_work -> output );
452
441
453
442
process_output (hdcp_work );
454
-
455
- mutex_unlock (& hdcp_work -> mutex );
456
443
}
457
444
458
445
void hdcp_destroy (struct kobject * kobj , struct hdcp_workqueue * hdcp_work )
@@ -486,7 +473,7 @@ static bool enable_assr(void *handle, struct dc_link *link)
486
473
487
474
dtm_cmd = (struct ta_dtm_shared_memory * )psp -> dtm_context .context .mem_context .shared_buf ;
488
475
489
- mutex_lock (& psp -> dtm_context .mutex );
476
+ guard ( mutex ) (& psp -> dtm_context .mutex );
490
477
memset (dtm_cmd , 0 , sizeof (struct ta_dtm_shared_memory ));
491
478
492
479
dtm_cmd -> cmd_id = TA_DTM_COMMAND__TOPOLOGY_ASSR_ENABLE ;
@@ -501,8 +488,6 @@ static bool enable_assr(void *handle, struct dc_link *link)
501
488
res = false;
502
489
}
503
490
504
- mutex_unlock (& psp -> dtm_context .mutex );
505
-
506
491
return res ;
507
492
}
508
493
@@ -563,13 +548,11 @@ static void update_config(void *handle, struct cp_psp_stream_config *config)
563
548
(!!aconnector -> base .state ) ?
564
549
aconnector -> base .state -> hdcp_content_type : -1 );
565
550
566
- mutex_lock (& hdcp_w -> mutex );
551
+ guard ( mutex ) (& hdcp_w -> mutex );
567
552
568
553
mod_hdcp_add_display (& hdcp_w -> hdcp , link , display , & hdcp_w -> output );
569
554
570
555
process_output (hdcp_w );
571
- mutex_unlock (& hdcp_w -> mutex );
572
-
573
556
}
574
557
575
558
/**
0 commit comments