Re: [PATCH 2/2] drm: zynqmp_dp: Use scope-based mutex helpers

2025-02-06 Thread Bart Van Assche
On 2/6/25 11:41 AM, Sean Anderson wrote: static int zynqmp_dp_enhanced_set(void *data, u64 val) { struct zynqmp_dp *dp = data; - int ret = 0; - mutex_lock(&dp->lock); + guard(mutex)(&dp->lock); dp->test.enhanced = val; if (dp->test.active) -

Re: [PATCH 2/2] drm: zynqmp_dp: Use scope-based mutex helpers

2025-02-06 Thread Sean Anderson
On 2/6/25 15:31, Bart Van Assche wrote: > On 2/6/25 11:41 AM, Sean Anderson wrote: >> static int zynqmp_dp_enhanced_set(void *data, u64 val) >> { >> struct zynqmp_dp *dp = data; >> -int ret = 0; >> -mutex_lock(&dp->lock); >> +guard(mutex)(&dp->lock); >> dp->test.enhanc

[PATCH 2/2] drm: zynqmp_dp: Use scope-based mutex helpers

2025-02-06 Thread Sean Anderson
Convert most mutex_(un)lock calls to use (scoped_)guard instead. This generally reduces line count and prevents bugs like forgetting to unlock the mutex. I've left traditional calls in a few places where scoped helpers would be more verbose. This mostly happens where debugfs_file_put needs to be ca