From: Takashi Iwai <tiwai@suse.de>
To: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Cc: alsa-devel@alsa-project.org, Jaroslav Kysela <perex@perex.cz>
Subject: Re: [PATCH 2/2] ALSA: emu10k1: track loss of external clock on E-MU cards
Date: Mon, 10 Jul 2023 17:05:06 +0200 [thread overview]
Message-ID: <87ttubyfh9.wl-tiwai@suse.de> (raw)
In-Reply-To: <20230710065956.1246364-2-oswald.buddenhagen@gmx.de>
On Mon, 10 Jul 2023 08:59:56 +0200,
Oswald Buddenhagen wrote:
>
> +static void emu1010_clock_work(struct work_struct *work)
> +{
> + struct snd_emu10k1 *emu;
> + struct snd_ctl_elem_id id;
> +
> + emu = container_of(work, struct snd_emu10k1,
> + emu1010.clock_work);
> + if (emu->card->shutdown)
> + return;
> +#ifdef CONFIG_PM_SLEEP
> + if (emu->suspend)
> + return;
> +#endif
> +
> + // We consider this a mixer setting, so use the mixer's lock
> + down_write(&emu->card->controls_rwsem);
I really don't want to see the driver touching this lock. It's
basically an internal stuff of ALSA core code. And, as already
discussed, the controls_rwsem wasn't intended as a lock for the mixer
content protection originally. It took over the role partially, but
the drivers shouldn't rely on it.
> + snd_emu1010_update_clock(emu);
> + downgrade_write(&emu->card->controls_rwsem);
> + snd_ctl_build_ioff(&id, emu->ctl_clock_source, 0);
> + snd_ctl_notify(emu->card, SNDRV_CTL_EVENT_MASK_VALUE, &id);
> + up_read(&emu->card->controls_rwsem);
Err, too ugly and unnecessary change. snd_ctl_notify() doesn't take
the rwsem, and it can be called at any place without fiddling the
rwsem. It's snd_ctl_notify_one() that needs the downgrade to read
(and maybe we should rename the function to be clearer).
thanks,
Takashi
next prev parent reply other threads:[~2023-07-10 15:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-10 6:59 [PATCH 1/2] ALSA: emu10k1: make E-MU dock monitoring interrupt-driven Oswald Buddenhagen
2023-07-10 6:59 ` [PATCH 2/2] ALSA: emu10k1: track loss of external clock on E-MU cards Oswald Buddenhagen
2023-07-10 15:05 ` Takashi Iwai [this message]
2023-07-10 17:34 ` Oswald Buddenhagen
2023-07-11 5:28 ` Takashi Iwai
2023-07-11 10:11 ` Oswald Buddenhagen
2023-07-11 11:14 ` Takashi Iwai
2023-07-10 14:57 ` [PATCH 1/2] ALSA: emu10k1: make E-MU dock monitoring interrupt-driven Takashi Iwai
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=87ttubyfh9.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=oswald.buddenhagen@gmx.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox