lkml.org 
[lkml]   [2020]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/5] ALSA: hda/ca0132 - Add 8051 exram helper functions.
On Tue, 08 Dec 2020 22:25:43 +0100,
Connor McAdams wrote:
>
> +static void chipio_8051_write_exram(struct hda_codec *codec,
> + unsigned int addr, unsigned int data, bool use_mutex)
> +{
> + struct ca0132_spec *spec = codec->spec;
> + unsigned int tmp;
> +
> + if (use_mutex)
> + mutex_lock(&spec->chipio_mutex);

This can be better to split to two functions: a core helper function
without mutex and a helper function to take the mutex lock and call
the former function. Applying the lock conditionally is often
error-prone.


thanks,

Takashi

\
 
 \ /
  Last update: 2020-12-09 09:36    [W:0.072 / U:30.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site