All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Connor McAdams <conmanx360@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] ALSA: hda/ca0132 - Add 8051 exram helper functions.
Date: Wed, 09 Dec 2020 09:33:00 +0100	[thread overview]
Message-ID: <s5hzh2ntm4j.wl-tiwai@suse.de> (raw)
In-Reply-To: <20201208212546.428392-4-conmanx360@gmail.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Takashi Iwai <tiwai@suse.de>
To: Connor McAdams <conmanx360@gmail.com>
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] ALSA: hda/ca0132 - Add 8051 exram helper functions.
Date: Wed, 09 Dec 2020 09:33:00 +0100	[thread overview]
Message-ID: <s5hzh2ntm4j.wl-tiwai@suse.de> (raw)
In-Reply-To: <20201208212546.428392-4-conmanx360@gmail.com>

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

  reply	other threads:[~2020-12-09  8:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08 21:25 [PATCH 0/5] ALSA: hda/ca0132 - Fix no-audio issues and add documentation Connor McAdams
2020-12-08 21:25 ` Connor McAdams
2020-12-08 21:25 ` [PATCH 1/5] ALSA: hda/ca0132 - Reset codec upon initialization Connor McAdams
2020-12-08 21:25   ` Connor McAdams
2020-12-08 21:25 ` [PATCH 2/5] ALSA: hda/ca0132 - Add stream port remapping function Connor McAdams
2020-12-08 21:25   ` Connor McAdams
2020-12-08 21:25 ` [PATCH 3/5] ALSA: hda/ca0132 - Add 8051 exram helper functions Connor McAdams
2020-12-08 21:25   ` Connor McAdams
2020-12-09  8:33   ` Takashi Iwai [this message]
2020-12-09  8:33     ` Takashi Iwai
2020-12-08 21:25 ` [PATCH 4/5] ALSA: hda/ca0132 - Ensure DSP is properly setup post-firmware download Connor McAdams
2020-12-08 21:25   ` Connor McAdams
2020-12-08 21:25 ` [PATCH 5/5] ALSA: hda/ca0132 - Remove now unnecessary DSP setup functions Connor McAdams
2020-12-08 21:25   ` Connor McAdams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hzh2ntm4j.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=conmanx360@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.